From 44952905e80e3852a9b096f400ce978d4f0cc942 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 28 Dec 2023 19:45:07 +0000 Subject: [PATCH] CodeGen from PR 27173 in Azure/azure-rest-api-specs Merge 66e78084d3e783cec2d1f8010048469084ac3be3 into fa8683f6725e5447cc808420c4542ce8375f0325 --- .../armsecurityinsights/CHANGELOG.md | 151 + .../armsecurityinsights/README.md | 6 +- .../armsecurityinsights/actions_client.go | 16 +- .../actions_client_example_test.go | 140 - .../armsecurityinsights/alertrules_client.go | 16 +- .../alertrules_client_example_test.go | 577 --- .../alertruletemplates_client.go | 8 +- .../alertruletemplates_client_example_test.go | 191 - .../automationrules_client.go | 24 +- .../automationrules_client_example_test.go | 252 -- .../armsecurityinsights/autorest.md | 7 +- .../armsecurityinsights/bookmarks_client.go | 16 +- .../bookmarks_client_example_test.go | 218 -- .../armsecurityinsights/client_factory.go | 72 + .../armsecurityinsights/constants.go | 507 ++- .../contentpackage_client.go | 177 + .../contentpackages_client.go | 200 + .../contenttemplate_client.go | 247 ++ .../contenttemplates_client.go | 136 + .../dataconnectors_client.go | 16 +- .../dataconnectors_client_example_test.go | 607 --- .../armsecurityinsights/date_type.go | 59 + .../fake/actions_server.go | 2 +- .../fake/alertrules_server.go | 2 +- .../fake/alertruletemplates_server.go | 2 +- .../fake/automationrules_server.go | 2 +- .../fake/bookmarks_server.go | 2 +- .../fake/contentpackage_server.go | 151 + .../fake/contentpackages_server.go | 226 ++ .../fake/contenttemplate_server.go | 194 + .../fake/contenttemplates_server.go | 188 + .../fake/dataconnectors_server.go | 2 +- .../armsecurityinsights/fake/date_type.go | 59 + .../fake/incidentcomments_server.go | 2 +- .../fake/incidentrelations_server.go | 2 +- .../fake/incidents_server.go | 2 +- .../fake/metadata_server.go | 342 ++ .../fake/operations_server.go | 2 +- .../fake/polymorphic_helpers.go | 23 +- .../fake/productpackage_server.go | 104 + .../fake/productpackages_server.go | 152 + .../fake/producttemplate_server.go | 104 + .../fake/producttemplates_server.go | 182 + .../securitymlanalyticssettings_server.go | 250 ++ .../fake/sentinelonboardingstates_server.go | 2 +- .../fake/server_factory.go | 82 + .../fake/sourcecontrol_server.go | 116 + .../fake/sourcecontrols_server.go | 250 ++ .../threatintelligenceindicator_server.go | 2 +- ...reatintelligenceindicatormetrics_server.go | 2 +- .../threatintelligenceindicators_server.go | 2 +- .../fake/watchlistitems_server.go | 2 +- .../fake/watchlists_server.go | 2 +- .../armsecurityinsights/go.mod | 14 +- .../armsecurityinsights/go.sum | 19 - .../incidentcomments_client.go | 16 +- .../incidentcomments_client_example_test.go | 163 - .../incidentrelations_client.go | 16 +- .../incidentrelations_client_example_test.go | 157 - .../armsecurityinsights/incidents_client.go | 28 +- .../incidents_client_example_test.go | 428 --- .../armsecurityinsights/interfaces.go | 11 +- .../armsecurityinsights/metadata_client.go | 395 ++ .../armsecurityinsights/models.go | 1250 ++++++- .../armsecurityinsights/models_serde.go | 3260 ++++++++++++++--- .../armsecurityinsights/operations_client.go | 4 +- .../operations_client_example_test.go | 596 --- .../armsecurityinsights/options.go | 223 ++ .../polymorphic_helpers.go | 44 + .../productpackage_client.go | 113 + .../productpackages_client.go | 124 + .../producttemplate_client.go | 113 + .../producttemplates_client.go | 131 + .../armsecurityinsights/response_types.go | 172 + .../securitymlanalyticssettings_client.go | 313 ++ .../sentinelonboardingstates_client.go | 16 +- ...nelonboardingstates_client_example_test.go | 128 - .../sourcecontrol_client.go | 113 + .../sourcecontrols_client.go | 323 ++ .../threatintelligenceindicator_client.go | 28 +- ...telligenceindicator_client_example_test.go | 438 --- ...reatintelligenceindicatormetrics_client.go | 4 +- ...nceindicatormetrics_client_example_test.go | 65 - .../threatintelligenceindicators_client.go | 4 +- ...elligenceindicators_client_example_test.go | 112 - .../watchlistitems_client.go | 16 +- .../watchlistitems_client_example_test.go | 213 -- .../armsecurityinsights/watchlists_client.go | 16 +- .../watchlists_client_example_test.go | 273 -- 89 files changed, 10190 insertions(+), 5247 deletions(-) delete mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/actions_client_example_test.go delete mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/alertrules_client_example_test.go delete mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/alertruletemplates_client_example_test.go delete mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/automationrules_client_example_test.go delete mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarks_client_example_test.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/contentpackage_client.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/contentpackages_client.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/contenttemplate_client.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/contenttemplates_client.go delete mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectors_client_example_test.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/date_type.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/fake/contentpackage_server.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/fake/contentpackages_server.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/fake/contenttemplate_server.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/fake/contenttemplates_server.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/fake/date_type.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/fake/metadata_server.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/fake/productpackage_server.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/fake/productpackages_server.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/fake/producttemplate_server.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/fake/producttemplates_server.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/fake/securitymlanalyticssettings_server.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/fake/sourcecontrol_server.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/fake/sourcecontrols_server.go delete mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/incidentcomments_client_example_test.go delete mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/incidentrelations_client_example_test.go delete mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/incidents_client_example_test.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/metadata_client.go delete mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/operations_client_example_test.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/productpackage_client.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/productpackages_client.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/producttemplate_client.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/producttemplates_client.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/securitymlanalyticssettings_client.go delete mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/sentinelonboardingstates_client_example_test.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrol_client.go create mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrols_client.go delete mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicator_client_example_test.go delete mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicatormetrics_client_example_test.go delete mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicators_client_example_test.go delete mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/watchlistitems_client_example_test.go delete mode 100644 sdk/resourcemanager/securityinsights/armsecurityinsights/watchlists_client_example_test.go diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/CHANGELOG.md b/sdk/resourcemanager/securityinsights/armsecurityinsights/CHANGELOG.md index 30bd23889197..f7dea4e5f837 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/CHANGELOG.md +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/CHANGELOG.md @@ -1,5 +1,156 @@ # Release History +## 2.0.0 (2023-12-28) +### Breaking Changes + +- Type of `IncidentPropertiesAction.Owner` has been changed from `*IncidentOwnerInfoAutoGenerated` to `*IncidentOwnerInfo` +- Type of `WatchlistProperties.Source` has been changed from `*Source` to `*string` +- Enum `Source` has been removed +- Struct `IncidentOwnerInfoAutoGenerated` has been removed + +### Features Added + +- New value `AttackTacticImpairProcessControl`, `AttackTacticInhibitResponseFunction`, `AttackTacticReconnaissance`, `AttackTacticResourceDevelopment` added to enum type `AttackTactic` +- New value `AutomationRulePropertyConditionSupportedPropertyAlertAnalyticRuleIDs`, `AutomationRulePropertyConditionSupportedPropertyIncidentUpdatedBySource` added to enum type `AutomationRulePropertyConditionSupportedProperty` +- New value `ConditionTypePropertyArrayChanged`, `ConditionTypePropertyChanged` added to enum type `ConditionType` +- New value `TriggersOnAlerts` added to enum type `TriggersOn` +- New value `TriggersWhenUpdated` added to enum type `TriggersWhen` +- New enum type `AlertProperty` with values `AlertPropertyAlertLink`, `AlertPropertyConfidenceLevel`, `AlertPropertyConfidenceScore`, `AlertPropertyExtendedLinks`, `AlertPropertyProductComponentName`, `AlertPropertyProductName`, `AlertPropertyProviderName`, `AlertPropertyRemediationSteps`, `AlertPropertyTechniques` +- New enum type `AutomationRulePropertyArrayChangedConditionSupportedArrayType` with values `AutomationRulePropertyArrayChangedConditionSupportedArrayTypeAlerts`, `AutomationRulePropertyArrayChangedConditionSupportedArrayTypeComments`, `AutomationRulePropertyArrayChangedConditionSupportedArrayTypeLabels`, `AutomationRulePropertyArrayChangedConditionSupportedArrayTypeTactics` +- New enum type `AutomationRulePropertyArrayChangedConditionSupportedChangeType` with values `AutomationRulePropertyArrayChangedConditionSupportedChangeTypeAdded` +- New enum type `AutomationRulePropertyChangedConditionSupportedChangedType` with values `AutomationRulePropertyChangedConditionSupportedChangedTypeChangedFrom`, `AutomationRulePropertyChangedConditionSupportedChangedTypeChangedTo` +- New enum type `AutomationRulePropertyChangedConditionSupportedPropertyType` with values `AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentOwner`, `AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentSeverity`, `AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentStatus` +- New enum type `ContentType` with values `ContentTypeAnalyticRule`, `ContentTypeAutomationRule`, `ContentTypeHuntingQuery`, `ContentTypeParser`, `ContentTypePlaybook`, `ContentTypeWorkbook` +- New enum type `DeploymentFetchStatus` with values `DeploymentFetchStatusNotFound`, `DeploymentFetchStatusSuccess`, `DeploymentFetchStatusUnauthorized` +- New enum type `DeploymentResult` with values `DeploymentResultCanceled`, `DeploymentResultFailed`, `DeploymentResultSuccess` +- New enum type `DeploymentState` with values `DeploymentStateCanceling`, `DeploymentStateCompleted`, `DeploymentStateInProgress`, `DeploymentStateQueued` +- New enum type `Flag` with values `FlagFalse`, `FlagTrue` +- New enum type `Kind` with values `KindAnalyticsRule`, `KindAnalyticsRuleTemplate`, `KindAutomationRule`, `KindAzureFunction`, `KindDataConnector`, `KindDataType`, `KindHuntingQuery`, `KindInvestigationQuery`, `KindLogicAppsCustomConnector`, `KindParser`, `KindPlaybook`, `KindPlaybookTemplate`, `KindSolution`, `KindWatchlist`, `KindWatchlistTemplate`, `KindWorkbook`, `KindWorkbookTemplate` +- New enum type `Operator` with values `OperatorAND`, `OperatorOR` +- New enum type `PackageKind` with values `PackageKindSolution`, `PackageKindStandalone` +- New enum type `RepoType` with values `RepoTypeAzureDevOps`, `RepoTypeGithub` +- New enum type `RepositoryAccessKind` with values `RepositoryAccessKindApp`, `RepositoryAccessKindOAuth`, `RepositoryAccessKindPAT` +- New enum type `SecurityMLAnalyticsSettingsKind` with values `SecurityMLAnalyticsSettingsKindAnomaly` +- New enum type `SettingsStatus` with values `SettingsStatusFlighting`, `SettingsStatusProduction` +- New enum type `SourceKind` with values `SourceKindCommunity`, `SourceKindLocalWorkspace`, `SourceKindSolution`, `SourceKindSourceRepository` +- New enum type `State` with values `StateClosed`, `StateOpen` +- New enum type `SupportTier` with values `SupportTierCommunity`, `SupportTierMicrosoft`, `SupportTierPartner` +- New enum type `Version` with values `VersionV1`, `VersionV2` +- New enum type `WarningCode` with values `WarningCodeSourceControlDeletedWithWarnings`, `WarningCodeSourceControlWarningDeletePipelineFromAzureDevOps`, `WarningCodeSourceControlWarningDeleteRoleAssignment`, `WarningCodeSourceControlWarningDeleteServicePrincipal`, `WarningCodeSourceControlWarningDeleteWorkflowAndSecretFromGitHub` +- New function `*AnomalySecurityMLAnalyticsSettings.GetSecurityMLAnalyticsSetting() *SecurityMLAnalyticsSetting` +- New function `*ClientFactory.NewContentPackageClient() *ContentPackageClient` +- New function `*ClientFactory.NewContentPackagesClient() *ContentPackagesClient` +- New function `*ClientFactory.NewContentTemplateClient() *ContentTemplateClient` +- New function `*ClientFactory.NewContentTemplatesClient() *ContentTemplatesClient` +- New function `*ClientFactory.NewMetadataClient() *MetadataClient` +- New function `*ClientFactory.NewProductPackageClient() *ProductPackageClient` +- New function `*ClientFactory.NewProductPackagesClient() *ProductPackagesClient` +- New function `*ClientFactory.NewProductTemplateClient() *ProductTemplateClient` +- New function `*ClientFactory.NewProductTemplatesClient() *ProductTemplatesClient` +- New function `*ClientFactory.NewSecurityMLAnalyticsSettingsClient() *SecurityMLAnalyticsSettingsClient` +- New function `*ClientFactory.NewSourceControlClient() *SourceControlClient` +- New function `*ClientFactory.NewSourceControlsClient() *SourceControlsClient` +- New function `NewContentPackageClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ContentPackageClient, error)` +- New function `*ContentPackageClient.Install(context.Context, string, string, string, PackageModel, *ContentPackageClientInstallOptions) (ContentPackageClientInstallResponse, error)` +- New function `*ContentPackageClient.Uninstall(context.Context, string, string, string, *ContentPackageClientUninstallOptions) (ContentPackageClientUninstallResponse, error)` +- New function `NewContentPackagesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ContentPackagesClient, error)` +- New function `*ContentPackagesClient.Get(context.Context, string, string, string, *ContentPackagesClientGetOptions) (ContentPackagesClientGetResponse, error)` +- New function `*ContentPackagesClient.NewListPager(string, string, *ContentPackagesClientListOptions) *runtime.Pager[ContentPackagesClientListResponse]` +- New function `NewContentTemplateClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ContentTemplateClient, error)` +- New function `*ContentTemplateClient.Delete(context.Context, string, string, string, *ContentTemplateClientDeleteOptions) (ContentTemplateClientDeleteResponse, error)` +- New function `*ContentTemplateClient.Get(context.Context, string, string, string, *ContentTemplateClientGetOptions) (ContentTemplateClientGetResponse, error)` +- New function `*ContentTemplateClient.Install(context.Context, string, string, string, TemplateModel, *ContentTemplateClientInstallOptions) (ContentTemplateClientInstallResponse, error)` +- New function `NewContentTemplatesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ContentTemplatesClient, error)` +- New function `*ContentTemplatesClient.NewListPager(string, string, *ContentTemplatesClientListOptions) *runtime.Pager[ContentTemplatesClientListResponse]` +- New function `NewMetadataClient(string, azcore.TokenCredential, *arm.ClientOptions) (*MetadataClient, error)` +- New function `*MetadataClient.Create(context.Context, string, string, string, MetadataModel, *MetadataClientCreateOptions) (MetadataClientCreateResponse, error)` +- New function `*MetadataClient.Delete(context.Context, string, string, string, *MetadataClientDeleteOptions) (MetadataClientDeleteResponse, error)` +- New function `*MetadataClient.Get(context.Context, string, string, string, *MetadataClientGetOptions) (MetadataClientGetResponse, error)` +- New function `*MetadataClient.NewListPager(string, string, *MetadataClientListOptions) *runtime.Pager[MetadataClientListResponse]` +- New function `*MetadataClient.Update(context.Context, string, string, string, MetadataPatch, *MetadataClientUpdateOptions) (MetadataClientUpdateResponse, error)` +- New function `NewProductPackageClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProductPackageClient, error)` +- New function `*ProductPackageClient.Get(context.Context, string, string, string, *ProductPackageClientGetOptions) (ProductPackageClientGetResponse, error)` +- New function `NewProductPackagesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProductPackagesClient, error)` +- New function `*ProductPackagesClient.NewListPager(string, string, *ProductPackagesClientListOptions) *runtime.Pager[ProductPackagesClientListResponse]` +- New function `NewProductTemplateClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProductTemplateClient, error)` +- New function `*ProductTemplateClient.Get(context.Context, string, string, string, *ProductTemplateClientGetOptions) (ProductTemplateClientGetResponse, error)` +- New function `NewProductTemplatesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ProductTemplatesClient, error)` +- New function `*ProductTemplatesClient.NewListPager(string, string, *ProductTemplatesClientListOptions) *runtime.Pager[ProductTemplatesClientListResponse]` +- New function `*PropertyArrayChangedConditionProperties.GetAutomationRuleCondition() *AutomationRuleCondition` +- New function `*PropertyChangedConditionProperties.GetAutomationRuleCondition() *AutomationRuleCondition` +- New function `*SecurityMLAnalyticsSetting.GetSecurityMLAnalyticsSetting() *SecurityMLAnalyticsSetting` +- New function `NewSecurityMLAnalyticsSettingsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SecurityMLAnalyticsSettingsClient, error)` +- New function `*SecurityMLAnalyticsSettingsClient.CreateOrUpdate(context.Context, string, string, string, SecurityMLAnalyticsSettingClassification, *SecurityMLAnalyticsSettingsClientCreateOrUpdateOptions) (SecurityMLAnalyticsSettingsClientCreateOrUpdateResponse, error)` +- New function `*SecurityMLAnalyticsSettingsClient.Delete(context.Context, string, string, string, *SecurityMLAnalyticsSettingsClientDeleteOptions) (SecurityMLAnalyticsSettingsClientDeleteResponse, error)` +- New function `*SecurityMLAnalyticsSettingsClient.Get(context.Context, string, string, string, *SecurityMLAnalyticsSettingsClientGetOptions) (SecurityMLAnalyticsSettingsClientGetResponse, error)` +- New function `*SecurityMLAnalyticsSettingsClient.NewListPager(string, string, *SecurityMLAnalyticsSettingsClientListOptions) *runtime.Pager[SecurityMLAnalyticsSettingsClientListResponse]` +- New function `NewSourceControlClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SourceControlClient, error)` +- New function `*SourceControlClient.NewListRepositoriesPager(string, string, RepositoryAccessProperties, *SourceControlClientListRepositoriesOptions) *runtime.Pager[SourceControlClientListRepositoriesResponse]` +- New function `NewSourceControlsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SourceControlsClient, error)` +- New function `*SourceControlsClient.Create(context.Context, string, string, string, SourceControl, *SourceControlsClientCreateOptions) (SourceControlsClientCreateResponse, error)` +- New function `*SourceControlsClient.Delete(context.Context, string, string, string, RepositoryAccessProperties, *SourceControlsClientDeleteOptions) (SourceControlsClientDeleteResponse, error)` +- New function `*SourceControlsClient.Get(context.Context, string, string, string, *SourceControlsClientGetOptions) (SourceControlsClientGetResponse, error)` +- New function `*SourceControlsClient.NewListPager(string, string, *SourceControlsClientListOptions) *runtime.Pager[SourceControlsClientListResponse]` +- New struct `AlertPropertyMapping` +- New struct `AnomalySecurityMLAnalyticsSettings` +- New struct `AnomalySecurityMLAnalyticsSettingsProperties` +- New struct `AutomationRulePropertyArrayChangedValuesCondition` +- New struct `AutomationRulePropertyValuesChangedCondition` +- New struct `AzureDevOpsResourceInfo` +- New struct `Deployment` +- New struct `DeploymentInfo` +- New struct `GitHubResourceInfo` +- New struct `MetadataAuthor` +- New struct `MetadataCategories` +- New struct `MetadataDependencies` +- New struct `MetadataList` +- New struct `MetadataModel` +- New struct `MetadataPatch` +- New struct `MetadataProperties` +- New struct `MetadataPropertiesPatch` +- New struct `MetadataSource` +- New struct `MetadataSupport` +- New struct `PackageList` +- New struct `PackageModel` +- New struct `PackageProperties` +- New struct `ProductPackageList` +- New struct `ProductPackageModel` +- New struct `ProductPackageProperties` +- New struct `ProductTemplateList` +- New struct `ProductTemplateModel` +- New struct `ProductTemplateProperties` +- New struct `PropertyArrayChangedConditionProperties` +- New struct `PropertyChangedConditionProperties` +- New struct `PullRequest` +- New struct `Repo` +- New struct `RepoList` +- New struct `Repository` +- New struct `RepositoryAccess` +- New struct `RepositoryAccessObject` +- New struct `RepositoryAccessProperties` +- New struct `RepositoryResourceInfo` +- New struct `SecurityMLAnalyticsSettingsDataSource` +- New struct `SecurityMLAnalyticsSettingsList` +- New struct `ServicePrincipal` +- New struct `SourceControl` +- New struct `SourceControlList` +- New struct `SourceControlProperties` +- New struct `TemplateList` +- New struct `TemplateModel` +- New struct `TemplateProperties` +- New struct `Warning` +- New struct `WarningBody` +- New struct `Webhook` +- New field `AlertDynamicProperties` in struct `AlertDetailsOverride` +- New field `Techniques` in struct `FusionAlertRuleProperties` +- New field `Techniques` in struct `FusionAlertRuleTemplateProperties` +- New field `ProviderIncidentURL` in struct `IncidentAdditionalData` +- New field `OwnerType` in struct `IncidentOwnerInfo` +- New field `ProviderIncidentID`, `ProviderName` in struct `IncidentProperties` +- New field `Techniques` in struct `ScheduledAlertRuleProperties` +- New field `Techniques` in struct `ScheduledAlertRuleTemplateProperties` + + ## 1.2.0 (2023-11-24) ### Features Added diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/README.md b/sdk/resourcemanager/securityinsights/armsecurityinsights/README.md index c0ed49fc5de0..652cb4339dea 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/README.md +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/README.md @@ -1,6 +1,6 @@ # Azure Security Insight Module for Go -[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights) +[![PkgGoDev](https://pkg.go.dev/badge/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2)](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2) The `armsecurityinsights` module provides operations for working with Azure Security Insight. @@ -20,7 +20,7 @@ This project uses [Go modules](https://github.com/golang/go/wiki/Modules) for ve Install the Azure Security Insight module: ```sh -go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights +go get github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2 ``` ## Authorization @@ -57,7 +57,7 @@ clientFactory, err := armsecurityinsights.NewClientFactory(, cr A client groups a set of related APIs, providing access to its functionality. Create one or more clients to access the APIs you require using client factory. ```go -client := clientFactory.NewEntityQueriesClient() +client := clientFactory.NewActionsClient() ``` ## Fakes diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/actions_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/actions_client.go index 72a154e151ad..e6ad791e36d9 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/actions_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/actions_client.go @@ -46,7 +46,7 @@ func NewActionsClient(subscriptionID string, credential azcore.TokenCredential, // CreateOrUpdate - Creates or updates the action of alert rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - ruleID - Alert rule ID @@ -103,7 +103,7 @@ func (client *ActionsClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, action); err != nil { @@ -124,7 +124,7 @@ func (client *ActionsClient) createOrUpdateHandleResponse(resp *http.Response) ( // Delete - Delete the action of alert rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - ruleID - Alert rule ID @@ -179,7 +179,7 @@ func (client *ActionsClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,7 +188,7 @@ func (client *ActionsClient) deleteCreateRequest(ctx context.Context, resourceGr // Get - Gets the action of alert rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - ruleID - Alert rule ID @@ -244,7 +244,7 @@ func (client *ActionsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,7 +261,7 @@ func (client *ActionsClient) getHandleResponse(resp *http.Response) (ActionsClie // NewListByAlertRulePager - Gets all actions of alert rule. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - ruleID - Alert rule ID @@ -314,7 +314,7 @@ func (client *ActionsClient) listByAlertRuleCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/actions_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/actions_client_example_test.go deleted file mode 100644 index eed851d2ac81..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/actions_client_example_test.go +++ /dev/null @@ -1,140 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/actions/GetAllActionsByAlertRule.json -func ExampleActionsClient_NewListByAlertRulePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewActionsClient().NewListByAlertRulePager("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ActionsList = armsecurityinsights.ActionsList{ - // Value: []*armsecurityinsights.ActionResponse{ - // { - // Name: to.Ptr("912bec42-cb66-4c03-ac63-1761b6898c3e"), - // Type: to.Ptr("Microsoft.SecurityInsights/alertRules/actions"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/73e01a99-5cd7-4139-a149-9f2736ff2ab5/actions/912bec42-cb66-4c03-ac63-1761b6898c3e"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Properties: &armsecurityinsights.ActionResponseProperties{ - // LogicAppResourceID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.Logic/workflows/MyAlerts"), - // WorkflowID: to.Ptr("cd3765391efd48549fd7681ded1d48d7"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/actions/GetActionOfAlertRuleById.json -func ExampleActionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionsClient().Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", "912bec42-cb66-4c03-ac63-1761b6898c3e", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActionResponse = armsecurityinsights.ActionResponse{ - // Name: to.Ptr("912bec42-cb66-4c03-ac63-1761b6898c3e"), - // Type: to.Ptr("Microsoft.SecurityInsights/alertRules/actions"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/73e01a99-5cd7-4139-a149-9f2736ff2ab5/actions/912bec42-cb66-4c03-ac63-1761b6898c3e"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Properties: &armsecurityinsights.ActionResponseProperties{ - // LogicAppResourceID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.Logic/workflows/MyAlerts"), - // WorkflowID: to.Ptr("cd3765391efd48549fd7681ded1d48d7"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/actions/CreateActionOfAlertRule.json -func ExampleActionsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewActionsClient().CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", "912bec42-cb66-4c03-ac63-1761b6898c3e", armsecurityinsights.ActionRequest{ - Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - Properties: &armsecurityinsights.ActionRequestProperties{ - LogicAppResourceID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.Logic/workflows/MyAlerts"), - TriggerURI: to.Ptr("https://prod-31.northcentralus.logic.azure.com:443/workflows/cd3765391efd48549fd7681ded1d48d7/triggers/manual/paths/invoke?api-version=2016-10-01&sp=%2Ftriggers%2Fmanual%2Frun&sv=1.0&sig=signature"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ActionResponse = armsecurityinsights.ActionResponse{ - // Name: to.Ptr("912bec42-cb66-4c03-ac63-1761b6898c3e"), - // Type: to.Ptr("Microsoft.SecurityInsights/alertRules/actions"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/73e01a99-5cd7-4139-a149-9f2736ff2ab5/actions/912bec42-cb66-4c03-ac63-1761b6898c3e"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Properties: &armsecurityinsights.ActionResponseProperties{ - // LogicAppResourceID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.Logic/workflows/MyAlerts"), - // WorkflowID: to.Ptr("cd3765391efd48549fd7681ded1d48d7"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/actions/DeleteActionOfAlertRule.json -func ExampleActionsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewActionsClient().Delete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", "912bec42-cb66-4c03-ac63-1761b6898c3e", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/alertrules_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/alertrules_client.go index e287783d9bca..19bd863e8528 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/alertrules_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/alertrules_client.go @@ -46,7 +46,7 @@ func NewAlertRulesClient(subscriptionID string, credential azcore.TokenCredentia // CreateOrUpdate - Creates or updates the alert rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - ruleID - Alert rule ID @@ -99,7 +99,7 @@ func (client *AlertRulesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, alertRule); err != nil { @@ -120,7 +120,7 @@ func (client *AlertRulesClient) createOrUpdateHandleResponse(resp *http.Response // Delete - Delete the alert rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - ruleID - Alert rule ID @@ -170,7 +170,7 @@ func (client *AlertRulesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -179,7 +179,7 @@ func (client *AlertRulesClient) deleteCreateRequest(ctx context.Context, resourc // Get - Gets the alert rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - ruleID - Alert rule ID @@ -230,7 +230,7 @@ func (client *AlertRulesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -247,7 +247,7 @@ func (client *AlertRulesClient) getHandleResponse(resp *http.Response) (AlertRul // NewListPager - Gets all alert rules. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - options - AlertRulesClientListOptions contains the optional parameters for the AlertRulesClient.NewListPager method. @@ -294,7 +294,7 @@ func (client *AlertRulesClient) listCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/alertrules_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/alertrules_client_example_test.go deleted file mode 100644 index 2aaaf251864b..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/alertrules_client_example_test.go +++ /dev/null @@ -1,577 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/alertRules/GetAllAlertRules.json -func ExampleAlertRulesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAlertRulesClient().NewListPager("myRg", "myWorkspace", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AlertRulesList = armsecurityinsights.AlertRulesList{ - // Value: []armsecurityinsights.AlertRuleClassification{ - // &armsecurityinsights.ScheduledAlertRule{ - // Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Type: to.Ptr("Microsoft.SecurityInsights/alertRules"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.AlertRuleKindScheduled), - // Properties: &armsecurityinsights.ScheduledAlertRuleProperties{ - // AlertDetailsOverride: &armsecurityinsights.AlertDetailsOverride{ - // AlertDescriptionFormat: to.Ptr("Suspicious activity was made by {{ComputerIP}}"), - // AlertDisplayNameFormat: to.Ptr("Alert from {{Computer}}"), - // }, - // CustomDetails: map[string]*string{ - // "OperatingSystemName": to.Ptr("OSName"), - // "OperatingSystemType": to.Ptr("OSType"), - // }, - // EntityMappings: []*armsecurityinsights.EntityMapping{ - // { - // EntityType: to.Ptr(armsecurityinsights.EntityMappingTypeHost), - // FieldMappings: []*armsecurityinsights.FieldMapping{ - // { - // ColumnName: to.Ptr("Computer"), - // Identifier: to.Ptr("FullName"), - // }}, - // }, - // { - // EntityType: to.Ptr(armsecurityinsights.EntityMappingTypeIP), - // FieldMappings: []*armsecurityinsights.FieldMapping{ - // { - // ColumnName: to.Ptr("ComputerIP"), - // Identifier: to.Ptr("Address"), - // }}, - // }}, - // EventGroupingSettings: &armsecurityinsights.EventGroupingSettings{ - // AggregationKind: to.Ptr(armsecurityinsights.EventGroupingAggregationKindAlertPerResult), - // }, - // Query: to.Ptr("Heartbeat"), - // QueryFrequency: to.Ptr("PT1H"), - // QueryPeriod: to.Ptr("P2DT1H30M"), - // Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - // TriggerOperator: to.Ptr(armsecurityinsights.TriggerOperatorGreaterThan), - // TriggerThreshold: to.Ptr[int32](0), - // Description: to.Ptr("An example for a scheduled rule"), - // DisplayName: to.Ptr("My scheduled rule"), - // Enabled: to.Ptr(true), - // IncidentConfiguration: &armsecurityinsights.IncidentConfiguration{ - // CreateIncident: to.Ptr(true), - // GroupingConfiguration: &armsecurityinsights.GroupingConfiguration{ - // Enabled: to.Ptr(true), - // GroupByAlertDetails: []*armsecurityinsights.AlertDetail{ - // to.Ptr(armsecurityinsights.AlertDetailDisplayName)}, - // GroupByCustomDetails: []*string{ - // to.Ptr("OperatingSystemType"), - // to.Ptr("OperatingSystemName")}, - // GroupByEntities: []*armsecurityinsights.EntityMappingType{ - // to.Ptr(armsecurityinsights.EntityMappingTypeHost)}, - // LookbackDuration: to.Ptr("PT5H"), - // MatchingMethod: to.Ptr(armsecurityinsights.MatchingMethodSelected), - // ReopenClosedIncident: to.Ptr(false), - // }, - // }, - // LastModifiedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-01T13:17:30.000Z"); return t}()), - // SuppressionDuration: to.Ptr("PT1H"), - // SuppressionEnabled: to.Ptr(false), - // Tactics: []*armsecurityinsights.AttackTactic{ - // to.Ptr(armsecurityinsights.AttackTacticPersistence), - // to.Ptr(armsecurityinsights.AttackTacticLateralMovement)}, - // }, - // }, - // &armsecurityinsights.MicrosoftSecurityIncidentCreationAlertRule{ - // Name: to.Ptr("microsoftSecurityIncidentCreationRuleExample"), - // Type: to.Ptr("Microsoft.SecurityInsights/alertRules"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/microsoftSecurityIncidentCreationRuleExample"), - // Etag: to.Ptr("\"260097e0-0000-0d00-0000-5d6fa88f0000\""), - // Kind: to.Ptr(armsecurityinsights.AlertRuleKindMicrosoftSecurityIncidentCreation), - // Properties: &armsecurityinsights.MicrosoftSecurityIncidentCreationAlertRuleProperties{ - // ProductFilter: to.Ptr(armsecurityinsights.MicrosoftSecurityProductNameMicrosoftCloudAppSecurity), - // DisplayName: to.Ptr("testing displayname"), - // Enabled: to.Ptr(true), - // LastModifiedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-04T12:05:35.729Z"); return t}()), - // }, - // }, - // &armsecurityinsights.FusionAlertRule{ - // Name: to.Ptr("myFirstFusionRule"), - // Type: to.Ptr("Microsoft.SecurityInsights/alertRules"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/myFirstFusionRule"), - // Etag: to.Ptr("\"25005c11-0000-0d00-0000-5d6cc0e20000\""), - // Kind: to.Ptr(armsecurityinsights.AlertRuleKindFusion), - // Properties: &armsecurityinsights.FusionAlertRuleProperties{ - // Description: to.Ptr("In this mode, Sentinel combines low fidelity alerts, which themselves may not be actionable, and events across multiple products, into high fidelity security interesting incidents. The system looks at multiple products to produce actionable incidents. Custom tailored to each tenant, Fusion not only reduces false positive rates but also can detect attacks with limited or missing information. \nIncidents generated by Fusion system will encase two or more alerts. By design, Fusion incidents are low volume, high fidelity and will be high severity, which is why Fusion is turned ON by default in Azure Sentinel.\n\nFor Fusion to work, please configure the following data sources in Data Connectors tab:\nRequired - Azure Active Directory Identity Protection\nRequired - Microsoft Cloud App Security\nIf Available - Palo Alto Network\n\nFor full list of scenarios covered by Fusion, and detail instructions on how to configure the required data sources, go to aka.ms/SentinelFusion"), - // AlertRuleTemplateName: to.Ptr("f71aba3d-28fb-450b-b192-4e76a83015c8"), - // DisplayName: to.Ptr("Advanced Multi-Stage Attack Detection"), - // Enabled: to.Ptr(false), - // LastModifiedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-02T07:12:34.906Z"); return t}()), - // Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - // Tactics: []*armsecurityinsights.AttackTactic{ - // to.Ptr(armsecurityinsights.AttackTacticPersistence), - // to.Ptr(armsecurityinsights.AttackTacticLateralMovement), - // to.Ptr(armsecurityinsights.AttackTacticExfiltration), - // to.Ptr(armsecurityinsights.AttackTacticCommandAndControl)}, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/alertRules/GetFusionAlertRule.json -func ExampleAlertRulesClient_Get_getAFusionAlertRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRulesClient().Get(ctx, "myRg", "myWorkspace", "myFirstFusionRule", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.AlertRulesClientGetResponse{ - // AlertRuleClassification: &armsecurityinsights.FusionAlertRule{ - // Name: to.Ptr("myFirstFusionRule"), - // Type: to.Ptr("Microsoft.SecurityInsights/alertRules"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/myFirstFusionRule"), - // Etag: to.Ptr("\"260090e2-0000-0d00-0000-5d6fb8670000\""), - // Kind: to.Ptr(armsecurityinsights.AlertRuleKindFusion), - // Properties: &armsecurityinsights.FusionAlertRuleProperties{ - // Description: to.Ptr("In this mode, Sentinel combines low fidelity alerts, which themselves may not be actionable, and events across multiple products, into high fidelity security interesting incidents. The system looks at multiple products to produce actionable incidents. Custom tailored to each tenant, Fusion not only reduces false positive rates but also can detect attacks with limited or missing information. \nIncidents generated by Fusion system will encase two or more alerts. By design, Fusion incidents are low volume, high fidelity and will be high severity, which is why Fusion is turned ON by default in Azure Sentinel.\n\nFor Fusion to work, please configure the following data sources in Data Connectors tab:\nRequired - Azure Active Directory Identity Protection\nRequired - Microsoft Cloud App Security\nIf Available - Palo Alto Network\n\nFor full list of scenarios covered by Fusion, and detail instructions on how to configure the required data sources, go to aka.ms/SentinelFusion"), - // AlertRuleTemplateName: to.Ptr("f71aba3d-28fb-450b-b192-4e76a83015c8"), - // DisplayName: to.Ptr("Advanced Multi-Stage Attack Detection"), - // Enabled: to.Ptr(true), - // LastModifiedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-04T13:13:11.534Z"); return t}()), - // Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - // Tactics: []*armsecurityinsights.AttackTactic{ - // to.Ptr(armsecurityinsights.AttackTacticPersistence), - // to.Ptr(armsecurityinsights.AttackTacticLateralMovement), - // to.Ptr(armsecurityinsights.AttackTacticExfiltration), - // to.Ptr(armsecurityinsights.AttackTacticCommandAndControl)}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/alertRules/GetMicrosoftSecurityIncidentCreationAlertRule.json -func ExampleAlertRulesClient_Get_getAMicrosoftSecurityIncidentCreationRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRulesClient().Get(ctx, "myRg", "myWorkspace", "microsoftSecurityIncidentCreationRuleExample", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.AlertRulesClientGetResponse{ - // AlertRuleClassification: &armsecurityinsights.MicrosoftSecurityIncidentCreationAlertRule{ - // Name: to.Ptr("microsoftSecurityIncidentCreationRuleExample"), - // Type: to.Ptr("Microsoft.SecurityInsights/alertRules"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/microsoftSecurityIncidentCreationRuleExample"), - // Etag: to.Ptr("\"260097e0-0000-0d00-0000-5d6fa88f0000\""), - // Kind: to.Ptr(armsecurityinsights.AlertRuleKindMicrosoftSecurityIncidentCreation), - // Properties: &armsecurityinsights.MicrosoftSecurityIncidentCreationAlertRuleProperties{ - // ProductFilter: to.Ptr(armsecurityinsights.MicrosoftSecurityProductNameMicrosoftCloudAppSecurity), - // DisplayName: to.Ptr("testing displayname"), - // Enabled: to.Ptr(true), - // LastModifiedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-04T12:05:35.729Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/alertRules/GetScheduledAlertRule.json -func ExampleAlertRulesClient_Get_getAScheduledAlertRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRulesClient().Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.AlertRulesClientGetResponse{ - // AlertRuleClassification: &armsecurityinsights.ScheduledAlertRule{ - // Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Type: to.Ptr("Microsoft.SecurityInsights/alertRules"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.AlertRuleKindScheduled), - // Properties: &armsecurityinsights.ScheduledAlertRuleProperties{ - // AlertDetailsOverride: &armsecurityinsights.AlertDetailsOverride{ - // AlertDescriptionFormat: to.Ptr("Suspicious activity was made by {{ComputerIP}}"), - // AlertDisplayNameFormat: to.Ptr("Alert from {{Computer}}"), - // }, - // CustomDetails: map[string]*string{ - // "OperatingSystemName": to.Ptr("OSName"), - // "OperatingSystemType": to.Ptr("OSType"), - // }, - // EntityMappings: []*armsecurityinsights.EntityMapping{ - // { - // EntityType: to.Ptr(armsecurityinsights.EntityMappingTypeHost), - // FieldMappings: []*armsecurityinsights.FieldMapping{ - // { - // ColumnName: to.Ptr("Computer"), - // Identifier: to.Ptr("FullName"), - // }}, - // }, - // { - // EntityType: to.Ptr(armsecurityinsights.EntityMappingTypeIP), - // FieldMappings: []*armsecurityinsights.FieldMapping{ - // { - // ColumnName: to.Ptr("ComputerIP"), - // Identifier: to.Ptr("Address"), - // }}, - // }}, - // EventGroupingSettings: &armsecurityinsights.EventGroupingSettings{ - // AggregationKind: to.Ptr(armsecurityinsights.EventGroupingAggregationKindAlertPerResult), - // }, - // Query: to.Ptr("Heartbeat"), - // QueryFrequency: to.Ptr("PT1H"), - // QueryPeriod: to.Ptr("P2DT1H30M"), - // Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - // TriggerOperator: to.Ptr(armsecurityinsights.TriggerOperatorGreaterThan), - // TriggerThreshold: to.Ptr[int32](0), - // Description: to.Ptr("An example for a scheduled rule"), - // DisplayName: to.Ptr("My scheduled rule"), - // Enabled: to.Ptr(true), - // IncidentConfiguration: &armsecurityinsights.IncidentConfiguration{ - // CreateIncident: to.Ptr(true), - // GroupingConfiguration: &armsecurityinsights.GroupingConfiguration{ - // Enabled: to.Ptr(true), - // GroupByAlertDetails: []*armsecurityinsights.AlertDetail{ - // to.Ptr(armsecurityinsights.AlertDetailDisplayName)}, - // GroupByCustomDetails: []*string{ - // to.Ptr("OperatingSystemType"), - // to.Ptr("OperatingSystemName")}, - // GroupByEntities: []*armsecurityinsights.EntityMappingType{ - // to.Ptr(armsecurityinsights.EntityMappingTypeHost)}, - // LookbackDuration: to.Ptr("PT5H"), - // MatchingMethod: to.Ptr(armsecurityinsights.MatchingMethodSelected), - // ReopenClosedIncident: to.Ptr(false), - // }, - // }, - // LastModifiedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // SuppressionDuration: to.Ptr("PT1H"), - // SuppressionEnabled: to.Ptr(false), - // Tactics: []*armsecurityinsights.AttackTactic{ - // to.Ptr(armsecurityinsights.AttackTacticPersistence), - // to.Ptr(armsecurityinsights.AttackTacticLateralMovement)}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/alertRules/CreateFusionAlertRule.json -func ExampleAlertRulesClient_CreateOrUpdate_createsOrUpdatesAFusionAlertRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRulesClient().CreateOrUpdate(ctx, "myRg", "myWorkspace", "myFirstFusionRule", &armsecurityinsights.FusionAlertRule{ - Etag: to.Ptr("3d00c3ca-0000-0100-0000-5d42d5010000"), - Kind: to.Ptr(armsecurityinsights.AlertRuleKindFusion), - Properties: &armsecurityinsights.FusionAlertRuleProperties{ - AlertRuleTemplateName: to.Ptr("f71aba3d-28fb-450b-b192-4e76a83015c8"), - Enabled: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.AlertRulesClientCreateOrUpdateResponse{ - // AlertRuleClassification: &armsecurityinsights.FusionAlertRule{ - // Name: to.Ptr("myFirstFusionRule"), - // Type: to.Ptr("Microsoft.SecurityInsights/alertRules"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/myFirstFusionRule"), - // Etag: to.Ptr("\"260090e2-0000-0d00-0000-5d6fb8670000\""), - // Kind: to.Ptr(armsecurityinsights.AlertRuleKindFusion), - // Properties: &armsecurityinsights.FusionAlertRuleProperties{ - // Description: to.Ptr("In this mode, Sentinel combines low fidelity alerts, which themselves may not be actionable, and events across multiple products, into high fidelity security interesting incidents. The system looks at multiple products to produce actionable incidents. Custom tailored to each tenant, Fusion not only reduces false positive rates but also can detect attacks with limited or missing information. \nIncidents generated by Fusion system will encase two or more alerts. By design, Fusion incidents are low volume, high fidelity and will be high severity, which is why Fusion is turned ON by default in Azure Sentinel.\n\nFor Fusion to work, please configure the following data sources in Data Connectors tab:\nRequired - Azure Active Directory Identity Protection\nRequired - Microsoft Cloud App Security\nIf Available - Palo Alto Network\n\nFor full list of scenarios covered by Fusion, and detail instructions on how to configure the required data sources, go to aka.ms/SentinelFusion"), - // AlertRuleTemplateName: to.Ptr("f71aba3d-28fb-450b-b192-4e76a83015c8"), - // DisplayName: to.Ptr("Advanced Multi-Stage Attack Detection"), - // Enabled: to.Ptr(true), - // LastModifiedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-04T13:13:11.534Z"); return t}()), - // Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - // Tactics: []*armsecurityinsights.AttackTactic{ - // to.Ptr(armsecurityinsights.AttackTacticPersistence), - // to.Ptr(armsecurityinsights.AttackTacticLateralMovement), - // to.Ptr(armsecurityinsights.AttackTacticExfiltration), - // to.Ptr(armsecurityinsights.AttackTacticCommandAndControl)}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/alertRules/CreateMicrosoftSecurityIncidentCreationAlertRule.json -func ExampleAlertRulesClient_CreateOrUpdate_createsOrUpdatesAMicrosoftSecurityIncidentCreationRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRulesClient().CreateOrUpdate(ctx, "myRg", "myWorkspace", "microsoftSecurityIncidentCreationRuleExample", &armsecurityinsights.MicrosoftSecurityIncidentCreationAlertRule{ - Etag: to.Ptr("\"260097e0-0000-0d00-0000-5d6fa88f0000\""), - Kind: to.Ptr(armsecurityinsights.AlertRuleKindMicrosoftSecurityIncidentCreation), - Properties: &armsecurityinsights.MicrosoftSecurityIncidentCreationAlertRuleProperties{ - ProductFilter: to.Ptr(armsecurityinsights.MicrosoftSecurityProductNameMicrosoftCloudAppSecurity), - DisplayName: to.Ptr("testing displayname"), - Enabled: to.Ptr(true), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.AlertRulesClientCreateOrUpdateResponse{ - // AlertRuleClassification: &armsecurityinsights.MicrosoftSecurityIncidentCreationAlertRule{ - // Name: to.Ptr("microsoftSecurityIncidentCreationRuleExample"), - // Type: to.Ptr("Microsoft.SecurityInsights/alertRules"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/microsoftSecurityIncidentCreationRuleExample"), - // Etag: to.Ptr("\"260097e0-0000-0d00-0000-5d6fa88f0000\""), - // Kind: to.Ptr(armsecurityinsights.AlertRuleKindMicrosoftSecurityIncidentCreation), - // Properties: &armsecurityinsights.MicrosoftSecurityIncidentCreationAlertRuleProperties{ - // ProductFilter: to.Ptr(armsecurityinsights.MicrosoftSecurityProductNameMicrosoftCloudAppSecurity), - // DisplayName: to.Ptr("testing displayname"), - // Enabled: to.Ptr(true), - // LastModifiedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-09-04T12:05:35.729Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/alertRules/CreateScheduledAlertRule.json -func ExampleAlertRulesClient_CreateOrUpdate_createsOrUpdatesAScheduledAlertRule() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRulesClient().CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", &armsecurityinsights.ScheduledAlertRule{ - Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - Kind: to.Ptr(armsecurityinsights.AlertRuleKindScheduled), - Properties: &armsecurityinsights.ScheduledAlertRuleProperties{ - AlertDetailsOverride: &armsecurityinsights.AlertDetailsOverride{ - AlertDescriptionFormat: to.Ptr("Suspicious activity was made by {{ComputerIP}}"), - AlertDisplayNameFormat: to.Ptr("Alert from {{Computer}}"), - }, - CustomDetails: map[string]*string{ - "OperatingSystemName": to.Ptr("OSName"), - "OperatingSystemType": to.Ptr("OSType"), - }, - EntityMappings: []*armsecurityinsights.EntityMapping{ - { - EntityType: to.Ptr(armsecurityinsights.EntityMappingTypeHost), - FieldMappings: []*armsecurityinsights.FieldMapping{ - { - ColumnName: to.Ptr("Computer"), - Identifier: to.Ptr("FullName"), - }}, - }, - { - EntityType: to.Ptr(armsecurityinsights.EntityMappingTypeIP), - FieldMappings: []*armsecurityinsights.FieldMapping{ - { - ColumnName: to.Ptr("ComputerIP"), - Identifier: to.Ptr("Address"), - }}, - }}, - EventGroupingSettings: &armsecurityinsights.EventGroupingSettings{ - AggregationKind: to.Ptr(armsecurityinsights.EventGroupingAggregationKindAlertPerResult), - }, - Query: to.Ptr("Heartbeat"), - QueryFrequency: to.Ptr("PT1H"), - QueryPeriod: to.Ptr("P2DT1H30M"), - Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - TriggerOperator: to.Ptr(armsecurityinsights.TriggerOperatorGreaterThan), - TriggerThreshold: to.Ptr[int32](0), - Description: to.Ptr("An example for a scheduled rule"), - DisplayName: to.Ptr("My scheduled rule"), - Enabled: to.Ptr(true), - IncidentConfiguration: &armsecurityinsights.IncidentConfiguration{ - CreateIncident: to.Ptr(true), - GroupingConfiguration: &armsecurityinsights.GroupingConfiguration{ - Enabled: to.Ptr(true), - GroupByAlertDetails: []*armsecurityinsights.AlertDetail{ - to.Ptr(armsecurityinsights.AlertDetailDisplayName)}, - GroupByCustomDetails: []*string{ - to.Ptr("OperatingSystemType"), - to.Ptr("OperatingSystemName")}, - GroupByEntities: []*armsecurityinsights.EntityMappingType{ - to.Ptr(armsecurityinsights.EntityMappingTypeHost)}, - LookbackDuration: to.Ptr("PT5H"), - MatchingMethod: to.Ptr(armsecurityinsights.MatchingMethodSelected), - ReopenClosedIncident: to.Ptr(false), - }, - }, - SuppressionDuration: to.Ptr("PT1H"), - SuppressionEnabled: to.Ptr(false), - Tactics: []*armsecurityinsights.AttackTactic{ - to.Ptr(armsecurityinsights.AttackTacticPersistence), - to.Ptr(armsecurityinsights.AttackTacticLateralMovement)}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.AlertRulesClientCreateOrUpdateResponse{ - // AlertRuleClassification: &armsecurityinsights.ScheduledAlertRule{ - // Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Type: to.Ptr("Microsoft.SecurityInsights/alertRules"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.AlertRuleKindScheduled), - // Properties: &armsecurityinsights.ScheduledAlertRuleProperties{ - // AlertDetailsOverride: &armsecurityinsights.AlertDetailsOverride{ - // AlertDescriptionFormat: to.Ptr("Suspicious activity was made by {{ComputerIP}}"), - // AlertDisplayNameFormat: to.Ptr("Alert from {{Computer}}"), - // }, - // CustomDetails: map[string]*string{ - // "OperatingSystemName": to.Ptr("OSName"), - // "OperatingSystemType": to.Ptr("OSType"), - // }, - // EntityMappings: []*armsecurityinsights.EntityMapping{ - // { - // EntityType: to.Ptr(armsecurityinsights.EntityMappingTypeHost), - // FieldMappings: []*armsecurityinsights.FieldMapping{ - // { - // ColumnName: to.Ptr("Computer"), - // Identifier: to.Ptr("FullName"), - // }}, - // }, - // { - // EntityType: to.Ptr(armsecurityinsights.EntityMappingTypeIP), - // FieldMappings: []*armsecurityinsights.FieldMapping{ - // { - // ColumnName: to.Ptr("ComputerIP"), - // Identifier: to.Ptr("Address"), - // }}, - // }}, - // EventGroupingSettings: &armsecurityinsights.EventGroupingSettings{ - // AggregationKind: to.Ptr(armsecurityinsights.EventGroupingAggregationKindAlertPerResult), - // }, - // Query: to.Ptr("Heartbeat"), - // QueryFrequency: to.Ptr("PT1H"), - // QueryPeriod: to.Ptr("P2DT1H30M"), - // Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - // TriggerOperator: to.Ptr(armsecurityinsights.TriggerOperatorGreaterThan), - // TriggerThreshold: to.Ptr[int32](0), - // Description: to.Ptr("An example for a scheduled rule"), - // DisplayName: to.Ptr("My scheduled rule"), - // Enabled: to.Ptr(true), - // IncidentConfiguration: &armsecurityinsights.IncidentConfiguration{ - // CreateIncident: to.Ptr(true), - // GroupingConfiguration: &armsecurityinsights.GroupingConfiguration{ - // Enabled: to.Ptr(true), - // GroupByAlertDetails: []*armsecurityinsights.AlertDetail{ - // to.Ptr(armsecurityinsights.AlertDetailDisplayName)}, - // GroupByCustomDetails: []*string{ - // to.Ptr("OperatingSystemType"), - // to.Ptr("OperatingSystemName")}, - // GroupByEntities: []*armsecurityinsights.EntityMappingType{ - // to.Ptr(armsecurityinsights.EntityMappingTypeHost)}, - // LookbackDuration: to.Ptr("PT5H"), - // MatchingMethod: to.Ptr(armsecurityinsights.MatchingMethodSelected), - // ReopenClosedIncident: to.Ptr(false), - // }, - // }, - // LastModifiedUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-01T13:17:30.000Z"); return t}()), - // SuppressionDuration: to.Ptr("PT1H"), - // SuppressionEnabled: to.Ptr(false), - // Tactics: []*armsecurityinsights.AttackTactic{ - // to.Ptr(armsecurityinsights.AttackTacticPersistence), - // to.Ptr(armsecurityinsights.AttackTacticLateralMovement)}, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/alertRules/DeleteAlertRule.json -func ExampleAlertRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAlertRulesClient().Delete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/alertruletemplates_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/alertruletemplates_client.go index d385c2311012..628bc923292a 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/alertruletemplates_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/alertruletemplates_client.go @@ -46,7 +46,7 @@ func NewAlertRuleTemplatesClient(subscriptionID string, credential azcore.TokenC // Get - Gets the alert rule template. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - alertRuleTemplateID - Alert rule template ID @@ -97,7 +97,7 @@ func (client *AlertRuleTemplatesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -114,7 +114,7 @@ func (client *AlertRuleTemplatesClient) getHandleResponse(resp *http.Response) ( // NewListPager - Gets all alert rule templates. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - options - AlertRuleTemplatesClientListOptions contains the optional parameters for the AlertRuleTemplatesClient.NewListPager @@ -162,7 +162,7 @@ func (client *AlertRuleTemplatesClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/alertruletemplates_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/alertruletemplates_client_example_test.go deleted file mode 100644 index 795200a1e72e..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/alertruletemplates_client_example_test.go +++ /dev/null @@ -1,191 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/alertRuleTemplates/GetAlertRuleTemplates.json -func ExampleAlertRuleTemplatesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAlertRuleTemplatesClient().NewListPager("myRg", "myWorkspace", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AlertRuleTemplatesList = armsecurityinsights.AlertRuleTemplatesList{ - // Value: []armsecurityinsights.AlertRuleTemplateClassification{ - // &armsecurityinsights.ScheduledAlertRuleTemplate{ - // Name: to.Ptr("65360bb0-8986-4ade-a89d-af3cf44d28aa"), - // Type: to.Ptr("Microsoft.SecurityInsights/AlertRuleTemplates"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/AlertRuleTemplates/65360bb0-8986-4ade-a89d-af3cf44d28aa"), - // Kind: to.Ptr(armsecurityinsights.AlertRuleKindScheduled), - // Properties: &armsecurityinsights.ScheduledAlertRuleTemplateProperties{ - // Description: to.Ptr("This alert monitors changes to Amazon VPC (Virtual Private Cloud) settings such as new ACL entries and routes in route tables.\nMore information: https://medium.com/@GorillaStack/the-most-important-aws-cloudtrail-security-events-to-track-a5b9873f8255 \nand https://aws.amazon.com/vpc/"), - // AlertRulesCreatedByTemplateCount: to.Ptr[int32](0), - // CreatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-02-27T00:00:00.000Z"); return t}()), - // DisplayName: to.Ptr("Changes to Amazon VPC settings"), - // LastUpdatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-27T10:00:00.000Z"); return t}()), - // Query: to.Ptr("let timeframe = 1d;\nAWSCloudTrail\n| where TimeGenerated >= ago(timeframe)\n| where EventName == \"CreateNetworkAclEntry\"\n or EventName == \"CreateRoute\"\n| project TimeGenerated, EventName, EventTypeName, UserIdentityAccountId, UserIdentityPrincipalid, UserAgent, UserIdentityUserName, SessionMfaAuthenticated, SourceIpAddress, AWSRegion, EventSource, AdditionalEventData, ResponseElements\n| extend AccountCustomEntity = UserIdentityUserName, IPCustomEntity = SourceIpAddress"), - // QueryFrequency: to.Ptr("P1D"), - // QueryPeriod: to.Ptr("P1D"), - // RequiredDataConnectors: []*armsecurityinsights.AlertRuleTemplateDataSource{ - // { - // ConnectorID: to.Ptr("AWS"), - // DataTypes: []*string{ - // to.Ptr("AWSCloudTrail")}, - // }}, - // Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), - // Status: to.Ptr(armsecurityinsights.TemplateStatusAvailable), - // Tactics: []*armsecurityinsights.AttackTactic{ - // to.Ptr(armsecurityinsights.AttackTacticPrivilegeEscalation), - // to.Ptr(armsecurityinsights.AttackTacticLateralMovement)}, - // TriggerOperator: to.Ptr(armsecurityinsights.TriggerOperatorGreaterThan), - // TriggerThreshold: to.Ptr[int32](0), - // Version: to.Ptr("1.0.1"), - // }, - // }, - // &armsecurityinsights.FusionAlertRuleTemplate{ - // Name: to.Ptr("f71aba3d-28fb-450b-b192-4e76a83015c8"), - // Type: to.Ptr("Microsoft.SecurityInsights/AlertRuleTemplates"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/AlertRuleTemplates/f71aba3d-28fb-450b-b192-4e76a83015c8"), - // Kind: to.Ptr(armsecurityinsights.AlertRuleKindFusion), - // Properties: &armsecurityinsights.FusionAlertRuleTemplateProperties{ - // Description: to.Ptr("Place holder: Fusion uses graph powered machine learning algorithms to correlate between millions of lower fidelity anomalous activities from different products such as Azure AD Identity Protection, and Microsoft Cloud App Security, to combine them into a manageable number of interesting security cases.\n"), - // AlertRulesCreatedByTemplateCount: to.Ptr[int32](0), - // CreatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-25T00:00:00.000Z"); return t}()), - // DisplayName: to.Ptr("Advanced Multi-Stage Attack Detection"), - // LastUpdatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-03-27T10:00:00.000Z"); return t}()), - // Severity: to.Ptr(armsecurityinsights.AlertSeverityHigh), - // Status: to.Ptr(armsecurityinsights.TemplateStatusAvailable), - // Tactics: []*armsecurityinsights.AttackTactic{ - // to.Ptr(armsecurityinsights.AttackTacticPersistence), - // to.Ptr(armsecurityinsights.AttackTacticLateralMovement), - // to.Ptr(armsecurityinsights.AttackTacticExfiltration), - // to.Ptr(armsecurityinsights.AttackTacticCommandAndControl)}, - // }, - // }, - // &armsecurityinsights.MicrosoftSecurityIncidentCreationAlertRuleTemplate{ - // Name: to.Ptr("b3cfc7c0-092c-481c-a55b-34a3979758cb"), - // Type: to.Ptr("Microsoft.SecurityInsights/AlertRuleTemplates"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/AlertRuleTemplates/b3cfc7c0-092c-481c-a55b-34a3979758cb"), - // Kind: to.Ptr(armsecurityinsights.AlertRuleKindMicrosoftSecurityIncidentCreation), - // Properties: &armsecurityinsights.MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties{ - // Description: to.Ptr("Create incidents based on all alerts generated in Microsoft Cloud App Security"), - // AlertRulesCreatedByTemplateCount: to.Ptr[int32](0), - // CreatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-07-16T00:00:00.000Z"); return t}()), - // DisplayName: to.Ptr("Create incidents based on Microsoft Cloud App Security alerts"), - // LastUpdatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-05-27T10:00:00.000Z"); return t}()), - // ProductFilter: to.Ptr(armsecurityinsights.MicrosoftSecurityProductNameMicrosoftCloudAppSecurity), - // Status: to.Ptr(armsecurityinsights.TemplateStatusAvailable), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/alertRuleTemplates/GetAlertRuleTemplateById.json -func ExampleAlertRuleTemplatesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAlertRuleTemplatesClient().Get(ctx, "myRg", "myWorkspace", "65360bb0-8986-4ade-a89d-af3cf44d28aa", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.AlertRuleTemplatesClientGetResponse{ - // AlertRuleTemplateClassification: &armsecurityinsights.ScheduledAlertRuleTemplate{ - // Name: to.Ptr("65360bb0-8986-4ade-a89d-af3cf44d28aa"), - // Type: to.Ptr("Microsoft.SecurityInsights/AlertRuleTemplates"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRuleTemplates/65360bb0-8986-4ade-a89d-af3cf44d28aa"), - // Kind: to.Ptr(armsecurityinsights.AlertRuleKindScheduled), - // Properties: &armsecurityinsights.ScheduledAlertRuleTemplateProperties{ - // Description: to.Ptr("This alert monitors changes to Amazon VPC (Virtual Private Cloud) settings such as new ACL entries and routes in route tables.\nMore information: https://medium.com/@GorillaStack/the-most-important-aws-cloudtrail-security-events-to-track-a5b9873f8255 \nand https://aws.amazon.com/vpc/"), - // AlertDetailsOverride: &armsecurityinsights.AlertDetailsOverride{ - // AlertDescriptionFormat: to.Ptr("Suspicious activity was made by {{AccountCustomEntity}}"), - // AlertDisplayNameFormat: to.Ptr("Alert on event {{EventName}}"), - // }, - // AlertRulesCreatedByTemplateCount: to.Ptr[int32](0), - // CreatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-02-27T00:00:00.000Z"); return t}()), - // CustomDetails: map[string]*string{ - // "EventNames": to.Ptr("EventName"), - // "EventTypes": to.Ptr("EventTypeName"), - // }, - // DisplayName: to.Ptr("Changes to Amazon VPC settings"), - // EntityMappings: []*armsecurityinsights.EntityMapping{ - // { - // EntityType: to.Ptr(armsecurityinsights.EntityMappingTypeAccount), - // FieldMappings: []*armsecurityinsights.FieldMapping{ - // { - // ColumnName: to.Ptr("AccountCustomEntity"), - // Identifier: to.Ptr("FullName"), - // }}, - // }, - // { - // EntityType: to.Ptr(armsecurityinsights.EntityMappingTypeIP), - // FieldMappings: []*armsecurityinsights.FieldMapping{ - // { - // ColumnName: to.Ptr("IPCustomEntity"), - // Identifier: to.Ptr("Address"), - // }}, - // }}, - // EventGroupingSettings: &armsecurityinsights.EventGroupingSettings{ - // AggregationKind: to.Ptr(armsecurityinsights.EventGroupingAggregationKindAlertPerResult), - // }, - // LastUpdatedDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-27T10:00:00.000Z"); return t}()), - // Query: to.Ptr("let timeframe = 1d;\nAWSCloudTrail\n| where TimeGenerated >= ago(timeframe)\n| where EventName == \"CreateNetworkAclEntry\"\n or EventName == \"CreateRoute\"\n| project TimeGenerated, EventName, EventTypeName, UserIdentityAccountId, UserIdentityPrincipalid, UserAgent, UserIdentityUserName, SessionMfaAuthenticated, SourceIpAddress, AWSRegion, EventSource, AdditionalEventData, ResponseElements\n| extend AccountCustomEntity = UserIdentityUserName, IPCustomEntity = SourceIpAddress"), - // QueryFrequency: to.Ptr("P1D"), - // QueryPeriod: to.Ptr("P1D"), - // RequiredDataConnectors: []*armsecurityinsights.AlertRuleTemplateDataSource{ - // { - // ConnectorID: to.Ptr("AWS"), - // DataTypes: []*string{ - // to.Ptr("AWSCloudTrail")}, - // }}, - // Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), - // Status: to.Ptr(armsecurityinsights.TemplateStatusAvailable), - // Tactics: []*armsecurityinsights.AttackTactic{ - // to.Ptr(armsecurityinsights.AttackTacticPrivilegeEscalation), - // to.Ptr(armsecurityinsights.AttackTacticLateralMovement)}, - // TriggerOperator: to.Ptr(armsecurityinsights.TriggerOperatorGreaterThan), - // TriggerThreshold: to.Ptr[int32](0), - // Version: to.Ptr("1.0.2"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/automationrules_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/automationrules_client.go index e19bb5273bbe..3a913ec8210e 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/automationrules_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/automationrules_client.go @@ -43,10 +43,10 @@ func NewAutomationRulesClient(subscriptionID string, credential azcore.TokenCred return client, nil } -// CreateOrUpdate - Creates or updates the automation rule +// CreateOrUpdate - Creates or updates the automation rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - automationRuleID - Automation rule ID @@ -98,7 +98,7 @@ func (client *AutomationRulesClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.AutomationRuleToUpsert != nil { @@ -119,10 +119,10 @@ func (client *AutomationRulesClient) createOrUpdateHandleResponse(resp *http.Res return result, nil } -// Delete - Delete the automation rule +// Delete - Delete the automation rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - automationRuleID - Automation rule ID @@ -173,7 +173,7 @@ func (client *AutomationRulesClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -188,10 +188,10 @@ func (client *AutomationRulesClient) deleteHandleResponse(resp *http.Response) ( return result, nil } -// Get - Gets the automation rule +// Get - Gets the automation rule. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - automationRuleID - Automation rule ID @@ -242,7 +242,7 @@ func (client *AutomationRulesClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -257,9 +257,9 @@ func (client *AutomationRulesClient) getHandleResponse(resp *http.Response) (Aut return result, nil } -// NewListPager - Gets all automation rules +// NewListPager - Gets all automation rules. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - options - AutomationRulesClientListOptions contains the optional parameters for the AutomationRulesClient.NewListPager @@ -307,7 +307,7 @@ func (client *AutomationRulesClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/automationrules_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/automationrules_client_example_test.go deleted file mode 100644 index 1e11d5f3bfc7..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/automationrules_client_example_test.go +++ /dev/null @@ -1,252 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/automationRules/AutomationRules_Get.json -func ExampleAutomationRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutomationRulesClient().Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutomationRule = armsecurityinsights.AutomationRule{ - // Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Type: to.Ptr("Microsoft.SecurityInsights/automationRules"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/automationRules/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Properties: &armsecurityinsights.AutomationRuleProperties{ - // Actions: []armsecurityinsights.AutomationRuleActionClassification{ - // &armsecurityinsights.AutomationRuleModifyPropertiesAction{ - // ActionType: to.Ptr(armsecurityinsights.ActionTypeModifyProperties), - // Order: to.Ptr[int32](1), - // ActionConfiguration: &armsecurityinsights.IncidentPropertiesAction{ - // Severity: to.Ptr(armsecurityinsights.IncidentSeverityHigh), - // }, - // }}, - // CreatedBy: &armsecurityinsights.ClientInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john.doe@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // UserPrincipalName: to.Ptr("john@contoso.com"), - // }, - // CreatedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:00:00.000Z"); return t}()), - // DisplayName: to.Ptr("High severity incidents escalation"), - // LastModifiedBy: &armsecurityinsights.ClientInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john.doe@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // UserPrincipalName: to.Ptr("john@contoso.com"), - // }, - // LastModifiedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:00:30.000Z"); return t}()), - // Order: to.Ptr[int32](1), - // TriggeringLogic: &armsecurityinsights.AutomationRuleTriggeringLogic{ - // Conditions: []armsecurityinsights.AutomationRuleConditionClassification{ - // &armsecurityinsights.PropertyConditionProperties{ - // ConditionType: to.Ptr(armsecurityinsights.ConditionTypeProperty), - // ConditionProperties: &armsecurityinsights.AutomationRulePropertyValuesCondition{ - // Operator: to.Ptr(armsecurityinsights.AutomationRulePropertyConditionSupportedOperatorContains), - // PropertyName: to.Ptr(armsecurityinsights.AutomationRulePropertyConditionSupportedPropertyIncidentRelatedAnalyticRuleIDs), - // PropertyValues: []*string{ - // to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/fab3d2d4-747f-46a7-8ef0-9c0be8112bf7"), - // to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/8deb8303-e94d-46ff-96e0-5fd94b33df1a")}, - // }, - // }}, - // IsEnabled: to.Ptr(true), - // TriggersOn: to.Ptr(armsecurityinsights.TriggersOnIncidents), - // TriggersWhen: to.Ptr(armsecurityinsights.TriggersWhenCreated), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/automationRules/AutomationRules_CreateOrUpdate.json -func ExampleAutomationRulesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutomationRulesClient().CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", &armsecurityinsights.AutomationRulesClientCreateOrUpdateOptions{AutomationRuleToUpsert: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AutomationRule = armsecurityinsights.AutomationRule{ - // Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Type: to.Ptr("Microsoft.SecurityInsights/automationRules"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/automationRules/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Properties: &armsecurityinsights.AutomationRuleProperties{ - // Actions: []armsecurityinsights.AutomationRuleActionClassification{ - // &armsecurityinsights.AutomationRuleModifyPropertiesAction{ - // ActionType: to.Ptr(armsecurityinsights.ActionTypeModifyProperties), - // Order: to.Ptr[int32](1), - // ActionConfiguration: &armsecurityinsights.IncidentPropertiesAction{ - // Severity: to.Ptr(armsecurityinsights.IncidentSeverityHigh), - // }, - // }}, - // CreatedBy: &armsecurityinsights.ClientInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john.doe@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // UserPrincipalName: to.Ptr("john@contoso.com"), - // }, - // CreatedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:00:00.000Z"); return t}()), - // DisplayName: to.Ptr("High severity incidents escalation"), - // LastModifiedBy: &armsecurityinsights.ClientInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john.doe@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // UserPrincipalName: to.Ptr("john@contoso.com"), - // }, - // LastModifiedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:00:30.000Z"); return t}()), - // Order: to.Ptr[int32](1), - // TriggeringLogic: &armsecurityinsights.AutomationRuleTriggeringLogic{ - // Conditions: []armsecurityinsights.AutomationRuleConditionClassification{ - // &armsecurityinsights.PropertyConditionProperties{ - // ConditionType: to.Ptr(armsecurityinsights.ConditionTypeProperty), - // ConditionProperties: &armsecurityinsights.AutomationRulePropertyValuesCondition{ - // Operator: to.Ptr(armsecurityinsights.AutomationRulePropertyConditionSupportedOperatorContains), - // PropertyName: to.Ptr(armsecurityinsights.AutomationRulePropertyConditionSupportedPropertyIncidentRelatedAnalyticRuleIDs), - // PropertyValues: []*string{ - // to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/fab3d2d4-747f-46a7-8ef0-9c0be8112bf7"), - // to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/8deb8303-e94d-46ff-96e0-5fd94b33df1a")}, - // }, - // }}, - // IsEnabled: to.Ptr(true), - // TriggersOn: to.Ptr(armsecurityinsights.TriggersOnIncidents), - // TriggersWhen: to.Ptr(armsecurityinsights.TriggersWhenCreated), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/automationRules/AutomationRules_Delete.json -func ExampleAutomationRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAutomationRulesClient().Delete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Interface = map[string]any{ - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/automationRules/AutomationRules_List.json -func ExampleAutomationRulesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAutomationRulesClient().NewListPager("myRg", "myWorkspace", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AutomationRulesList = armsecurityinsights.AutomationRulesList{ - // Value: []*armsecurityinsights.AutomationRule{ - // { - // Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Type: to.Ptr("Microsoft.SecurityInsights/automationRules"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/automationRules/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Properties: &armsecurityinsights.AutomationRuleProperties{ - // Actions: []armsecurityinsights.AutomationRuleActionClassification{ - // &armsecurityinsights.AutomationRuleModifyPropertiesAction{ - // ActionType: to.Ptr(armsecurityinsights.ActionTypeModifyProperties), - // Order: to.Ptr[int32](1), - // ActionConfiguration: &armsecurityinsights.IncidentPropertiesAction{ - // Severity: to.Ptr(armsecurityinsights.IncidentSeverityHigh), - // }, - // }}, - // CreatedBy: &armsecurityinsights.ClientInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john.doe@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // UserPrincipalName: to.Ptr("john@contoso.com"), - // }, - // CreatedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:00:00.000Z"); return t}()), - // DisplayName: to.Ptr("High severity incidents escalation"), - // LastModifiedBy: &armsecurityinsights.ClientInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john.doe@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // UserPrincipalName: to.Ptr("john@contoso.com"), - // }, - // LastModifiedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:00:30.000Z"); return t}()), - // Order: to.Ptr[int32](1), - // TriggeringLogic: &armsecurityinsights.AutomationRuleTriggeringLogic{ - // Conditions: []armsecurityinsights.AutomationRuleConditionClassification{ - // &armsecurityinsights.PropertyConditionProperties{ - // ConditionType: to.Ptr(armsecurityinsights.ConditionTypeProperty), - // ConditionProperties: &armsecurityinsights.AutomationRulePropertyValuesCondition{ - // Operator: to.Ptr(armsecurityinsights.AutomationRulePropertyConditionSupportedOperatorContains), - // PropertyName: to.Ptr(armsecurityinsights.AutomationRulePropertyConditionSupportedPropertyIncidentRelatedAnalyticRuleIDs), - // PropertyValues: []*string{ - // to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/fab3d2d4-747f-46a7-8ef0-9c0be8112bf7"), - // to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/8deb8303-e94d-46ff-96e0-5fd94b33df1a")}, - // }, - // }}, - // IsEnabled: to.Ptr(true), - // TriggersOn: to.Ptr(armsecurityinsights.TriggersOnIncidents), - // TriggersWhen: to.Ptr(armsecurityinsights.TriggersWhenCreated), - // }, - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/autorest.md b/sdk/resourcemanager/securityinsights/armsecurityinsights/autorest.md index 9129287bad6a..6de57a31b1db 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/autorest.md +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/autorest.md @@ -5,11 +5,10 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/securityinsights/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/securityinsights/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 1.2.0 +module-version: 2.0.0 modelerfour: lenient-model-deduplication: true -tag: package-2021-10 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarks_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarks_client.go index 77a9090b03ed..87973ba667a1 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarks_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarks_client.go @@ -46,7 +46,7 @@ func NewBookmarksClient(subscriptionID string, credential azcore.TokenCredential // CreateOrUpdate - Creates or updates the bookmark. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - bookmarkID - Bookmark ID @@ -99,7 +99,7 @@ func (client *BookmarksClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, bookmark); err != nil { @@ -120,7 +120,7 @@ func (client *BookmarksClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Delete the bookmark. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - bookmarkID - Bookmark ID @@ -170,7 +170,7 @@ func (client *BookmarksClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -179,7 +179,7 @@ func (client *BookmarksClient) deleteCreateRequest(ctx context.Context, resource // Get - Gets a bookmark. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - bookmarkID - Bookmark ID @@ -230,7 +230,7 @@ func (client *BookmarksClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -247,7 +247,7 @@ func (client *BookmarksClient) getHandleResponse(resp *http.Response) (Bookmarks // NewListPager - Gets all bookmarks. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - options - BookmarksClientListOptions contains the optional parameters for the BookmarksClient.NewListPager method. @@ -294,7 +294,7 @@ func (client *BookmarksClient) listCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarks_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarks_client_example_test.go deleted file mode 100644 index 72c8990ecdb7..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/bookmarks_client_example_test.go +++ /dev/null @@ -1,218 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/bookmarks/GetBookmarks.json -func ExampleBookmarksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewBookmarksClient().NewListPager("myRg", "myWorkspace", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.BookmarkList = armsecurityinsights.BookmarkList{ - // Value: []*armsecurityinsights.Bookmark{ - // { - // Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Type: to.Ptr("Microsoft.SecurityInsights/bookmarks"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/bookmarks/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Properties: &armsecurityinsights.BookmarkProperties{ - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // CreatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // DisplayName: to.Ptr("My bookmark"), - // IncidentInfo: &armsecurityinsights.IncidentInfo{ - // IncidentID: to.Ptr("DDA55F97-170B-40B9-B8ED-CBFD05481E7D"), - // RelationName: to.Ptr("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0018"), - // Severity: to.Ptr(armsecurityinsights.IncidentSeverityLow), - // Title: to.Ptr("New case 1"), - // }, - // Labels: []*string{ - // to.Ptr("Tag1"), - // to.Ptr("Tag2")}, - // Notes: to.Ptr("Found a suspicious activity"), - // Query: to.Ptr("SecurityEvent | where TimeGenerated > ago(1d) and TimeGenerated < ago(2d)"), - // QueryResult: to.Ptr("Security Event query result"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // UpdatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/bookmarks/GetBookmarkById.json -func ExampleBookmarksClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBookmarksClient().Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Bookmark = armsecurityinsights.Bookmark{ - // Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Type: to.Ptr("Microsoft.SecurityInsights/bookmarks"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/bookmarks/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Properties: &armsecurityinsights.BookmarkProperties{ - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // CreatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // DisplayName: to.Ptr("My bookmark"), - // IncidentInfo: &armsecurityinsights.IncidentInfo{ - // IncidentID: to.Ptr("DDA55F97-170B-40B9-B8ED-CBFD05481E7D"), - // RelationName: to.Ptr("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0018"), - // Severity: to.Ptr(armsecurityinsights.IncidentSeverityLow), - // Title: to.Ptr("New case 1"), - // }, - // Labels: []*string{ - // to.Ptr("Tag1"), - // to.Ptr("Tag2")}, - // Notes: to.Ptr("Found a suspicious activity"), - // Query: to.Ptr("SecurityEvent | where TimeGenerated > ago(1d) and TimeGenerated < ago(2d)"), - // QueryResult: to.Ptr("Security Event query result"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // UpdatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/bookmarks/CreateBookmark.json -func ExampleBookmarksClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewBookmarksClient().CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", armsecurityinsights.Bookmark{ - Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - Properties: &armsecurityinsights.BookmarkProperties{ - Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t }()), - CreatedBy: &armsecurityinsights.UserInfo{ - ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - }, - DisplayName: to.Ptr("My bookmark"), - Labels: []*string{ - to.Ptr("Tag1"), - to.Ptr("Tag2")}, - Notes: to.Ptr("Found a suspicious activity"), - Query: to.Ptr("SecurityEvent | where TimeGenerated > ago(1d) and TimeGenerated < ago(2d)"), - QueryResult: to.Ptr("Security Event query result"), - Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t }()), - UpdatedBy: &armsecurityinsights.UserInfo{ - ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Bookmark = armsecurityinsights.Bookmark{ - // Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Type: to.Ptr("Microsoft.SecurityInsights/bookmarks"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/bookmarks/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Properties: &armsecurityinsights.BookmarkProperties{ - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // CreatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // DisplayName: to.Ptr("My bookmark"), - // Labels: []*string{ - // to.Ptr("Tag1"), - // to.Ptr("Tag2")}, - // Notes: to.Ptr("Found a suspicious activity"), - // Query: to.Ptr("SecurityEvent | where TimeGenerated > ago(1d) and TimeGenerated < ago(2d)"), - // QueryResult: to.Ptr("Security Event query result"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // UpdatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/bookmarks/DeleteBookmark.json -func ExampleBookmarksClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewBookmarksClient().Delete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/client_factory.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/client_factory.go index a3998dd1152a..44aeb50e5492 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/client_factory.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/client_factory.go @@ -67,6 +67,30 @@ func (c *ClientFactory) NewBookmarksClient() *BookmarksClient { return subClient } +// NewContentPackageClient creates a new instance of ContentPackageClient. +func (c *ClientFactory) NewContentPackageClient() *ContentPackageClient { + subClient, _ := NewContentPackageClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewContentPackagesClient creates a new instance of ContentPackagesClient. +func (c *ClientFactory) NewContentPackagesClient() *ContentPackagesClient { + subClient, _ := NewContentPackagesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewContentTemplateClient creates a new instance of ContentTemplateClient. +func (c *ClientFactory) NewContentTemplateClient() *ContentTemplateClient { + subClient, _ := NewContentTemplateClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewContentTemplatesClient creates a new instance of ContentTemplatesClient. +func (c *ClientFactory) NewContentTemplatesClient() *ContentTemplatesClient { + subClient, _ := NewContentTemplatesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + // NewDataConnectorsClient creates a new instance of DataConnectorsClient. func (c *ClientFactory) NewDataConnectorsClient() *DataConnectorsClient { subClient, _ := NewDataConnectorsClient(c.subscriptionID, c.credential, c.options) @@ -91,18 +115,66 @@ func (c *ClientFactory) NewIncidentsClient() *IncidentsClient { return subClient } +// NewMetadataClient creates a new instance of MetadataClient. +func (c *ClientFactory) NewMetadataClient() *MetadataClient { + subClient, _ := NewMetadataClient(c.subscriptionID, c.credential, c.options) + return subClient +} + // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { subClient, _ := NewOperationsClient(c.credential, c.options) return subClient } +// NewProductPackageClient creates a new instance of ProductPackageClient. +func (c *ClientFactory) NewProductPackageClient() *ProductPackageClient { + subClient, _ := NewProductPackageClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewProductPackagesClient creates a new instance of ProductPackagesClient. +func (c *ClientFactory) NewProductPackagesClient() *ProductPackagesClient { + subClient, _ := NewProductPackagesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewProductTemplateClient creates a new instance of ProductTemplateClient. +func (c *ClientFactory) NewProductTemplateClient() *ProductTemplateClient { + subClient, _ := NewProductTemplateClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewProductTemplatesClient creates a new instance of ProductTemplatesClient. +func (c *ClientFactory) NewProductTemplatesClient() *ProductTemplatesClient { + subClient, _ := NewProductTemplatesClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSecurityMLAnalyticsSettingsClient creates a new instance of SecurityMLAnalyticsSettingsClient. +func (c *ClientFactory) NewSecurityMLAnalyticsSettingsClient() *SecurityMLAnalyticsSettingsClient { + subClient, _ := NewSecurityMLAnalyticsSettingsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + // NewSentinelOnboardingStatesClient creates a new instance of SentinelOnboardingStatesClient. func (c *ClientFactory) NewSentinelOnboardingStatesClient() *SentinelOnboardingStatesClient { subClient, _ := NewSentinelOnboardingStatesClient(c.subscriptionID, c.credential, c.options) return subClient } +// NewSourceControlClient creates a new instance of SourceControlClient. +func (c *ClientFactory) NewSourceControlClient() *SourceControlClient { + subClient, _ := NewSourceControlClient(c.subscriptionID, c.credential, c.options) + return subClient +} + +// NewSourceControlsClient creates a new instance of SourceControlsClient. +func (c *ClientFactory) NewSourceControlsClient() *SourceControlsClient { + subClient, _ := NewSourceControlsClient(c.subscriptionID, c.credential, c.options) + return subClient +} + // NewThreatIntelligenceIndicatorClient creates a new instance of ThreatIntelligenceIndicatorClient. func (c *ClientFactory) NewThreatIntelligenceIndicatorClient() *ThreatIntelligenceIndicatorClient { subClient, _ := NewThreatIntelligenceIndicatorClient(c.subscriptionID, c.credential, c.options) diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/constants.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/constants.go index 69001ac6ca96..f2e60586959b 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/constants.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/constants.go @@ -10,10 +10,10 @@ package armsecurityinsights const ( moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" - moduleVersion = "v1.2.0" + moduleVersion = "v2.0.0" ) -// ActionType - The type of the automation rule action +// ActionType - The type of the automation rule action. type ActionType string const ( @@ -49,6 +49,45 @@ func PossibleAlertDetailValues() []AlertDetail { } } +// AlertProperty - The V3 alert property +type AlertProperty string + +const ( + // AlertPropertyAlertLink - Alert's link + AlertPropertyAlertLink AlertProperty = "AlertLink" + // AlertPropertyConfidenceLevel - Confidence level property + AlertPropertyConfidenceLevel AlertProperty = "ConfidenceLevel" + // AlertPropertyConfidenceScore - Confidence score + AlertPropertyConfidenceScore AlertProperty = "ConfidenceScore" + // AlertPropertyExtendedLinks - Extended links to the alert + AlertPropertyExtendedLinks AlertProperty = "ExtendedLinks" + // AlertPropertyProductComponentName - Product component name alert property + AlertPropertyProductComponentName AlertProperty = "ProductComponentName" + // AlertPropertyProductName - Product name alert property + AlertPropertyProductName AlertProperty = "ProductName" + // AlertPropertyProviderName - Provider name alert property + AlertPropertyProviderName AlertProperty = "ProviderName" + // AlertPropertyRemediationSteps - Remediation steps alert property + AlertPropertyRemediationSteps AlertProperty = "RemediationSteps" + // AlertPropertyTechniques - Techniques alert property + AlertPropertyTechniques AlertProperty = "Techniques" +) + +// PossibleAlertPropertyValues returns the possible values for the AlertProperty const type. +func PossibleAlertPropertyValues() []AlertProperty { + return []AlertProperty{ + AlertPropertyAlertLink, + AlertPropertyConfidenceLevel, + AlertPropertyConfidenceScore, + AlertPropertyExtendedLinks, + AlertPropertyProductComponentName, + AlertPropertyProductName, + AlertPropertyProviderName, + AlertPropertyRemediationSteps, + AlertPropertyTechniques, + } +} + // AlertRuleKind - The kind of the alert rule type AlertRuleKind string @@ -146,19 +185,23 @@ func PossibleAntispamMailDirectionValues() []AntispamMailDirection { type AttackTactic string const ( - AttackTacticCollection AttackTactic = "Collection" - AttackTacticCommandAndControl AttackTactic = "CommandAndControl" - AttackTacticCredentialAccess AttackTactic = "CredentialAccess" - AttackTacticDefenseEvasion AttackTactic = "DefenseEvasion" - AttackTacticDiscovery AttackTactic = "Discovery" - AttackTacticExecution AttackTactic = "Execution" - AttackTacticExfiltration AttackTactic = "Exfiltration" - AttackTacticImpact AttackTactic = "Impact" - AttackTacticInitialAccess AttackTactic = "InitialAccess" - AttackTacticLateralMovement AttackTactic = "LateralMovement" - AttackTacticPersistence AttackTactic = "Persistence" - AttackTacticPreAttack AttackTactic = "PreAttack" - AttackTacticPrivilegeEscalation AttackTactic = "PrivilegeEscalation" + AttackTacticCollection AttackTactic = "Collection" + AttackTacticCommandAndControl AttackTactic = "CommandAndControl" + AttackTacticCredentialAccess AttackTactic = "CredentialAccess" + AttackTacticDefenseEvasion AttackTactic = "DefenseEvasion" + AttackTacticDiscovery AttackTactic = "Discovery" + AttackTacticExecution AttackTactic = "Execution" + AttackTacticExfiltration AttackTactic = "Exfiltration" + AttackTacticImpact AttackTactic = "Impact" + AttackTacticImpairProcessControl AttackTactic = "ImpairProcessControl" + AttackTacticInhibitResponseFunction AttackTactic = "InhibitResponseFunction" + AttackTacticInitialAccess AttackTactic = "InitialAccess" + AttackTacticLateralMovement AttackTactic = "LateralMovement" + AttackTacticPersistence AttackTactic = "Persistence" + AttackTacticPreAttack AttackTactic = "PreAttack" + AttackTacticPrivilegeEscalation AttackTactic = "PrivilegeEscalation" + AttackTacticReconnaissance AttackTactic = "Reconnaissance" + AttackTacticResourceDevelopment AttackTactic = "ResourceDevelopment" ) // PossibleAttackTacticValues returns the possible values for the AttackTactic const type. @@ -172,11 +215,91 @@ func PossibleAttackTacticValues() []AttackTactic { AttackTacticExecution, AttackTacticExfiltration, AttackTacticImpact, + AttackTacticImpairProcessControl, + AttackTacticInhibitResponseFunction, AttackTacticInitialAccess, AttackTacticLateralMovement, AttackTacticPersistence, AttackTacticPreAttack, AttackTacticPrivilegeEscalation, + AttackTacticReconnaissance, + AttackTacticResourceDevelopment, + } +} + +type AutomationRulePropertyArrayChangedConditionSupportedArrayType string + +const ( + // AutomationRulePropertyArrayChangedConditionSupportedArrayTypeAlerts - Evaluate the condition on the alerts + AutomationRulePropertyArrayChangedConditionSupportedArrayTypeAlerts AutomationRulePropertyArrayChangedConditionSupportedArrayType = "Alerts" + // AutomationRulePropertyArrayChangedConditionSupportedArrayTypeComments - Evaluate the condition on the comments + AutomationRulePropertyArrayChangedConditionSupportedArrayTypeComments AutomationRulePropertyArrayChangedConditionSupportedArrayType = "Comments" + // AutomationRulePropertyArrayChangedConditionSupportedArrayTypeLabels - Evaluate the condition on the labels + AutomationRulePropertyArrayChangedConditionSupportedArrayTypeLabels AutomationRulePropertyArrayChangedConditionSupportedArrayType = "Labels" + // AutomationRulePropertyArrayChangedConditionSupportedArrayTypeTactics - Evaluate the condition on the tactics + AutomationRulePropertyArrayChangedConditionSupportedArrayTypeTactics AutomationRulePropertyArrayChangedConditionSupportedArrayType = "Tactics" +) + +// PossibleAutomationRulePropertyArrayChangedConditionSupportedArrayTypeValues returns the possible values for the AutomationRulePropertyArrayChangedConditionSupportedArrayType const type. +func PossibleAutomationRulePropertyArrayChangedConditionSupportedArrayTypeValues() []AutomationRulePropertyArrayChangedConditionSupportedArrayType { + return []AutomationRulePropertyArrayChangedConditionSupportedArrayType{ + AutomationRulePropertyArrayChangedConditionSupportedArrayTypeAlerts, + AutomationRulePropertyArrayChangedConditionSupportedArrayTypeComments, + AutomationRulePropertyArrayChangedConditionSupportedArrayTypeLabels, + AutomationRulePropertyArrayChangedConditionSupportedArrayTypeTactics, + } +} + +type AutomationRulePropertyArrayChangedConditionSupportedChangeType string + +const ( + // AutomationRulePropertyArrayChangedConditionSupportedChangeTypeAdded - Evaluate the condition on items added to the array + AutomationRulePropertyArrayChangedConditionSupportedChangeTypeAdded AutomationRulePropertyArrayChangedConditionSupportedChangeType = "Added" +) + +// PossibleAutomationRulePropertyArrayChangedConditionSupportedChangeTypeValues returns the possible values for the AutomationRulePropertyArrayChangedConditionSupportedChangeType const type. +func PossibleAutomationRulePropertyArrayChangedConditionSupportedChangeTypeValues() []AutomationRulePropertyArrayChangedConditionSupportedChangeType { + return []AutomationRulePropertyArrayChangedConditionSupportedChangeType{ + AutomationRulePropertyArrayChangedConditionSupportedChangeTypeAdded, + } +} + +type AutomationRulePropertyChangedConditionSupportedChangedType string + +const ( + // AutomationRulePropertyChangedConditionSupportedChangedTypeChangedFrom - Evaluate the condition on the previous value of + // the property + AutomationRulePropertyChangedConditionSupportedChangedTypeChangedFrom AutomationRulePropertyChangedConditionSupportedChangedType = "ChangedFrom" + // AutomationRulePropertyChangedConditionSupportedChangedTypeChangedTo - Evaluate the condition on the updated value of the + // property + AutomationRulePropertyChangedConditionSupportedChangedTypeChangedTo AutomationRulePropertyChangedConditionSupportedChangedType = "ChangedTo" +) + +// PossibleAutomationRulePropertyChangedConditionSupportedChangedTypeValues returns the possible values for the AutomationRulePropertyChangedConditionSupportedChangedType const type. +func PossibleAutomationRulePropertyChangedConditionSupportedChangedTypeValues() []AutomationRulePropertyChangedConditionSupportedChangedType { + return []AutomationRulePropertyChangedConditionSupportedChangedType{ + AutomationRulePropertyChangedConditionSupportedChangedTypeChangedFrom, + AutomationRulePropertyChangedConditionSupportedChangedTypeChangedTo, + } +} + +type AutomationRulePropertyChangedConditionSupportedPropertyType string + +const ( + // AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentOwner - Evaluate the condition on the incident owner + AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentOwner AutomationRulePropertyChangedConditionSupportedPropertyType = "IncidentOwner" + // AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentSeverity - Evaluate the condition on the incident severity + AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentSeverity AutomationRulePropertyChangedConditionSupportedPropertyType = "IncidentSeverity" + // AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentStatus - Evaluate the condition on the incident status + AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentStatus AutomationRulePropertyChangedConditionSupportedPropertyType = "IncidentStatus" +) + +// PossibleAutomationRulePropertyChangedConditionSupportedPropertyTypeValues returns the possible values for the AutomationRulePropertyChangedConditionSupportedPropertyType const type. +func PossibleAutomationRulePropertyChangedConditionSupportedPropertyTypeValues() []AutomationRulePropertyChangedConditionSupportedPropertyType { + return []AutomationRulePropertyChangedConditionSupportedPropertyType{ + AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentOwner, + AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentSeverity, + AutomationRulePropertyChangedConditionSupportedPropertyTypeIncidentStatus, } } @@ -222,7 +345,7 @@ func PossibleAutomationRulePropertyConditionSupportedOperatorValues() []Automati } } -// AutomationRulePropertyConditionSupportedProperty - The property to evaluate in an automation rule property condition +// AutomationRulePropertyConditionSupportedProperty - The property to evaluate in an automation rule property condition. type AutomationRulePropertyConditionSupportedProperty string const ( @@ -242,6 +365,8 @@ const ( AutomationRulePropertyConditionSupportedPropertyAccountSid AutomationRulePropertyConditionSupportedProperty = "AccountSid" // AutomationRulePropertyConditionSupportedPropertyAccountUPNSuffix - The account user principal name suffix AutomationRulePropertyConditionSupportedPropertyAccountUPNSuffix AutomationRulePropertyConditionSupportedProperty = "AccountUPNSuffix" + // AutomationRulePropertyConditionSupportedPropertyAlertAnalyticRuleIDs - The analytic rule ids of the alert + AutomationRulePropertyConditionSupportedPropertyAlertAnalyticRuleIDs AutomationRulePropertyConditionSupportedProperty = "AlertAnalyticRuleIds" // AutomationRulePropertyConditionSupportedPropertyAlertProductNames - The name of the product of the alert AutomationRulePropertyConditionSupportedPropertyAlertProductNames AutomationRulePropertyConditionSupportedProperty = "AlertProductNames" // AutomationRulePropertyConditionSupportedPropertyAzureResourceResourceID - The Azure resource id @@ -288,6 +413,8 @@ const ( AutomationRulePropertyConditionSupportedPropertyIncidentTactics AutomationRulePropertyConditionSupportedProperty = "IncidentTactics" // AutomationRulePropertyConditionSupportedPropertyIncidentTitle - The title of the incident AutomationRulePropertyConditionSupportedPropertyIncidentTitle AutomationRulePropertyConditionSupportedProperty = "IncidentTitle" + // AutomationRulePropertyConditionSupportedPropertyIncidentUpdatedBySource - The update source of the incident + AutomationRulePropertyConditionSupportedPropertyIncidentUpdatedBySource AutomationRulePropertyConditionSupportedProperty = "IncidentUpdatedBySource" // AutomationRulePropertyConditionSupportedPropertyIoTDeviceID - "The IoT device id AutomationRulePropertyConditionSupportedPropertyIoTDeviceID AutomationRulePropertyConditionSupportedProperty = "IoTDeviceId" // AutomationRulePropertyConditionSupportedPropertyIoTDeviceModel - The IoT device model @@ -347,6 +474,7 @@ func PossibleAutomationRulePropertyConditionSupportedPropertyValues() []Automati AutomationRulePropertyConditionSupportedPropertyAccountPUID, AutomationRulePropertyConditionSupportedPropertyAccountSid, AutomationRulePropertyConditionSupportedPropertyAccountUPNSuffix, + AutomationRulePropertyConditionSupportedPropertyAlertAnalyticRuleIDs, AutomationRulePropertyConditionSupportedPropertyAlertProductNames, AutomationRulePropertyConditionSupportedPropertyAzureResourceResourceID, AutomationRulePropertyConditionSupportedPropertyAzureResourceSubscriptionID, @@ -370,6 +498,7 @@ func PossibleAutomationRulePropertyConditionSupportedPropertyValues() []Automati AutomationRulePropertyConditionSupportedPropertyIncidentStatus, AutomationRulePropertyConditionSupportedPropertyIncidentTactics, AutomationRulePropertyConditionSupportedPropertyIncidentTitle, + AutomationRulePropertyConditionSupportedPropertyIncidentUpdatedBySource, AutomationRulePropertyConditionSupportedPropertyIoTDeviceID, AutomationRulePropertyConditionSupportedPropertyIoTDeviceModel, AutomationRulePropertyConditionSupportedPropertyIoTDeviceName, @@ -401,12 +530,18 @@ type ConditionType string const ( // ConditionTypeProperty - Evaluate an object property value ConditionTypeProperty ConditionType = "Property" + // ConditionTypePropertyArrayChanged - Evaluate an object array property changed value + ConditionTypePropertyArrayChanged ConditionType = "PropertyArrayChanged" + // ConditionTypePropertyChanged - Evaluate an object property changed value + ConditionTypePropertyChanged ConditionType = "PropertyChanged" ) // PossibleConditionTypeValues returns the possible values for the ConditionType const type. func PossibleConditionTypeValues() []ConditionType { return []ConditionType{ ConditionTypeProperty, + ConditionTypePropertyArrayChanged, + ConditionTypePropertyChanged, } } @@ -457,6 +592,30 @@ func PossibleConfidenceScoreStatusValues() []ConfidenceScoreStatus { } } +// ContentType - The content type of a source control path. +type ContentType string + +const ( + ContentTypeAnalyticRule ContentType = "AnalyticRule" + ContentTypeAutomationRule ContentType = "AutomationRule" + ContentTypeHuntingQuery ContentType = "HuntingQuery" + ContentTypeParser ContentType = "Parser" + ContentTypePlaybook ContentType = "Playbook" + ContentTypeWorkbook ContentType = "Workbook" +) + +// PossibleContentTypeValues returns the possible values for the ContentType const type. +func PossibleContentTypeValues() []ContentType { + return []ContentType{ + ContentTypeAnalyticRule, + ContentTypeAutomationRule, + ContentTypeHuntingQuery, + ContentTypeParser, + ContentTypePlaybook, + ContentTypeWorkbook, + } +} + // CreatedByType - The type of identity that created the resource. type CreatedByType string @@ -587,6 +746,62 @@ func PossibleDeliveryLocationValues() []DeliveryLocation { } } +// DeploymentFetchStatus - Status while trying to fetch the deployment information. +type DeploymentFetchStatus string + +const ( + DeploymentFetchStatusNotFound DeploymentFetchStatus = "NotFound" + DeploymentFetchStatusSuccess DeploymentFetchStatus = "Success" + DeploymentFetchStatusUnauthorized DeploymentFetchStatus = "Unauthorized" +) + +// PossibleDeploymentFetchStatusValues returns the possible values for the DeploymentFetchStatus const type. +func PossibleDeploymentFetchStatusValues() []DeploymentFetchStatus { + return []DeploymentFetchStatus{ + DeploymentFetchStatusNotFound, + DeploymentFetchStatusSuccess, + DeploymentFetchStatusUnauthorized, + } +} + +// DeploymentResult - Status while trying to fetch the deployment information. +type DeploymentResult string + +const ( + DeploymentResultCanceled DeploymentResult = "Canceled" + DeploymentResultFailed DeploymentResult = "Failed" + DeploymentResultSuccess DeploymentResult = "Success" +) + +// PossibleDeploymentResultValues returns the possible values for the DeploymentResult const type. +func PossibleDeploymentResultValues() []DeploymentResult { + return []DeploymentResult{ + DeploymentResultCanceled, + DeploymentResultFailed, + DeploymentResultSuccess, + } +} + +// DeploymentState - The current state of the deployment. +type DeploymentState string + +const ( + DeploymentStateCanceling DeploymentState = "Canceling" + DeploymentStateCompleted DeploymentState = "Completed" + DeploymentStateInProgress DeploymentState = "In_Progress" + DeploymentStateQueued DeploymentState = "Queued" +) + +// PossibleDeploymentStateValues returns the possible values for the DeploymentState const type. +func PossibleDeploymentStateValues() []DeploymentState { + return []DeploymentState{ + DeploymentStateCanceling, + DeploymentStateCompleted, + DeploymentStateInProgress, + DeploymentStateQueued, + } +} + // ElevationToken - The elevation token associated with the process. type ElevationToken string @@ -792,6 +1007,22 @@ func PossibleFileHashAlgorithmValues() []FileHashAlgorithm { } } +// Flag - The boolean value the metadata is for. +type Flag string + +const ( + FlagFalse Flag = "false" + FlagTrue Flag = "true" +) + +// PossibleFlagValues returns the possible values for the Flag const type. +func PossibleFlagValues() []Flag { + return []Flag{ + FlagFalse, + FlagTrue, + } +} + // IncidentClassification - The reason the incident was closed type IncidentClassification string @@ -991,6 +1222,52 @@ func PossibleKillChainIntentValues() []KillChainIntent { } } +// Kind - The kind of content the metadata is for. +type Kind string + +const ( + KindAnalyticsRule Kind = "AnalyticsRule" + KindAnalyticsRuleTemplate Kind = "AnalyticsRuleTemplate" + KindAutomationRule Kind = "AutomationRule" + KindAzureFunction Kind = "AzureFunction" + KindDataConnector Kind = "DataConnector" + KindDataType Kind = "DataType" + KindHuntingQuery Kind = "HuntingQuery" + KindInvestigationQuery Kind = "InvestigationQuery" + KindLogicAppsCustomConnector Kind = "LogicAppsCustomConnector" + KindParser Kind = "Parser" + KindPlaybook Kind = "Playbook" + KindPlaybookTemplate Kind = "PlaybookTemplate" + KindSolution Kind = "Solution" + KindWatchlist Kind = "Watchlist" + KindWatchlistTemplate Kind = "WatchlistTemplate" + KindWorkbook Kind = "Workbook" + KindWorkbookTemplate Kind = "WorkbookTemplate" +) + +// PossibleKindValues returns the possible values for the Kind const type. +func PossibleKindValues() []Kind { + return []Kind{ + KindAnalyticsRule, + KindAnalyticsRuleTemplate, + KindAutomationRule, + KindAzureFunction, + KindDataConnector, + KindDataType, + KindHuntingQuery, + KindInvestigationQuery, + KindLogicAppsCustomConnector, + KindParser, + KindPlaybook, + KindPlaybookTemplate, + KindSolution, + KindWatchlist, + KindWatchlistTemplate, + KindWorkbook, + KindWorkbookTemplate, + } +} + // MatchingMethod - Grouping matching method. When method is Selected at least one of groupByEntities, groupByAlertDetails, // groupByCustomDetails must be provided and not empty. type MatchingMethod string @@ -1063,6 +1340,22 @@ func PossibleOSFamilyValues() []OSFamily { } } +// Operator - Operator used for list of dependencies in criteria array. +type Operator string + +const ( + OperatorAND Operator = "AND" + OperatorOR Operator = "OR" +) + +// PossibleOperatorValues returns the possible values for the Operator const type. +func PossibleOperatorValues() []Operator { + return []Operator{ + OperatorAND, + OperatorOR, + } +} + // OwnerType - The type of the owner the incident is assigned to. type OwnerType string @@ -1084,6 +1377,22 @@ func PossibleOwnerTypeValues() []OwnerType { } } +// PackageKind - The package kind +type PackageKind string + +const ( + PackageKindSolution PackageKind = "Solution" + PackageKindStandalone PackageKind = "Standalone" +) + +// PossiblePackageKindValues returns the possible values for the PackageKind const type. +func PossiblePackageKindValues() []PackageKind { + return []PackageKind{ + PackageKindSolution, + PackageKindStandalone, + } +} + // RegistryHive - the hive that holds the registry key. type RegistryHive string @@ -1163,19 +1472,123 @@ func PossibleRegistryValueKindValues() []RegistryValueKind { } } -// Source - The source of the watchlist -type Source string +// RepoType - The type of repository. +type RepoType string const ( - SourceLocalFile Source = "Local file" - SourceRemoteStorage Source = "Remote storage" + RepoTypeAzureDevOps RepoType = "AzureDevOps" + RepoTypeGithub RepoType = "Github" ) -// PossibleSourceValues returns the possible values for the Source const type. -func PossibleSourceValues() []Source { - return []Source{ - SourceLocalFile, - SourceRemoteStorage, +// PossibleRepoTypeValues returns the possible values for the RepoType const type. +func PossibleRepoTypeValues() []RepoType { + return []RepoType{ + RepoTypeAzureDevOps, + RepoTypeGithub, + } +} + +// RepositoryAccessKind - The kind of repository access credentials +type RepositoryAccessKind string + +const ( + RepositoryAccessKindApp RepositoryAccessKind = "App" + RepositoryAccessKindOAuth RepositoryAccessKind = "OAuth" + RepositoryAccessKindPAT RepositoryAccessKind = "PAT" +) + +// PossibleRepositoryAccessKindValues returns the possible values for the RepositoryAccessKind const type. +func PossibleRepositoryAccessKindValues() []RepositoryAccessKind { + return []RepositoryAccessKind{ + RepositoryAccessKindApp, + RepositoryAccessKindOAuth, + RepositoryAccessKindPAT, + } +} + +// SecurityMLAnalyticsSettingsKind - The kind of security ML analytics settings +type SecurityMLAnalyticsSettingsKind string + +const ( + SecurityMLAnalyticsSettingsKindAnomaly SecurityMLAnalyticsSettingsKind = "Anomaly" +) + +// PossibleSecurityMLAnalyticsSettingsKindValues returns the possible values for the SecurityMLAnalyticsSettingsKind const type. +func PossibleSecurityMLAnalyticsSettingsKindValues() []SecurityMLAnalyticsSettingsKind { + return []SecurityMLAnalyticsSettingsKind{ + SecurityMLAnalyticsSettingsKindAnomaly, + } +} + +// SettingsStatus - The anomaly SecurityMLAnalyticsSettings status +type SettingsStatus string + +const ( + // SettingsStatusFlighting - Anomaly settings status in Flighting mode + SettingsStatusFlighting SettingsStatus = "Flighting" + // SettingsStatusProduction - Anomaly settings status in Production mode + SettingsStatusProduction SettingsStatus = "Production" +) + +// PossibleSettingsStatusValues returns the possible values for the SettingsStatus const type. +func PossibleSettingsStatusValues() []SettingsStatus { + return []SettingsStatus{ + SettingsStatusFlighting, + SettingsStatusProduction, + } +} + +// SourceKind - Source type of the content +type SourceKind string + +const ( + SourceKindCommunity SourceKind = "Community" + SourceKindLocalWorkspace SourceKind = "LocalWorkspace" + SourceKindSolution SourceKind = "Solution" + SourceKindSourceRepository SourceKind = "SourceRepository" +) + +// PossibleSourceKindValues returns the possible values for the SourceKind const type. +func PossibleSourceKindValues() []SourceKind { + return []SourceKind{ + SourceKindCommunity, + SourceKindLocalWorkspace, + SourceKindSolution, + SourceKindSourceRepository, + } +} + +// State - Status of the pull request. +type State string + +const ( + StateClosed State = "Closed" + StateOpen State = "Open" +) + +// PossibleStateValues returns the possible values for the State const type. +func PossibleStateValues() []State { + return []State{ + StateClosed, + StateOpen, + } +} + +// SupportTier - Type of support for content item +type SupportTier string + +const ( + SupportTierCommunity SupportTier = "Community" + SupportTierMicrosoft SupportTier = "Microsoft" + SupportTierPartner SupportTier = "Partner" +) + +// PossibleSupportTierValues returns the possible values for the SupportTier const type. +func PossibleSupportTierValues() []SupportTier { + return []SupportTier{ + SupportTierCommunity, + SupportTierMicrosoft, + SupportTierPartner, } } @@ -1256,6 +1669,8 @@ func PossibleTriggerOperatorValues() []TriggerOperator { type TriggersOn string const ( + // TriggersOnAlerts - Trigger on Alerts + TriggersOnAlerts TriggersOn = "Alerts" // TriggersOnIncidents - Trigger on Incidents TriggersOnIncidents TriggersOn = "Incidents" ) @@ -1263,6 +1678,7 @@ const ( // PossibleTriggersOnValues returns the possible values for the TriggersOn const type. func PossibleTriggersOnValues() []TriggersOn { return []TriggersOn{ + TriggersOnAlerts, TriggersOnIncidents, } } @@ -1272,11 +1688,52 @@ type TriggersWhen string const ( // TriggersWhenCreated - Trigger on created objects TriggersWhenCreated TriggersWhen = "Created" + // TriggersWhenUpdated - Trigger on updated objects + TriggersWhenUpdated TriggersWhen = "Updated" ) // PossibleTriggersWhenValues returns the possible values for the TriggersWhen const type. func PossibleTriggersWhenValues() []TriggersWhen { return []TriggersWhen{ TriggersWhenCreated, + TriggersWhenUpdated, + } +} + +// Version - The version of the source control. +type Version string + +const ( + VersionV1 Version = "V1" + VersionV2 Version = "V2" +) + +// PossibleVersionValues returns the possible values for the Version const type. +func PossibleVersionValues() []Version { + return []Version{ + VersionV1, + VersionV2, + } +} + +// WarningCode - The type of repository. +type WarningCode string + +const ( + WarningCodeSourceControlDeletedWithWarnings WarningCode = "SourceControl_DeletedWithWarnings" + WarningCodeSourceControlWarningDeletePipelineFromAzureDevOps WarningCode = "SourceControlWarning_DeletePipelineFromAzureDevOps" + WarningCodeSourceControlWarningDeleteRoleAssignment WarningCode = "SourceControlWarning_DeleteRoleAssignment" + WarningCodeSourceControlWarningDeleteServicePrincipal WarningCode = "SourceControlWarning_DeleteServicePrincipal" + WarningCodeSourceControlWarningDeleteWorkflowAndSecretFromGitHub WarningCode = "SourceControlWarning_DeleteWorkflowAndSecretFromGitHub" +) + +// PossibleWarningCodeValues returns the possible values for the WarningCode const type. +func PossibleWarningCodeValues() []WarningCode { + return []WarningCode{ + WarningCodeSourceControlDeletedWithWarnings, + WarningCodeSourceControlWarningDeletePipelineFromAzureDevOps, + WarningCodeSourceControlWarningDeleteRoleAssignment, + WarningCodeSourceControlWarningDeleteServicePrincipal, + WarningCodeSourceControlWarningDeleteWorkflowAndSecretFromGitHub, } } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/contentpackage_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/contentpackage_client.go new file mode 100644 index 000000000000..61ad53aad6fa --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/contentpackage_client.go @@ -0,0 +1,177 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ContentPackageClient contains the methods for the ContentPackage group. +// Don't use this type directly, use NewContentPackageClient() instead. +type ContentPackageClient struct { + internal *arm.Client + subscriptionID string +} + +// NewContentPackageClient creates a new instance of ContentPackageClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewContentPackageClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContentPackageClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ContentPackageClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Install - Install a package to the workspace. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - packageID - package Id +// - packageInstallationProperties - Package installation properties +// - options - ContentPackageClientInstallOptions contains the optional parameters for the ContentPackageClient.Install method. +func (client *ContentPackageClient) Install(ctx context.Context, resourceGroupName string, workspaceName string, packageID string, packageInstallationProperties PackageModel, options *ContentPackageClientInstallOptions) (ContentPackageClientInstallResponse, error) { + var err error + const operationName = "ContentPackageClient.Install" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.installCreateRequest(ctx, resourceGroupName, workspaceName, packageID, packageInstallationProperties, options) + if err != nil { + return ContentPackageClientInstallResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ContentPackageClientInstallResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ContentPackageClientInstallResponse{}, err + } + resp, err := client.installHandleResponse(httpResp) + return resp, err +} + +// installCreateRequest creates the Install request. +func (client *ContentPackageClient) installCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, packageID string, packageInstallationProperties PackageModel, options *ContentPackageClientInstallOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages/{packageId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if packageID == "" { + return nil, errors.New("parameter packageID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packageId}", url.PathEscape(packageID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, packageInstallationProperties); err != nil { + return nil, err + } + return req, nil +} + +// installHandleResponse handles the Install response. +func (client *ContentPackageClient) installHandleResponse(resp *http.Response) (ContentPackageClientInstallResponse, error) { + result := ContentPackageClientInstallResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PackageModel); err != nil { + return ContentPackageClientInstallResponse{}, err + } + return result, nil +} + +// Uninstall - Uninstall a package from the workspace. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - packageID - package Id +// - options - ContentPackageClientUninstallOptions contains the optional parameters for the ContentPackageClient.Uninstall +// method. +func (client *ContentPackageClient) Uninstall(ctx context.Context, resourceGroupName string, workspaceName string, packageID string, options *ContentPackageClientUninstallOptions) (ContentPackageClientUninstallResponse, error) { + var err error + const operationName = "ContentPackageClient.Uninstall" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.uninstallCreateRequest(ctx, resourceGroupName, workspaceName, packageID, options) + if err != nil { + return ContentPackageClientUninstallResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ContentPackageClientUninstallResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ContentPackageClientUninstallResponse{}, err + } + return ContentPackageClientUninstallResponse{}, nil +} + +// uninstallCreateRequest creates the Uninstall request. +func (client *ContentPackageClient) uninstallCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, packageID string, options *ContentPackageClientUninstallOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages/{packageId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if packageID == "" { + return nil, errors.New("parameter packageID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packageId}", url.PathEscape(packageID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/contentpackages_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/contentpackages_client.go new file mode 100644 index 000000000000..e97b19b5314f --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/contentpackages_client.go @@ -0,0 +1,200 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ContentPackagesClient contains the methods for the ContentPackages group. +// Don't use this type directly, use NewContentPackagesClient() instead. +type ContentPackagesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewContentPackagesClient creates a new instance of ContentPackagesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewContentPackagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContentPackagesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ContentPackagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets an installed packages by its id. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - packageID - package Id +// - options - ContentPackagesClientGetOptions contains the optional parameters for the ContentPackagesClient.Get method. +func (client *ContentPackagesClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, packageID string, options *ContentPackagesClientGetOptions) (ContentPackagesClientGetResponse, error) { + var err error + const operationName = "ContentPackagesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, workspaceName, packageID, options) + if err != nil { + return ContentPackagesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ContentPackagesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ContentPackagesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ContentPackagesClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, packageID string, options *ContentPackagesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages/{packageId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if packageID == "" { + return nil, errors.New("parameter packageID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packageId}", url.PathEscape(packageID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ContentPackagesClient) getHandleResponse(resp *http.Response) (ContentPackagesClientGetResponse, error) { + result := ContentPackagesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PackageModel); err != nil { + return ContentPackagesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all installed packages. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - options - ContentPackagesClientListOptions contains the optional parameters for the ContentPackagesClient.NewListPager +// method. +func (client *ContentPackagesClient) NewListPager(resourceGroupName string, workspaceName string, options *ContentPackagesClientListOptions) *runtime.Pager[ContentPackagesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ContentPackagesClientListResponse]{ + More: func(page ContentPackagesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ContentPackagesClientListResponse) (ContentPackagesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ContentPackagesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) + }, nil) + if err != nil { + return ContentPackagesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ContentPackagesClient) listCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *ContentPackagesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentPackages" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + if options != nil && options.Search != nil { + reqQP.Set("$search", *options.Search) + } + if options != nil && options.Count != nil { + reqQP.Set("$count", strconv.FormatBool(*options.Count)) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ContentPackagesClient) listHandleResponse(resp *http.Response) (ContentPackagesClientListResponse, error) { + result := ContentPackagesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PackageList); err != nil { + return ContentPackagesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/contenttemplate_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/contenttemplate_client.go new file mode 100644 index 000000000000..dd9022db141d --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/contenttemplate_client.go @@ -0,0 +1,247 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ContentTemplateClient contains the methods for the ContentTemplate group. +// Don't use this type directly, use NewContentTemplateClient() instead. +type ContentTemplateClient struct { + internal *arm.Client + subscriptionID string +} + +// NewContentTemplateClient creates a new instance of ContentTemplateClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewContentTemplateClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContentTemplateClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ContentTemplateClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Delete - Delete an installed template. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - templateID - template Id +// - options - ContentTemplateClientDeleteOptions contains the optional parameters for the ContentTemplateClient.Delete method. +func (client *ContentTemplateClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, templateID string, options *ContentTemplateClientDeleteOptions) (ContentTemplateClientDeleteResponse, error) { + var err error + const operationName = "ContentTemplateClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, workspaceName, templateID, options) + if err != nil { + return ContentTemplateClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ContentTemplateClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ContentTemplateClientDeleteResponse{}, err + } + return ContentTemplateClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ContentTemplateClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, templateID string, options *ContentTemplateClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates/{templateId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if templateID == "" { + return nil, errors.New("parameter templateID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{templateId}", url.PathEscape(templateID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets a template byt its identifier. Expandable properties: +// * properties/mainTemplate +// * properties/dependantTemplates +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - templateID - template Id +// - options - ContentTemplateClientGetOptions contains the optional parameters for the ContentTemplateClient.Get method. +func (client *ContentTemplateClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, templateID string, options *ContentTemplateClientGetOptions) (ContentTemplateClientGetResponse, error) { + var err error + const operationName = "ContentTemplateClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, workspaceName, templateID, options) + if err != nil { + return ContentTemplateClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ContentTemplateClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ContentTemplateClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ContentTemplateClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, templateID string, options *ContentTemplateClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates/{templateId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if templateID == "" { + return nil, errors.New("parameter templateID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{templateId}", url.PathEscape(templateID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ContentTemplateClient) getHandleResponse(resp *http.Response) (ContentTemplateClientGetResponse, error) { + result := ContentTemplateClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TemplateModel); err != nil { + return ContentTemplateClientGetResponse{}, err + } + return result, nil +} + +// Install - Install a template. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - templateID - template Id +// - templateInstallationProperties - Template installation properties +// - options - ContentTemplateClientInstallOptions contains the optional parameters for the ContentTemplateClient.Install method. +func (client *ContentTemplateClient) Install(ctx context.Context, resourceGroupName string, workspaceName string, templateID string, templateInstallationProperties TemplateModel, options *ContentTemplateClientInstallOptions) (ContentTemplateClientInstallResponse, error) { + var err error + const operationName = "ContentTemplateClient.Install" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.installCreateRequest(ctx, resourceGroupName, workspaceName, templateID, templateInstallationProperties, options) + if err != nil { + return ContentTemplateClientInstallResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ContentTemplateClientInstallResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ContentTemplateClientInstallResponse{}, err + } + resp, err := client.installHandleResponse(httpResp) + return resp, err +} + +// installCreateRequest creates the Install request. +func (client *ContentTemplateClient) installCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, templateID string, templateInstallationProperties TemplateModel, options *ContentTemplateClientInstallOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates/{templateId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if templateID == "" { + return nil, errors.New("parameter templateID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{templateId}", url.PathEscape(templateID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, templateInstallationProperties); err != nil { + return nil, err + } + return req, nil +} + +// installHandleResponse handles the Install response. +func (client *ContentTemplateClient) installHandleResponse(resp *http.Response) (ContentTemplateClientInstallResponse, error) { + result := ContentTemplateClientInstallResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TemplateModel); err != nil { + return ContentTemplateClientInstallResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/contenttemplates_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/contenttemplates_client.go new file mode 100644 index 000000000000..15ca22314bba --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/contenttemplates_client.go @@ -0,0 +1,136 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ContentTemplatesClient contains the methods for the ContentTemplates group. +// Don't use this type directly, use NewContentTemplatesClient() instead. +type ContentTemplatesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewContentTemplatesClient creates a new instance of ContentTemplatesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewContentTemplatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContentTemplatesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ContentTemplatesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Gets all installed templates. Expandable properties: +// * properties/mainTemplate +// * properties/dependantTemplates +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - options - ContentTemplatesClientListOptions contains the optional parameters for the ContentTemplatesClient.NewListPager +// method. +func (client *ContentTemplatesClient) NewListPager(resourceGroupName string, workspaceName string, options *ContentTemplatesClientListOptions) *runtime.Pager[ContentTemplatesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ContentTemplatesClientListResponse]{ + More: func(page ContentTemplatesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ContentTemplatesClientListResponse) (ContentTemplatesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ContentTemplatesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) + }, nil) + if err != nil { + return ContentTemplatesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ContentTemplatesClient) listCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *ContentTemplatesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentTemplates" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + if options != nil && options.Expand != nil { + reqQP.Set("$expand", *options.Expand) + } + if options != nil && options.Search != nil { + reqQP.Set("$search", *options.Search) + } + if options != nil && options.Count != nil { + reqQP.Set("$count", strconv.FormatBool(*options.Count)) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ContentTemplatesClient) listHandleResponse(resp *http.Response) (ContentTemplatesClientListResponse, error) { + result := ContentTemplatesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TemplateList); err != nil { + return ContentTemplatesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectors_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectors_client.go index a346f9156604..03b19567fe08 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectors_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectors_client.go @@ -46,7 +46,7 @@ func NewDataConnectorsClient(subscriptionID string, credential azcore.TokenCrede // CreateOrUpdate - Creates or updates the data connector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - dataConnectorID - Connector ID @@ -99,7 +99,7 @@ func (client *DataConnectorsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, dataConnector); err != nil { @@ -120,7 +120,7 @@ func (client *DataConnectorsClient) createOrUpdateHandleResponse(resp *http.Resp // Delete - Delete the data connector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - dataConnectorID - Connector ID @@ -170,7 +170,7 @@ func (client *DataConnectorsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -179,7 +179,7 @@ func (client *DataConnectorsClient) deleteCreateRequest(ctx context.Context, res // Get - Gets a data connector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - dataConnectorID - Connector ID @@ -230,7 +230,7 @@ func (client *DataConnectorsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -247,7 +247,7 @@ func (client *DataConnectorsClient) getHandleResponse(resp *http.Response) (Data // NewListPager - Gets all data connectors. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - options - DataConnectorsClientListOptions contains the optional parameters for the DataConnectorsClient.NewListPager method. @@ -294,7 +294,7 @@ func (client *DataConnectorsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectors_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectors_client_example_test.go deleted file mode 100644 index 18e18193beca..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/dataconnectors_client_example_test.go +++ /dev/null @@ -1,607 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/dataConnectors/GetDataConnectors.json -func ExampleDataConnectorsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewDataConnectorsClient().NewListPager("myRg", "myWorkspace", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.DataConnectorList = armsecurityinsights.DataConnectorList{ - // Value: []armsecurityinsights.DataConnectorClassification{ - // &armsecurityinsights.ASCDataConnector{ - // Name: to.Ptr("763f9fa1-c2d3-4fa2-93e9-bccd4899aa12"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/763f9fa1-c2d3-4fa2-93e9-bccd4899aa12"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindAzureSecurityCenter), - // Properties: &armsecurityinsights.ASCDataConnectorProperties{ - // DataTypes: &armsecurityinsights.AlertsDataTypeOfDataConnector{ - // Alerts: &armsecurityinsights.DataConnectorDataTypeCommon{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // SubscriptionID: to.Ptr("d0cfe6b2-9ac0-4464-9919-dccaee2e48c0"), - // }, - // }, - // &armsecurityinsights.TIDataConnector{ - // Name: to.Ptr("c345bf40-8509-4ed2-b947-50cb773aaf04"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/c345bf40-8509-4ed2-b947-50cb773aaf04"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindThreatIntelligence), - // Properties: &armsecurityinsights.TIDataConnectorProperties{ - // DataTypes: &armsecurityinsights.TIDataConnectorDataTypes{ - // Indicators: &armsecurityinsights.TIDataConnectorDataTypesIndicators{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), - // }, - // }, - // &armsecurityinsights.AADDataConnector{ - // Name: to.Ptr("f0cd27d2-5f03-4c06-ba31-d2dc82dcb51d"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/f0cd27d2-5f03-4c06-ba31-d2dc82dcb51d"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindAzureActiveDirectory), - // Properties: &armsecurityinsights.AADDataConnectorProperties{ - // DataTypes: &armsecurityinsights.AlertsDataTypeOfDataConnector{ - // Alerts: &armsecurityinsights.DataConnectorDataTypeCommon{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), - // }, - // }, - // &armsecurityinsights.OfficeDataConnector{ - // Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindOffice365), - // Properties: &armsecurityinsights.OfficeDataConnectorProperties{ - // DataTypes: &armsecurityinsights.OfficeDataConnectorDataTypes{ - // Exchange: &armsecurityinsights.OfficeDataConnectorDataTypesExchange{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // SharePoint: &armsecurityinsights.OfficeDataConnectorDataTypesSharePoint{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), - // }, - // }, - // &armsecurityinsights.MCASDataConnector{ - // Name: to.Ptr("b96d014d-b5c2-4a01-9aba-a8058f629d42"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/b96d014d-b5c2-4a01-9aba-a8058f629d42"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindMicrosoftCloudAppSecurity), - // Properties: &armsecurityinsights.MCASDataConnectorProperties{ - // DataTypes: &armsecurityinsights.MCASDataConnectorDataTypes{ - // Alerts: &armsecurityinsights.DataConnectorDataTypeCommon{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // DiscoveryLogs: &armsecurityinsights.DataConnectorDataTypeCommon{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), - // }, - // }, - // &armsecurityinsights.AATPDataConnector{ - // Name: to.Ptr("07e42cb3-e658-4e90-801c-efa0f29d3d44"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/07e42cb3-e658-4e90-801c-efa0f29d3d44"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindAzureAdvancedThreatProtection), - // Properties: &armsecurityinsights.AATPDataConnectorProperties{ - // DataTypes: &armsecurityinsights.AlertsDataTypeOfDataConnector{ - // Alerts: &armsecurityinsights.DataConnectorDataTypeCommon{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), - // }, - // }, - // &armsecurityinsights.AwsCloudTrailDataConnector{ - // Name: to.Ptr("c345bf40-8509-4ed2-b947-50cb773aaf04"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/c345bf40-8509-4ed2-b947-50cb773aaf04"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindAmazonWebServicesCloudTrail), - // Properties: &armsecurityinsights.AwsCloudTrailDataConnectorProperties{ - // AwsRoleArn: to.Ptr("myAwsRoleArn"), - // DataTypes: &armsecurityinsights.AwsCloudTrailDataConnectorDataTypes{ - // Logs: &armsecurityinsights.AwsCloudTrailDataConnectorDataTypesLogs{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // }, - // }, - // &armsecurityinsights.MDATPDataConnector{ - // Name: to.Ptr("06b3ccb8-1384-4bcc-aec7-852f6d57161b"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/06b3ccb8-1384-4bcc-aec7-852f6d57161b"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindMicrosoftDefenderAdvancedThreatProtection), - // Properties: &armsecurityinsights.MDATPDataConnectorProperties{ - // DataTypes: &armsecurityinsights.AlertsDataTypeOfDataConnector{ - // Alerts: &armsecurityinsights.DataConnectorDataTypeCommon{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/dataConnectors/GetAzureSecurityCenterById.json -func ExampleDataConnectorsClient_Get_getAAscDataConnector() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataConnectorsClient().Get(ctx, "myRg", "myWorkspace", "763f9fa1-c2d3-4fa2-93e9-bccd4899aa12", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.DataConnectorsClientGetResponse{ - // DataConnectorClassification: &armsecurityinsights.ASCDataConnector{ - // Name: to.Ptr("763f9fa1-c2d3-4fa2-93e9-bccd4899aa12"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/763f9fa1-c2d3-4fa2-93e9-bccd4899aa12"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindAzureSecurityCenter), - // Properties: &armsecurityinsights.ASCDataConnectorProperties{ - // DataTypes: &armsecurityinsights.AlertsDataTypeOfDataConnector{ - // Alerts: &armsecurityinsights.DataConnectorDataTypeCommon{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // SubscriptionID: to.Ptr("c0688291-89d7-4bed-87a2-a7b1bff43f4c"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/dataConnectors/GetMicrosoftCloudAppSecurityById.json -func ExampleDataConnectorsClient_Get_getAMcasDataConnector() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataConnectorsClient().Get(ctx, "myRg", "myWorkspace", "b96d014d-b5c2-4a01-9aba-a8058f629d42", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.DataConnectorsClientGetResponse{ - // DataConnectorClassification: &armsecurityinsights.MCASDataConnector{ - // Name: to.Ptr("b96d014d-b5c2-4a01-9aba-a8058f629d42"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/b96d014d-b5c2-4a01-9aba-a8058f629d42"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindMicrosoftCloudAppSecurity), - // Properties: &armsecurityinsights.MCASDataConnectorProperties{ - // DataTypes: &armsecurityinsights.MCASDataConnectorDataTypes{ - // Alerts: &armsecurityinsights.DataConnectorDataTypeCommon{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // DiscoveryLogs: &armsecurityinsights.DataConnectorDataTypeCommon{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/dataConnectors/GetMicrosoftDefenderAdvancedThreatProtectionById.json -func ExampleDataConnectorsClient_Get_getAMdatpDataConnector() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataConnectorsClient().Get(ctx, "myRg", "myWorkspace", "06b3ccb8-1384-4bcc-aec7-852f6d57161b", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.DataConnectorsClientGetResponse{ - // DataConnectorClassification: &armsecurityinsights.MDATPDataConnector{ - // Name: to.Ptr("06b3ccb8-1384-4bcc-aec7-852f6d57161b"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/06b3ccb8-1384-4bcc-aec7-852f6d57161b"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindMicrosoftDefenderAdvancedThreatProtection), - // Properties: &armsecurityinsights.MDATPDataConnectorProperties{ - // DataTypes: &armsecurityinsights.AlertsDataTypeOfDataConnector{ - // Alerts: &armsecurityinsights.DataConnectorDataTypeCommon{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/dataConnectors/GetThreatIntelligenceById.json -func ExampleDataConnectorsClient_Get_getATiDataConnector() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataConnectorsClient().Get(ctx, "myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.DataConnectorsClientGetResponse{ - // DataConnectorClassification: &armsecurityinsights.TIDataConnector{ - // Name: to.Ptr("c345bf40-8509-4ed2-b947-50cb773aaf04"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/c345bf40-8509-4ed2-b947-50cb773aaf04"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindThreatIntelligence), - // Properties: &armsecurityinsights.TIDataConnectorProperties{ - // DataTypes: &armsecurityinsights.TIDataConnectorDataTypes{ - // Indicators: &armsecurityinsights.TIDataConnectorDataTypesIndicators{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), - // TipLookbackPeriod: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T13:00:30.123Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/dataConnectors/GetAzureActiveDirectoryById.json -func ExampleDataConnectorsClient_Get_getAnAadDataConnector() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataConnectorsClient().Get(ctx, "myRg", "myWorkspace", "f0cd27d2-5f03-4c06-ba31-d2dc82dcb51d", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.DataConnectorsClientGetResponse{ - // DataConnectorClassification: &armsecurityinsights.AADDataConnector{ - // Name: to.Ptr("f0cd27d2-5f03-4c06-ba31-d2dc82dcb51d"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/f0cd27d2-5f03-4c06-ba31-d2dc82dcb51d"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindAzureActiveDirectory), - // Properties: &armsecurityinsights.AADDataConnectorProperties{ - // DataTypes: &armsecurityinsights.AlertsDataTypeOfDataConnector{ - // Alerts: &armsecurityinsights.DataConnectorDataTypeCommon{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/dataConnectors/GetAzureAdvancedThreatProtectionById.json -func ExampleDataConnectorsClient_Get_getAnAatpDataConnector() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataConnectorsClient().Get(ctx, "myRg", "myWorkspace", "07e42cb3-e658-4e90-801c-efa0f29d3d44", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.DataConnectorsClientGetResponse{ - // DataConnectorClassification: &armsecurityinsights.AATPDataConnector{ - // Name: to.Ptr("07e42cb3-e658-4e90-801c-efa0f29d3d44"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/07e42cb3-e658-4e90-801c-efa0f29d3d44"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindAzureAdvancedThreatProtection), - // Properties: &armsecurityinsights.AATPDataConnectorProperties{ - // DataTypes: &armsecurityinsights.AlertsDataTypeOfDataConnector{ - // Alerts: &armsecurityinsights.DataConnectorDataTypeCommon{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/dataConnectors/GetAmazonWebServicesCloudTrailById.json -func ExampleDataConnectorsClient_Get_getAnAwsCloudTrailDataConnector() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataConnectorsClient().Get(ctx, "myRg", "myWorkspace", "c345bf40-8509-4ed2-b947-50cb773aaf04", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.DataConnectorsClientGetResponse{ - // DataConnectorClassification: &armsecurityinsights.AwsCloudTrailDataConnector{ - // Name: to.Ptr("c345bf40-8509-4ed2-b947-50cb773aaf04"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/c345bf40-8509-4ed2-b947-50cb773aaf04"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindAmazonWebServicesCloudTrail), - // Properties: &armsecurityinsights.AwsCloudTrailDataConnectorProperties{ - // AwsRoleArn: to.Ptr("myAwsRoleArn"), - // DataTypes: &armsecurityinsights.AwsCloudTrailDataConnectorDataTypes{ - // Logs: &armsecurityinsights.AwsCloudTrailDataConnectorDataTypesLogs{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/dataConnectors/GetOfficeDataConnetorById.json -func ExampleDataConnectorsClient_Get_getAnOffice365DataConnector() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataConnectorsClient().Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.DataConnectorsClientGetResponse{ - // DataConnectorClassification: &armsecurityinsights.OfficeDataConnector{ - // Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindOffice365), - // Properties: &armsecurityinsights.OfficeDataConnectorProperties{ - // DataTypes: &armsecurityinsights.OfficeDataConnectorDataTypes{ - // Exchange: &armsecurityinsights.OfficeDataConnectorDataTypesExchange{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // SharePoint: &armsecurityinsights.OfficeDataConnectorDataTypesSharePoint{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // Teams: &armsecurityinsights.OfficeDataConnectorDataTypesTeams{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/dataConnectors/CreateOfficeDataConnetor.json -func ExampleDataConnectorsClient_CreateOrUpdate_createsOrUpdatesAnOffice365DataConnector() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataConnectorsClient().CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", &armsecurityinsights.OfficeDataConnector{ - Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - Kind: to.Ptr(armsecurityinsights.DataConnectorKindOffice365), - Properties: &armsecurityinsights.OfficeDataConnectorProperties{ - DataTypes: &armsecurityinsights.OfficeDataConnectorDataTypes{ - Exchange: &armsecurityinsights.OfficeDataConnectorDataTypesExchange{ - State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - }, - SharePoint: &armsecurityinsights.OfficeDataConnectorDataTypesSharePoint{ - State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - }, - Teams: &armsecurityinsights.OfficeDataConnectorDataTypesTeams{ - State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - }, - }, - TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.DataConnectorsClientCreateOrUpdateResponse{ - // DataConnectorClassification: &armsecurityinsights.OfficeDataConnector{ - // Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindOffice365), - // Properties: &armsecurityinsights.OfficeDataConnectorProperties{ - // DataTypes: &armsecurityinsights.OfficeDataConnectorDataTypes{ - // Exchange: &armsecurityinsights.OfficeDataConnectorDataTypesExchange{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // SharePoint: &armsecurityinsights.OfficeDataConnectorDataTypesSharePoint{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // Teams: &armsecurityinsights.OfficeDataConnectorDataTypesTeams{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // TenantID: to.Ptr("2070ecc9-b4d5-4ae4-adaa-936fa1954fa8"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/dataConnectors/CreateThreatIntelligenceDataConnector.json -func ExampleDataConnectorsClient_CreateOrUpdate_createsOrUpdatesAnThreatIntelligencePlatformDataConnector() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewDataConnectorsClient().CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", &armsecurityinsights.TIDataConnector{ - Kind: to.Ptr(armsecurityinsights.DataConnectorKindThreatIntelligence), - Properties: &armsecurityinsights.TIDataConnectorProperties{ - DataTypes: &armsecurityinsights.TIDataConnectorDataTypes{ - Indicators: &armsecurityinsights.TIDataConnectorDataTypesIndicators{ - State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - }, - }, - TenantID: to.Ptr("06b3ccb8-1384-4bcc-aec7-852f6d57161b"), - TipLookbackPeriod: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T13:00:30.123Z"); return t }()), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.DataConnectorsClientCreateOrUpdateResponse{ - // DataConnectorClassification: &armsecurityinsights.TIDataConnector{ - // Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Type: to.Ptr("Microsoft.SecurityInsights/dataConnectors"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/dataConnectors/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Kind: to.Ptr(armsecurityinsights.DataConnectorKindThreatIntelligence), - // Properties: &armsecurityinsights.TIDataConnectorProperties{ - // DataTypes: &armsecurityinsights.TIDataConnectorDataTypes{ - // Indicators: &armsecurityinsights.TIDataConnectorDataTypesIndicators{ - // State: to.Ptr(armsecurityinsights.DataTypeStateEnabled), - // }, - // }, - // TenantID: to.Ptr("06b3ccb8-1384-4bcc-aec7-852f6d57161b"), - // TipLookbackPeriod: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-01-01T13:00:30.123Z"); return t}()), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/dataConnectors/DeleteOfficeDataConnetor.json -func ExampleDataConnectorsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewDataConnectorsClient().Delete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/date_type.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/date_type.go new file mode 100644 index 000000000000..a58d5ebeafc1 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/date_type.go @@ -0,0 +1,59 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "strings" + "time" +) + +const ( + fullDateJSON = `"2006-01-02"` + jsonFormat = `"%04d-%02d-%02d"` +) + +type dateType time.Time + +func (t dateType) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf(jsonFormat, time.Time(t).Year(), time.Time(t).Month(), time.Time(t).Day())), nil +} + +func (d *dateType) UnmarshalJSON(data []byte) (err error) { + t, err := time.Parse(fullDateJSON, string(data)) + *d = (dateType)(t) + return err +} + +func populateDateType(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateType)(t) +} + +func unpopulateDateType(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux dateType + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/actions_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/actions_server.go index 6d5d25e5cf01..309130bc5925 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/actions_server.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/actions_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/alertrules_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/alertrules_server.go index 29aaa2ca2d9c..de09abccc636 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/alertrules_server.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/alertrules_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/alertruletemplates_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/alertruletemplates_server.go index 805a9c10348c..833aae678dff 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/alertruletemplates_server.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/alertruletemplates_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/automationrules_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/automationrules_server.go index c8dd8ff03b8e..6782e390b727 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/automationrules_server.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/automationrules_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" "net/http" "net/url" "reflect" diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/bookmarks_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/bookmarks_server.go index 0b17baeecfe4..49c724fbd577 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/bookmarks_server.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/bookmarks_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/contentpackage_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/contentpackage_server.go new file mode 100644 index 000000000000..fc9ee084fa16 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/contentpackage_server.go @@ -0,0 +1,151 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" + "net/http" + "net/url" + "regexp" +) + +// ContentPackageServer is a fake server for instances of the armsecurityinsights.ContentPackageClient type. +type ContentPackageServer struct { + // Install is the fake for method ContentPackageClient.Install + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Install func(ctx context.Context, resourceGroupName string, workspaceName string, packageID string, packageInstallationProperties armsecurityinsights.PackageModel, options *armsecurityinsights.ContentPackageClientInstallOptions) (resp azfake.Responder[armsecurityinsights.ContentPackageClientInstallResponse], errResp azfake.ErrorResponder) + + // Uninstall is the fake for method ContentPackageClient.Uninstall + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Uninstall func(ctx context.Context, resourceGroupName string, workspaceName string, packageID string, options *armsecurityinsights.ContentPackageClientUninstallOptions) (resp azfake.Responder[armsecurityinsights.ContentPackageClientUninstallResponse], errResp azfake.ErrorResponder) +} + +// NewContentPackageServerTransport creates a new instance of ContentPackageServerTransport with the provided implementation. +// The returned ContentPackageServerTransport instance is connected to an instance of armsecurityinsights.ContentPackageClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewContentPackageServerTransport(srv *ContentPackageServer) *ContentPackageServerTransport { + return &ContentPackageServerTransport{srv: srv} +} + +// ContentPackageServerTransport connects instances of armsecurityinsights.ContentPackageClient to instances of ContentPackageServer. +// Don't use this type directly, use NewContentPackageServerTransport instead. +type ContentPackageServerTransport struct { + srv *ContentPackageServer +} + +// Do implements the policy.Transporter interface for ContentPackageServerTransport. +func (c *ContentPackageServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ContentPackageClient.Install": + resp, err = c.dispatchInstall(req) + case "ContentPackageClient.Uninstall": + resp, err = c.dispatchUninstall(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ContentPackageServerTransport) dispatchInstall(req *http.Request) (*http.Response, error) { + if c.srv.Install == nil { + return nil, &nonRetriableError{errors.New("fake for method Install not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/contentPackages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurityinsights.PackageModel](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + packageIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("packageId")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Install(req.Context(), resourceGroupNameParam, workspaceNameParam, packageIDParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PackageModel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ContentPackageServerTransport) dispatchUninstall(req *http.Request) (*http.Response, error) { + if c.srv.Uninstall == nil { + return nil, &nonRetriableError{errors.New("fake for method Uninstall not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/contentPackages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + packageIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("packageId")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Uninstall(req.Context(), resourceGroupNameParam, workspaceNameParam, packageIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/contentpackages_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/contentpackages_server.go new file mode 100644 index 000000000000..87450b812f70 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/contentpackages_server.go @@ -0,0 +1,226 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// ContentPackagesServer is a fake server for instances of the armsecurityinsights.ContentPackagesClient type. +type ContentPackagesServer struct { + // Get is the fake for method ContentPackagesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, workspaceName string, packageID string, options *armsecurityinsights.ContentPackagesClientGetOptions) (resp azfake.Responder[armsecurityinsights.ContentPackagesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ContentPackagesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, workspaceName string, options *armsecurityinsights.ContentPackagesClientListOptions) (resp azfake.PagerResponder[armsecurityinsights.ContentPackagesClientListResponse]) +} + +// NewContentPackagesServerTransport creates a new instance of ContentPackagesServerTransport with the provided implementation. +// The returned ContentPackagesServerTransport instance is connected to an instance of armsecurityinsights.ContentPackagesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewContentPackagesServerTransport(srv *ContentPackagesServer) *ContentPackagesServerTransport { + return &ContentPackagesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurityinsights.ContentPackagesClientListResponse]](), + } +} + +// ContentPackagesServerTransport connects instances of armsecurityinsights.ContentPackagesClient to instances of ContentPackagesServer. +// Don't use this type directly, use NewContentPackagesServerTransport instead. +type ContentPackagesServerTransport struct { + srv *ContentPackagesServer + newListPager *tracker[azfake.PagerResponder[armsecurityinsights.ContentPackagesClientListResponse]] +} + +// Do implements the policy.Transporter interface for ContentPackagesServerTransport. +func (c *ContentPackagesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ContentPackagesClient.Get": + resp, err = c.dispatchGet(req) + case "ContentPackagesClient.NewListPager": + resp, err = c.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ContentPackagesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/contentPackages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + packageIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("packageId")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, workspaceNameParam, packageIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PackageModel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ContentPackagesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := c.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/contentPackages` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + orderbyUnescaped, err := url.QueryUnescape(qp.Get("$orderby")) + if err != nil { + return nil, err + } + orderbyParam := getOptional(orderbyUnescaped) + searchUnescaped, err := url.QueryUnescape(qp.Get("$search")) + if err != nil { + return nil, err + } + searchParam := getOptional(searchUnescaped) + countUnescaped, err := url.QueryUnescape(qp.Get("$count")) + if err != nil { + return nil, err + } + countParam, err := parseOptional(countUnescaped, strconv.ParseBool) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + skipUnescaped, err := url.QueryUnescape(qp.Get("$skip")) + if err != nil { + return nil, err + } + skipParam, err := parseOptional(skipUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) + if err != nil { + return nil, err + } + skipTokenParam := getOptional(skipTokenUnescaped) + var options *armsecurityinsights.ContentPackagesClientListOptions + if filterParam != nil || orderbyParam != nil || searchParam != nil || countParam != nil || topParam != nil || skipParam != nil || skipTokenParam != nil { + options = &armsecurityinsights.ContentPackagesClientListOptions{ + Filter: filterParam, + Orderby: orderbyParam, + Search: searchParam, + Count: countParam, + Top: topParam, + Skip: skipParam, + SkipToken: skipTokenParam, + } + } + resp := c.srv.NewListPager(resourceGroupNameParam, workspaceNameParam, options) + newListPager = &resp + c.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurityinsights.ContentPackagesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + c.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/contenttemplate_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/contenttemplate_server.go new file mode 100644 index 000000000000..3a5814b5bc1f --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/contenttemplate_server.go @@ -0,0 +1,194 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" + "net/http" + "net/url" + "regexp" +) + +// ContentTemplateServer is a fake server for instances of the armsecurityinsights.ContentTemplateClient type. +type ContentTemplateServer struct { + // Delete is the fake for method ContentTemplateClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, workspaceName string, templateID string, options *armsecurityinsights.ContentTemplateClientDeleteOptions) (resp azfake.Responder[armsecurityinsights.ContentTemplateClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ContentTemplateClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, workspaceName string, templateID string, options *armsecurityinsights.ContentTemplateClientGetOptions) (resp azfake.Responder[armsecurityinsights.ContentTemplateClientGetResponse], errResp azfake.ErrorResponder) + + // Install is the fake for method ContentTemplateClient.Install + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Install func(ctx context.Context, resourceGroupName string, workspaceName string, templateID string, templateInstallationProperties armsecurityinsights.TemplateModel, options *armsecurityinsights.ContentTemplateClientInstallOptions) (resp azfake.Responder[armsecurityinsights.ContentTemplateClientInstallResponse], errResp azfake.ErrorResponder) +} + +// NewContentTemplateServerTransport creates a new instance of ContentTemplateServerTransport with the provided implementation. +// The returned ContentTemplateServerTransport instance is connected to an instance of armsecurityinsights.ContentTemplateClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewContentTemplateServerTransport(srv *ContentTemplateServer) *ContentTemplateServerTransport { + return &ContentTemplateServerTransport{srv: srv} +} + +// ContentTemplateServerTransport connects instances of armsecurityinsights.ContentTemplateClient to instances of ContentTemplateServer. +// Don't use this type directly, use NewContentTemplateServerTransport instead. +type ContentTemplateServerTransport struct { + srv *ContentTemplateServer +} + +// Do implements the policy.Transporter interface for ContentTemplateServerTransport. +func (c *ContentTemplateServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ContentTemplateClient.Delete": + resp, err = c.dispatchDelete(req) + case "ContentTemplateClient.Get": + resp, err = c.dispatchGet(req) + case "ContentTemplateClient.Install": + resp, err = c.dispatchInstall(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ContentTemplateServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if c.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/contentTemplates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + templateIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("templateId")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Delete(req.Context(), resourceGroupNameParam, workspaceNameParam, templateIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ContentTemplateServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/contentTemplates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + templateIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("templateId")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, workspaceNameParam, templateIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TemplateModel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *ContentTemplateServerTransport) dispatchInstall(req *http.Request) (*http.Response, error) { + if c.srv.Install == nil { + return nil, &nonRetriableError{errors.New("fake for method Install not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/contentTemplates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurityinsights.TemplateModel](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + templateIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("templateId")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Install(req.Context(), resourceGroupNameParam, workspaceNameParam, templateIDParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TemplateModel, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/contenttemplates_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/contenttemplates_server.go new file mode 100644 index 000000000000..14effa38e018 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/contenttemplates_server.go @@ -0,0 +1,188 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// ContentTemplatesServer is a fake server for instances of the armsecurityinsights.ContentTemplatesClient type. +type ContentTemplatesServer struct { + // NewListPager is the fake for method ContentTemplatesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, workspaceName string, options *armsecurityinsights.ContentTemplatesClientListOptions) (resp azfake.PagerResponder[armsecurityinsights.ContentTemplatesClientListResponse]) +} + +// NewContentTemplatesServerTransport creates a new instance of ContentTemplatesServerTransport with the provided implementation. +// The returned ContentTemplatesServerTransport instance is connected to an instance of armsecurityinsights.ContentTemplatesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewContentTemplatesServerTransport(srv *ContentTemplatesServer) *ContentTemplatesServerTransport { + return &ContentTemplatesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurityinsights.ContentTemplatesClientListResponse]](), + } +} + +// ContentTemplatesServerTransport connects instances of armsecurityinsights.ContentTemplatesClient to instances of ContentTemplatesServer. +// Don't use this type directly, use NewContentTemplatesServerTransport instead. +type ContentTemplatesServerTransport struct { + srv *ContentTemplatesServer + newListPager *tracker[azfake.PagerResponder[armsecurityinsights.ContentTemplatesClientListResponse]] +} + +// Do implements the policy.Transporter interface for ContentTemplatesServerTransport. +func (c *ContentTemplatesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ContentTemplatesClient.NewListPager": + resp, err = c.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (c *ContentTemplatesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := c.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/contentTemplates` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + orderbyUnescaped, err := url.QueryUnescape(qp.Get("$orderby")) + if err != nil { + return nil, err + } + orderbyParam := getOptional(orderbyUnescaped) + expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) + if err != nil { + return nil, err + } + expandParam := getOptional(expandUnescaped) + searchUnescaped, err := url.QueryUnescape(qp.Get("$search")) + if err != nil { + return nil, err + } + searchParam := getOptional(searchUnescaped) + countUnescaped, err := url.QueryUnescape(qp.Get("$count")) + if err != nil { + return nil, err + } + countParam, err := parseOptional(countUnescaped, strconv.ParseBool) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + skipUnescaped, err := url.QueryUnescape(qp.Get("$skip")) + if err != nil { + return nil, err + } + skipParam, err := parseOptional(skipUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) + if err != nil { + return nil, err + } + skipTokenParam := getOptional(skipTokenUnescaped) + var options *armsecurityinsights.ContentTemplatesClientListOptions + if filterParam != nil || orderbyParam != nil || expandParam != nil || searchParam != nil || countParam != nil || topParam != nil || skipParam != nil || skipTokenParam != nil { + options = &armsecurityinsights.ContentTemplatesClientListOptions{ + Filter: filterParam, + Orderby: orderbyParam, + Expand: expandParam, + Search: searchParam, + Count: countParam, + Top: topParam, + Skip: skipParam, + SkipToken: skipTokenParam, + } + } + resp := c.srv.NewListPager(resourceGroupNameParam, workspaceNameParam, options) + newListPager = &resp + c.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurityinsights.ContentTemplatesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + c.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/dataconnectors_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/dataconnectors_server.go index e6be4641b53b..1f6afe156162 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/dataconnectors_server.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/dataconnectors_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/date_type.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/date_type.go new file mode 100644 index 000000000000..efb0b705ae45 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/date_type.go @@ -0,0 +1,59 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "strings" + "time" +) + +const ( + fullDateJSON = `"2006-01-02"` + jsonFormat = `"%04d-%02d-%02d"` +) + +type dateType time.Time + +func (t dateType) MarshalJSON() ([]byte, error) { + return []byte(fmt.Sprintf(jsonFormat, time.Time(t).Year(), time.Time(t).Month(), time.Time(t).Day())), nil +} + +func (d *dateType) UnmarshalJSON(data []byte) (err error) { + t, err := time.Parse(fullDateJSON, string(data)) + *d = (dateType)(t) + return err +} + +func populateDateType(m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateType)(t) +} + +func unpopulateDateType(data json.RawMessage, fn string, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux dateType + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/incidentcomments_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/incidentcomments_server.go index ce768082e44f..c934acb05cc6 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/incidentcomments_server.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/incidentcomments_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/incidentrelations_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/incidentrelations_server.go index 9a7fd160ff94..5e86e0aac780 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/incidentrelations_server.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/incidentrelations_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/incidents_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/incidents_server.go index 259232e00d19..ed17d7c8f193 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/incidents_server.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/incidents_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/metadata_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/metadata_server.go new file mode 100644 index 000000000000..83b2e9bd0153 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/metadata_server.go @@ -0,0 +1,342 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// MetadataServer is a fake server for instances of the armsecurityinsights.MetadataClient type. +type MetadataServer struct { + // Create is the fake for method MetadataClient.Create + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Create func(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, metadata armsecurityinsights.MetadataModel, options *armsecurityinsights.MetadataClientCreateOptions) (resp azfake.Responder[armsecurityinsights.MetadataClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method MetadataClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, options *armsecurityinsights.MetadataClientDeleteOptions) (resp azfake.Responder[armsecurityinsights.MetadataClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method MetadataClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, options *armsecurityinsights.MetadataClientGetOptions) (resp azfake.Responder[armsecurityinsights.MetadataClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method MetadataClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, workspaceName string, options *armsecurityinsights.MetadataClientListOptions) (resp azfake.PagerResponder[armsecurityinsights.MetadataClientListResponse]) + + // Update is the fake for method MetadataClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, metadataPatch armsecurityinsights.MetadataPatch, options *armsecurityinsights.MetadataClientUpdateOptions) (resp azfake.Responder[armsecurityinsights.MetadataClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewMetadataServerTransport creates a new instance of MetadataServerTransport with the provided implementation. +// The returned MetadataServerTransport instance is connected to an instance of armsecurityinsights.MetadataClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewMetadataServerTransport(srv *MetadataServer) *MetadataServerTransport { + return &MetadataServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurityinsights.MetadataClientListResponse]](), + } +} + +// MetadataServerTransport connects instances of armsecurityinsights.MetadataClient to instances of MetadataServer. +// Don't use this type directly, use NewMetadataServerTransport instead. +type MetadataServerTransport struct { + srv *MetadataServer + newListPager *tracker[azfake.PagerResponder[armsecurityinsights.MetadataClientListResponse]] +} + +// Do implements the policy.Transporter interface for MetadataServerTransport. +func (m *MetadataServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "MetadataClient.Create": + resp, err = m.dispatchCreate(req) + case "MetadataClient.Delete": + resp, err = m.dispatchDelete(req) + case "MetadataClient.Get": + resp, err = m.dispatchGet(req) + case "MetadataClient.NewListPager": + resp, err = m.dispatchNewListPager(req) + case "MetadataClient.Update": + resp, err = m.dispatchUpdate(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (m *MetadataServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if m.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/metadata/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurityinsights.MetadataModel](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + metadataNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("metadataName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Create(req.Context(), resourceGroupNameParam, workspaceNameParam, metadataNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MetadataModel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MetadataServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if m.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/metadata/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + metadataNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("metadataName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Delete(req.Context(), resourceGroupNameParam, workspaceNameParam, metadataNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MetadataServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if m.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/metadata/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + metadataNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("metadataName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Get(req.Context(), resourceGroupNameParam, workspaceNameParam, metadataNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MetadataModel, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (m *MetadataServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if m.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := m.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/metadata` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + orderbyUnescaped, err := url.QueryUnescape(qp.Get("$orderby")) + if err != nil { + return nil, err + } + orderbyParam := getOptional(orderbyUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + skipUnescaped, err := url.QueryUnescape(qp.Get("$skip")) + if err != nil { + return nil, err + } + skipParam, err := parseOptional(skipUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + var options *armsecurityinsights.MetadataClientListOptions + if filterParam != nil || orderbyParam != nil || topParam != nil || skipParam != nil { + options = &armsecurityinsights.MetadataClientListOptions{ + Filter: filterParam, + Orderby: orderbyParam, + Top: topParam, + Skip: skipParam, + } + } + resp := m.srv.NewListPager(resourceGroupNameParam, workspaceNameParam, options) + newListPager = &resp + m.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurityinsights.MetadataClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + m.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + m.newListPager.remove(req) + } + return resp, nil +} + +func (m *MetadataServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if m.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/metadata/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurityinsights.MetadataPatch](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + metadataNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("metadataName")]) + if err != nil { + return nil, err + } + respr, errRespr := m.srv.Update(req.Context(), resourceGroupNameParam, workspaceNameParam, metadataNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MetadataModel, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/operations_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/operations_server.go index f5a53049b152..ed1be8860513 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/operations_server.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/operations_server.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" "net/http" ) diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/polymorphic_helpers.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/polymorphic_helpers.go index d78cf7f89712..36e62cd17293 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/polymorphic_helpers.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/polymorphic_helpers.go @@ -10,7 +10,7 @@ package fake import ( "encoding/json" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" ) func unmarshalAlertRuleClassification(rawMsg json.RawMessage) (armsecurityinsights.AlertRuleClassification, error) { @@ -72,3 +72,24 @@ func unmarshalDataConnectorClassification(rawMsg json.RawMessage) (armsecurityin } return b, nil } + +func unmarshalSecurityMLAnalyticsSettingClassification(rawMsg json.RawMessage) (armsecurityinsights.SecurityMLAnalyticsSettingClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b armsecurityinsights.SecurityMLAnalyticsSettingClassification + switch m["kind"] { + case string(armsecurityinsights.SecurityMLAnalyticsSettingsKindAnomaly): + b = &armsecurityinsights.AnomalySecurityMLAnalyticsSettings{} + default: + b = &armsecurityinsights.SecurityMLAnalyticsSetting{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/productpackage_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/productpackage_server.go new file mode 100644 index 000000000000..721713b19d8c --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/productpackage_server.go @@ -0,0 +1,104 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" + "net/http" + "net/url" + "regexp" +) + +// ProductPackageServer is a fake server for instances of the armsecurityinsights.ProductPackageClient type. +type ProductPackageServer struct { + // Get is the fake for method ProductPackageClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, workspaceName string, packageID string, options *armsecurityinsights.ProductPackageClientGetOptions) (resp azfake.Responder[armsecurityinsights.ProductPackageClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewProductPackageServerTransport creates a new instance of ProductPackageServerTransport with the provided implementation. +// The returned ProductPackageServerTransport instance is connected to an instance of armsecurityinsights.ProductPackageClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewProductPackageServerTransport(srv *ProductPackageServer) *ProductPackageServerTransport { + return &ProductPackageServerTransport{srv: srv} +} + +// ProductPackageServerTransport connects instances of armsecurityinsights.ProductPackageClient to instances of ProductPackageServer. +// Don't use this type directly, use NewProductPackageServerTransport instead. +type ProductPackageServerTransport struct { + srv *ProductPackageServer +} + +// Do implements the policy.Transporter interface for ProductPackageServerTransport. +func (p *ProductPackageServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ProductPackageClient.Get": + resp, err = p.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *ProductPackageServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/contentProductPackages/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + packageIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("packageId")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, workspaceNameParam, packageIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ProductPackageModel, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/productpackages_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/productpackages_server.go new file mode 100644 index 000000000000..b517ef6cb3d4 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/productpackages_server.go @@ -0,0 +1,152 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// ProductPackagesServer is a fake server for instances of the armsecurityinsights.ProductPackagesClient type. +type ProductPackagesServer struct { + // NewListPager is the fake for method ProductPackagesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, workspaceName string, options *armsecurityinsights.ProductPackagesClientListOptions) (resp azfake.PagerResponder[armsecurityinsights.ProductPackagesClientListResponse]) +} + +// NewProductPackagesServerTransport creates a new instance of ProductPackagesServerTransport with the provided implementation. +// The returned ProductPackagesServerTransport instance is connected to an instance of armsecurityinsights.ProductPackagesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewProductPackagesServerTransport(srv *ProductPackagesServer) *ProductPackagesServerTransport { + return &ProductPackagesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurityinsights.ProductPackagesClientListResponse]](), + } +} + +// ProductPackagesServerTransport connects instances of armsecurityinsights.ProductPackagesClient to instances of ProductPackagesServer. +// Don't use this type directly, use NewProductPackagesServerTransport instead. +type ProductPackagesServerTransport struct { + srv *ProductPackagesServer + newListPager *tracker[azfake.PagerResponder[armsecurityinsights.ProductPackagesClientListResponse]] +} + +// Do implements the policy.Transporter interface for ProductPackagesServerTransport. +func (p *ProductPackagesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ProductPackagesClient.NewListPager": + resp, err = p.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *ProductPackagesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := p.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/contentProductPackages` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + orderbyUnescaped, err := url.QueryUnescape(qp.Get("$orderby")) + if err != nil { + return nil, err + } + orderbyParam := getOptional(orderbyUnescaped) + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) + if err != nil { + return nil, err + } + skipTokenParam := getOptional(skipTokenUnescaped) + var options *armsecurityinsights.ProductPackagesClientListOptions + if filterParam != nil || orderbyParam != nil || topParam != nil || skipTokenParam != nil { + options = &armsecurityinsights.ProductPackagesClientListOptions{ + Filter: filterParam, + Orderby: orderbyParam, + Top: topParam, + SkipToken: skipTokenParam, + } + } + resp := p.srv.NewListPager(resourceGroupNameParam, workspaceNameParam, options) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurityinsights.ProductPackagesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + p.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/producttemplate_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/producttemplate_server.go new file mode 100644 index 000000000000..e25b4e877256 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/producttemplate_server.go @@ -0,0 +1,104 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" + "net/http" + "net/url" + "regexp" +) + +// ProductTemplateServer is a fake server for instances of the armsecurityinsights.ProductTemplateClient type. +type ProductTemplateServer struct { + // Get is the fake for method ProductTemplateClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, workspaceName string, templateID string, options *armsecurityinsights.ProductTemplateClientGetOptions) (resp azfake.Responder[armsecurityinsights.ProductTemplateClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewProductTemplateServerTransport creates a new instance of ProductTemplateServerTransport with the provided implementation. +// The returned ProductTemplateServerTransport instance is connected to an instance of armsecurityinsights.ProductTemplateClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewProductTemplateServerTransport(srv *ProductTemplateServer) *ProductTemplateServerTransport { + return &ProductTemplateServerTransport{srv: srv} +} + +// ProductTemplateServerTransport connects instances of armsecurityinsights.ProductTemplateClient to instances of ProductTemplateServer. +// Don't use this type directly, use NewProductTemplateServerTransport instead. +type ProductTemplateServerTransport struct { + srv *ProductTemplateServer +} + +// Do implements the policy.Transporter interface for ProductTemplateServerTransport. +func (p *ProductTemplateServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ProductTemplateClient.Get": + resp, err = p.dispatchGet(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *ProductTemplateServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/contentproducttemplates/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + templateIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("templateId")]) + if err != nil { + return nil, err + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, workspaceNameParam, templateIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ProductTemplateModel, req) + if err != nil { + return nil, err + } + return resp, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/producttemplates_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/producttemplates_server.go new file mode 100644 index 000000000000..05823ced6a8f --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/producttemplates_server.go @@ -0,0 +1,182 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" + "net/http" + "net/url" + "regexp" + "strconv" +) + +// ProductTemplatesServer is a fake server for instances of the armsecurityinsights.ProductTemplatesClient type. +type ProductTemplatesServer struct { + // NewListPager is the fake for method ProductTemplatesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, workspaceName string, options *armsecurityinsights.ProductTemplatesClientListOptions) (resp azfake.PagerResponder[armsecurityinsights.ProductTemplatesClientListResponse]) +} + +// NewProductTemplatesServerTransport creates a new instance of ProductTemplatesServerTransport with the provided implementation. +// The returned ProductTemplatesServerTransport instance is connected to an instance of armsecurityinsights.ProductTemplatesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewProductTemplatesServerTransport(srv *ProductTemplatesServer) *ProductTemplatesServerTransport { + return &ProductTemplatesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurityinsights.ProductTemplatesClientListResponse]](), + } +} + +// ProductTemplatesServerTransport connects instances of armsecurityinsights.ProductTemplatesClient to instances of ProductTemplatesServer. +// Don't use this type directly, use NewProductTemplatesServerTransport instead. +type ProductTemplatesServerTransport struct { + srv *ProductTemplatesServer + newListPager *tracker[azfake.PagerResponder[armsecurityinsights.ProductTemplatesClientListResponse]] +} + +// Do implements the policy.Transporter interface for ProductTemplatesServerTransport. +func (p *ProductTemplatesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "ProductTemplatesClient.NewListPager": + resp, err = p.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (p *ProductTemplatesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := p.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/contentProductTemplates` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) + if err != nil { + return nil, err + } + filterParam := getOptional(filterUnescaped) + orderbyUnescaped, err := url.QueryUnescape(qp.Get("$orderby")) + if err != nil { + return nil, err + } + orderbyParam := getOptional(orderbyUnescaped) + searchUnescaped, err := url.QueryUnescape(qp.Get("$search")) + if err != nil { + return nil, err + } + searchParam := getOptional(searchUnescaped) + countUnescaped, err := url.QueryUnescape(qp.Get("$count")) + if err != nil { + return nil, err + } + countParam, err := parseOptional(countUnescaped, strconv.ParseBool) + if err != nil { + return nil, err + } + topUnescaped, err := url.QueryUnescape(qp.Get("$top")) + if err != nil { + return nil, err + } + topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + skipUnescaped, err := url.QueryUnescape(qp.Get("$skip")) + if err != nil { + return nil, err + } + skipParam, err := parseOptional(skipUnescaped, func(v string) (int32, error) { + p, parseErr := strconv.ParseInt(v, 10, 32) + if parseErr != nil { + return 0, parseErr + } + return int32(p), nil + }) + if err != nil { + return nil, err + } + skipTokenUnescaped, err := url.QueryUnescape(qp.Get("$skipToken")) + if err != nil { + return nil, err + } + skipTokenParam := getOptional(skipTokenUnescaped) + var options *armsecurityinsights.ProductTemplatesClientListOptions + if filterParam != nil || orderbyParam != nil || searchParam != nil || countParam != nil || topParam != nil || skipParam != nil || skipTokenParam != nil { + options = &armsecurityinsights.ProductTemplatesClientListOptions{ + Filter: filterParam, + Orderby: orderbyParam, + Search: searchParam, + Count: countParam, + Top: topParam, + Skip: skipParam, + SkipToken: skipTokenParam, + } + } + resp := p.srv.NewListPager(resourceGroupNameParam, workspaceNameParam, options) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurityinsights.ProductTemplatesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + p.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/securitymlanalyticssettings_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/securitymlanalyticssettings_server.go new file mode 100644 index 000000000000..678668451045 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/securitymlanalyticssettings_server.go @@ -0,0 +1,250 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" + "net/http" + "net/url" + "regexp" +) + +// SecurityMLAnalyticsSettingsServer is a fake server for instances of the armsecurityinsights.SecurityMLAnalyticsSettingsClient type. +type SecurityMLAnalyticsSettingsServer struct { + // CreateOrUpdate is the fake for method SecurityMLAnalyticsSettingsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, workspaceName string, settingsResourceName string, securityMLAnalyticsSetting armsecurityinsights.SecurityMLAnalyticsSettingClassification, options *armsecurityinsights.SecurityMLAnalyticsSettingsClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurityinsights.SecurityMLAnalyticsSettingsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method SecurityMLAnalyticsSettingsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, workspaceName string, settingsResourceName string, options *armsecurityinsights.SecurityMLAnalyticsSettingsClientDeleteOptions) (resp azfake.Responder[armsecurityinsights.SecurityMLAnalyticsSettingsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SecurityMLAnalyticsSettingsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, workspaceName string, settingsResourceName string, options *armsecurityinsights.SecurityMLAnalyticsSettingsClientGetOptions) (resp azfake.Responder[armsecurityinsights.SecurityMLAnalyticsSettingsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method SecurityMLAnalyticsSettingsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, workspaceName string, options *armsecurityinsights.SecurityMLAnalyticsSettingsClientListOptions) (resp azfake.PagerResponder[armsecurityinsights.SecurityMLAnalyticsSettingsClientListResponse]) +} + +// NewSecurityMLAnalyticsSettingsServerTransport creates a new instance of SecurityMLAnalyticsSettingsServerTransport with the provided implementation. +// The returned SecurityMLAnalyticsSettingsServerTransport instance is connected to an instance of armsecurityinsights.SecurityMLAnalyticsSettingsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSecurityMLAnalyticsSettingsServerTransport(srv *SecurityMLAnalyticsSettingsServer) *SecurityMLAnalyticsSettingsServerTransport { + return &SecurityMLAnalyticsSettingsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurityinsights.SecurityMLAnalyticsSettingsClientListResponse]](), + } +} + +// SecurityMLAnalyticsSettingsServerTransport connects instances of armsecurityinsights.SecurityMLAnalyticsSettingsClient to instances of SecurityMLAnalyticsSettingsServer. +// Don't use this type directly, use NewSecurityMLAnalyticsSettingsServerTransport instead. +type SecurityMLAnalyticsSettingsServerTransport struct { + srv *SecurityMLAnalyticsSettingsServer + newListPager *tracker[azfake.PagerResponder[armsecurityinsights.SecurityMLAnalyticsSettingsClientListResponse]] +} + +// Do implements the policy.Transporter interface for SecurityMLAnalyticsSettingsServerTransport. +func (s *SecurityMLAnalyticsSettingsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SecurityMLAnalyticsSettingsClient.CreateOrUpdate": + resp, err = s.dispatchCreateOrUpdate(req) + case "SecurityMLAnalyticsSettingsClient.Delete": + resp, err = s.dispatchDelete(req) + case "SecurityMLAnalyticsSettingsClient.Get": + resp, err = s.dispatchGet(req) + case "SecurityMLAnalyticsSettingsClient.NewListPager": + resp, err = s.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SecurityMLAnalyticsSettingsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/securityMLAnalyticsSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + raw, err := readRequestBody(req) + if err != nil { + return nil, err + } + body, err := unmarshalSecurityMLAnalyticsSettingClassification(raw) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + settingsResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("settingsResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, workspaceNameParam, settingsResourceNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SecurityMLAnalyticsSettingClassification, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SecurityMLAnalyticsSettingsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if s.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/securityMLAnalyticsSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + settingsResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("settingsResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Delete(req.Context(), resourceGroupNameParam, workspaceNameParam, settingsResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SecurityMLAnalyticsSettingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/securityMLAnalyticsSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + settingsResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("settingsResourceName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, workspaceNameParam, settingsResourceNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SecurityMLAnalyticsSettingClassification, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SecurityMLAnalyticsSettingsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := s.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/securityMLAnalyticsSettings` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListPager(resourceGroupNameParam, workspaceNameParam, nil) + newListPager = &resp + s.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurityinsights.SecurityMLAnalyticsSettingsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + s.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/sentinelonboardingstates_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/sentinelonboardingstates_server.go index 062285fb1f6a..70d308f2fdef 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/sentinelonboardingstates_server.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/sentinelonboardingstates_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" "net/http" "net/url" "reflect" diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/server_factory.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/server_factory.go index 22c1c2f5ddea..3716087e517c 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/server_factory.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/server_factory.go @@ -24,12 +24,24 @@ type ServerFactory struct { AlertRulesServer AlertRulesServer AutomationRulesServer AutomationRulesServer BookmarksServer BookmarksServer + ContentPackageServer ContentPackageServer + ContentPackagesServer ContentPackagesServer + ContentTemplateServer ContentTemplateServer + ContentTemplatesServer ContentTemplatesServer DataConnectorsServer DataConnectorsServer IncidentCommentsServer IncidentCommentsServer IncidentRelationsServer IncidentRelationsServer IncidentsServer IncidentsServer + MetadataServer MetadataServer OperationsServer OperationsServer + ProductPackageServer ProductPackageServer + ProductPackagesServer ProductPackagesServer + ProductTemplateServer ProductTemplateServer + ProductTemplatesServer ProductTemplatesServer + SecurityMLAnalyticsSettingsServer SecurityMLAnalyticsSettingsServer SentinelOnboardingStatesServer SentinelOnboardingStatesServer + SourceControlServer SourceControlServer + SourceControlsServer SourceControlsServer ThreatIntelligenceIndicatorServer ThreatIntelligenceIndicatorServer ThreatIntelligenceIndicatorMetricsServer ThreatIntelligenceIndicatorMetricsServer ThreatIntelligenceIndicatorsServer ThreatIntelligenceIndicatorsServer @@ -56,12 +68,24 @@ type ServerFactoryTransport struct { trAlertRulesServer *AlertRulesServerTransport trAutomationRulesServer *AutomationRulesServerTransport trBookmarksServer *BookmarksServerTransport + trContentPackageServer *ContentPackageServerTransport + trContentPackagesServer *ContentPackagesServerTransport + trContentTemplateServer *ContentTemplateServerTransport + trContentTemplatesServer *ContentTemplatesServerTransport trDataConnectorsServer *DataConnectorsServerTransport trIncidentCommentsServer *IncidentCommentsServerTransport trIncidentRelationsServer *IncidentRelationsServerTransport trIncidentsServer *IncidentsServerTransport + trMetadataServer *MetadataServerTransport trOperationsServer *OperationsServerTransport + trProductPackageServer *ProductPackageServerTransport + trProductPackagesServer *ProductPackagesServerTransport + trProductTemplateServer *ProductTemplateServerTransport + trProductTemplatesServer *ProductTemplatesServerTransport + trSecurityMLAnalyticsSettingsServer *SecurityMLAnalyticsSettingsServerTransport trSentinelOnboardingStatesServer *SentinelOnboardingStatesServerTransport + trSourceControlServer *SourceControlServerTransport + trSourceControlsServer *SourceControlsServerTransport trThreatIntelligenceIndicatorServer *ThreatIntelligenceIndicatorServerTransport trThreatIntelligenceIndicatorMetricsServer *ThreatIntelligenceIndicatorMetricsServerTransport trThreatIntelligenceIndicatorsServer *ThreatIntelligenceIndicatorsServerTransport @@ -101,6 +125,26 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "BookmarksClient": initServer(s, &s.trBookmarksServer, func() *BookmarksServerTransport { return NewBookmarksServerTransport(&s.srv.BookmarksServer) }) resp, err = s.trBookmarksServer.Do(req) + case "ContentPackageClient": + initServer(s, &s.trContentPackageServer, func() *ContentPackageServerTransport { + return NewContentPackageServerTransport(&s.srv.ContentPackageServer) + }) + resp, err = s.trContentPackageServer.Do(req) + case "ContentPackagesClient": + initServer(s, &s.trContentPackagesServer, func() *ContentPackagesServerTransport { + return NewContentPackagesServerTransport(&s.srv.ContentPackagesServer) + }) + resp, err = s.trContentPackagesServer.Do(req) + case "ContentTemplateClient": + initServer(s, &s.trContentTemplateServer, func() *ContentTemplateServerTransport { + return NewContentTemplateServerTransport(&s.srv.ContentTemplateServer) + }) + resp, err = s.trContentTemplateServer.Do(req) + case "ContentTemplatesClient": + initServer(s, &s.trContentTemplatesServer, func() *ContentTemplatesServerTransport { + return NewContentTemplatesServerTransport(&s.srv.ContentTemplatesServer) + }) + resp, err = s.trContentTemplatesServer.Do(req) case "DataConnectorsClient": initServer(s, &s.trDataConnectorsServer, func() *DataConnectorsServerTransport { return NewDataConnectorsServerTransport(&s.srv.DataConnectorsServer) @@ -119,14 +163,52 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "IncidentsClient": initServer(s, &s.trIncidentsServer, func() *IncidentsServerTransport { return NewIncidentsServerTransport(&s.srv.IncidentsServer) }) resp, err = s.trIncidentsServer.Do(req) + case "MetadataClient": + initServer(s, &s.trMetadataServer, func() *MetadataServerTransport { return NewMetadataServerTransport(&s.srv.MetadataServer) }) + resp, err = s.trMetadataServer.Do(req) case "OperationsClient": initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) + case "ProductPackageClient": + initServer(s, &s.trProductPackageServer, func() *ProductPackageServerTransport { + return NewProductPackageServerTransport(&s.srv.ProductPackageServer) + }) + resp, err = s.trProductPackageServer.Do(req) + case "ProductPackagesClient": + initServer(s, &s.trProductPackagesServer, func() *ProductPackagesServerTransport { + return NewProductPackagesServerTransport(&s.srv.ProductPackagesServer) + }) + resp, err = s.trProductPackagesServer.Do(req) + case "ProductTemplateClient": + initServer(s, &s.trProductTemplateServer, func() *ProductTemplateServerTransport { + return NewProductTemplateServerTransport(&s.srv.ProductTemplateServer) + }) + resp, err = s.trProductTemplateServer.Do(req) + case "ProductTemplatesClient": + initServer(s, &s.trProductTemplatesServer, func() *ProductTemplatesServerTransport { + return NewProductTemplatesServerTransport(&s.srv.ProductTemplatesServer) + }) + resp, err = s.trProductTemplatesServer.Do(req) + case "SecurityMLAnalyticsSettingsClient": + initServer(s, &s.trSecurityMLAnalyticsSettingsServer, func() *SecurityMLAnalyticsSettingsServerTransport { + return NewSecurityMLAnalyticsSettingsServerTransport(&s.srv.SecurityMLAnalyticsSettingsServer) + }) + resp, err = s.trSecurityMLAnalyticsSettingsServer.Do(req) case "SentinelOnboardingStatesClient": initServer(s, &s.trSentinelOnboardingStatesServer, func() *SentinelOnboardingStatesServerTransport { return NewSentinelOnboardingStatesServerTransport(&s.srv.SentinelOnboardingStatesServer) }) resp, err = s.trSentinelOnboardingStatesServer.Do(req) + case "SourceControlClient": + initServer(s, &s.trSourceControlServer, func() *SourceControlServerTransport { + return NewSourceControlServerTransport(&s.srv.SourceControlServer) + }) + resp, err = s.trSourceControlServer.Do(req) + case "SourceControlsClient": + initServer(s, &s.trSourceControlsServer, func() *SourceControlsServerTransport { + return NewSourceControlsServerTransport(&s.srv.SourceControlsServer) + }) + resp, err = s.trSourceControlsServer.Do(req) case "ThreatIntelligenceIndicatorClient": initServer(s, &s.trThreatIntelligenceIndicatorServer, func() *ThreatIntelligenceIndicatorServerTransport { return NewThreatIntelligenceIndicatorServerTransport(&s.srv.ThreatIntelligenceIndicatorServer) diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/sourcecontrol_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/sourcecontrol_server.go new file mode 100644 index 000000000000..77c6d098c754 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/sourcecontrol_server.go @@ -0,0 +1,116 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" + "net/http" + "net/url" + "regexp" +) + +// SourceControlServer is a fake server for instances of the armsecurityinsights.SourceControlClient type. +type SourceControlServer struct { + // NewListRepositoriesPager is the fake for method SourceControlClient.NewListRepositoriesPager + // HTTP status codes to indicate success: http.StatusOK + NewListRepositoriesPager func(resourceGroupName string, workspaceName string, repositoryAccess armsecurityinsights.RepositoryAccessProperties, options *armsecurityinsights.SourceControlClientListRepositoriesOptions) (resp azfake.PagerResponder[armsecurityinsights.SourceControlClientListRepositoriesResponse]) +} + +// NewSourceControlServerTransport creates a new instance of SourceControlServerTransport with the provided implementation. +// The returned SourceControlServerTransport instance is connected to an instance of armsecurityinsights.SourceControlClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSourceControlServerTransport(srv *SourceControlServer) *SourceControlServerTransport { + return &SourceControlServerTransport{ + srv: srv, + newListRepositoriesPager: newTracker[azfake.PagerResponder[armsecurityinsights.SourceControlClientListRepositoriesResponse]](), + } +} + +// SourceControlServerTransport connects instances of armsecurityinsights.SourceControlClient to instances of SourceControlServer. +// Don't use this type directly, use NewSourceControlServerTransport instead. +type SourceControlServerTransport struct { + srv *SourceControlServer + newListRepositoriesPager *tracker[azfake.PagerResponder[armsecurityinsights.SourceControlClientListRepositoriesResponse]] +} + +// Do implements the policy.Transporter interface for SourceControlServerTransport. +func (s *SourceControlServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SourceControlClient.NewListRepositoriesPager": + resp, err = s.dispatchNewListRepositoriesPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SourceControlServerTransport) dispatchNewListRepositoriesPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListRepositoriesPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListRepositoriesPager not implemented")} + } + newListRepositoriesPager := s.newListRepositoriesPager.get(req) + if newListRepositoriesPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/listRepositories` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurityinsights.RepositoryAccessProperties](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListRepositoriesPager(resourceGroupNameParam, workspaceNameParam, body, nil) + newListRepositoriesPager = &resp + s.newListRepositoriesPager.add(req, newListRepositoriesPager) + server.PagerResponderInjectNextLinks(newListRepositoriesPager, req, func(page *armsecurityinsights.SourceControlClientListRepositoriesResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListRepositoriesPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListRepositoriesPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListRepositoriesPager) { + s.newListRepositoriesPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/sourcecontrols_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/sourcecontrols_server.go new file mode 100644 index 000000000000..2200979250f5 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/sourcecontrols_server.go @@ -0,0 +1,250 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" + "net/http" + "net/url" + "regexp" +) + +// SourceControlsServer is a fake server for instances of the armsecurityinsights.SourceControlsClient type. +type SourceControlsServer struct { + // Create is the fake for method SourceControlsClient.Create + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Create func(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string, sourceControl armsecurityinsights.SourceControl, options *armsecurityinsights.SourceControlsClientCreateOptions) (resp azfake.Responder[armsecurityinsights.SourceControlsClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method SourceControlsClient.Delete + // HTTP status codes to indicate success: http.StatusOK + Delete func(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string, repositoryAccess armsecurityinsights.RepositoryAccessProperties, options *armsecurityinsights.SourceControlsClientDeleteOptions) (resp azfake.Responder[armsecurityinsights.SourceControlsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SourceControlsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string, options *armsecurityinsights.SourceControlsClientGetOptions) (resp azfake.Responder[armsecurityinsights.SourceControlsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method SourceControlsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, workspaceName string, options *armsecurityinsights.SourceControlsClientListOptions) (resp azfake.PagerResponder[armsecurityinsights.SourceControlsClientListResponse]) +} + +// NewSourceControlsServerTransport creates a new instance of SourceControlsServerTransport with the provided implementation. +// The returned SourceControlsServerTransport instance is connected to an instance of armsecurityinsights.SourceControlsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSourceControlsServerTransport(srv *SourceControlsServer) *SourceControlsServerTransport { + return &SourceControlsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurityinsights.SourceControlsClientListResponse]](), + } +} + +// SourceControlsServerTransport connects instances of armsecurityinsights.SourceControlsClient to instances of SourceControlsServer. +// Don't use this type directly, use NewSourceControlsServerTransport instead. +type SourceControlsServerTransport struct { + srv *SourceControlsServer + newListPager *tracker[azfake.PagerResponder[armsecurityinsights.SourceControlsClientListResponse]] +} + +// Do implements the policy.Transporter interface for SourceControlsServerTransport. +func (s *SourceControlsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + var resp *http.Response + var err error + + switch method { + case "SourceControlsClient.Create": + resp, err = s.dispatchCreate(req) + case "SourceControlsClient.Delete": + resp, err = s.dispatchDelete(req) + case "SourceControlsClient.Get": + resp, err = s.dispatchGet(req) + case "SourceControlsClient.NewListPager": + resp, err = s.dispatchNewListPager(req) + default: + err = fmt.Errorf("unhandled API %s", method) + } + + if err != nil { + return nil, err + } + + return resp, nil +} + +func (s *SourceControlsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if s.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/sourcecontrols/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurityinsights.SourceControl](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + sourceControlIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("sourceControlId")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Create(req.Context(), resourceGroupNameParam, workspaceNameParam, sourceControlIDParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SourceControl, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SourceControlsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if s.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/sourcecontrols/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/delete` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurityinsights.RepositoryAccessProperties](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + sourceControlIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("sourceControlId")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Delete(req.Context(), resourceGroupNameParam, workspaceNameParam, sourceControlIDParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Warning, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SourceControlsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/sourcecontrols/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + sourceControlIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("sourceControlId")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, workspaceNameParam, sourceControlIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SourceControl, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SourceControlsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := s.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.OperationalInsights/workspaces/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.SecurityInsights/sourcecontrols` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if matches == nil || len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + workspaceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListPager(resourceGroupNameParam, workspaceNameParam, nil) + newListPager = &resp + s.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurityinsights.SourceControlsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + s.newListPager.remove(req) + } + return resp, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/threatintelligenceindicator_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/threatintelligenceindicator_server.go index d0f66dc74ae5..8aea153a5f09 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/threatintelligenceindicator_server.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/threatintelligenceindicator_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/threatintelligenceindicatormetrics_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/threatintelligenceindicatormetrics_server.go index 8a9b08de8cc3..c00038ab36df 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/threatintelligenceindicatormetrics_server.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/threatintelligenceindicatormetrics_server.go @@ -15,7 +15,7 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/threatintelligenceindicators_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/threatintelligenceindicators_server.go index 780dae918704..1e9fc07434a9 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/threatintelligenceindicators_server.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/threatintelligenceindicators_server.go @@ -15,7 +15,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/watchlistitems_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/watchlistitems_server.go index f061d383be3c..652fa1e2a321 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/watchlistitems_server.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/watchlistitems_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/watchlists_server.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/watchlists_server.go index 0a4f0248a9a8..a31a91e06271 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/watchlists_server.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/fake/watchlists_server.go @@ -16,7 +16,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2" "net/http" "net/url" "regexp" diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/go.mod b/sdk/resourcemanager/securityinsights/armsecurityinsights/go.mod index 5181c0ee5b5f..dd7c876e837f 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/go.mod +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/go.mod @@ -1,21 +1,11 @@ -module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights +module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights/v2 go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 // indirect - github.com/golang-jwt/jwt/v5 v5.0.0 // indirect - github.com/google/uuid v1.3.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect - golang.org/x/crypto v0.14.0 // indirect golang.org/x/net v0.17.0 // indirect - golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect ) diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/go.sum b/sdk/resourcemanager/securityinsights/armsecurityinsights/go.sum index 7985f1da436f..428cd71de305 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/go.sum +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/go.sum @@ -1,31 +1,12 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0 h1:fb8kj/Dh4CSwgsOzHeZY4Xh68cFVbzXx+ONXGMY//4w= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.0/go.mod h1:uReU2sSxZExRPBAg3qKzmAucSi51+SP1OhohieR821Q= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0 h1:BMAjVKJM0U/CYF27gA0ZMmXGkOcvfFtD0oHVZ1TIPRI= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.4.0/go.mod h1:1fXstnBMas5kzG+S3q8UoJcmyU6nUeunJcMDHcRYHhs= github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0 h1:d81/ng9rET2YqdVkVwkb6EXeRrLJIwyGnJcAlAWKwhs= github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.0/go.mod h1:s4kgfzA0covAXNicZHDMN58jExvcng2mC/DepXiF1EI= -github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1 h1:WpB/QDNLpMw72xHJc34BNNykqSOeEJDAWkhf0u12/Jk= -github.com/AzureAD/microsoft-authentication-library-for-go v1.1.1/go.mod h1:wP83P5OoQ5p6ip3ScPr0BAq0BvuPAvacpEuSzyouqAI= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.2.0 h1:zHCHvJYTMh1N7xnV7zf1m1GPBF9Ad0Jk/whtQ1663qI= -github.com/golang-jwt/jwt/v5 v5.0.0 h1:1n1XNM9hk7O9mnQoNBGolZvzebBQ7p93ULHRc28XJUE= -github.com/golang-jwt/jwt/v5 v5.0.0/go.mod h1:pqrtFR0X4osieyHYxtmOUWsAWrfe1Q5UVIyoH402zdk= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU= -github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentcomments_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentcomments_client.go index 95152f81f525..aa4c027144eb 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentcomments_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentcomments_client.go @@ -47,7 +47,7 @@ func NewIncidentCommentsClient(subscriptionID string, credential azcore.TokenCre // CreateOrUpdate - Creates or updates a comment for a given incident. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - incidentID - Incident ID @@ -105,7 +105,7 @@ func (client *IncidentCommentsClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, incidentComment); err != nil { @@ -126,7 +126,7 @@ func (client *IncidentCommentsClient) createOrUpdateHandleResponse(resp *http.Re // Delete - Deletes a comment for a given incident. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - incidentID - Incident ID @@ -181,7 +181,7 @@ func (client *IncidentCommentsClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -190,7 +190,7 @@ func (client *IncidentCommentsClient) deleteCreateRequest(ctx context.Context, r // Get - Gets a comment for a given incident. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - incidentID - Incident ID @@ -246,7 +246,7 @@ func (client *IncidentCommentsClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -263,7 +263,7 @@ func (client *IncidentCommentsClient) getHandleResponse(resp *http.Response) (In // NewListPager - Gets all comments for a given incident. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - incidentID - Incident ID @@ -316,7 +316,7 @@ func (client *IncidentCommentsClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentcomments_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentcomments_client_example_test.go deleted file mode 100644 index f3b2872e226a..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentcomments_client_example_test.go +++ /dev/null @@ -1,163 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/incidents/comments/GetAllIncidentComments.json -func ExampleIncidentCommentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIncidentCommentsClient().NewListPager("myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", &armsecurityinsights.IncidentCommentsClientListOptions{Filter: nil, - Orderby: nil, - Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.IncidentCommentList = armsecurityinsights.IncidentCommentList{ - // Value: []*armsecurityinsights.IncidentComment{ - // { - // Name: to.Ptr("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014"), - // Type: to.Ptr("Microsoft.SecurityInsights/incidents/comments"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/73e01a99-5cd7-4139-a149-9f2736ff2ab5/comments/4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014"), - // Etag: to.Ptr("0300bf09-0000-0000-0000-5c37296e0000"), - // Properties: &armsecurityinsights.IncidentCommentProperties{ - // Author: &armsecurityinsights.ClientInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john.doe@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // UserPrincipalName: to.Ptr("john@contoso.com"), - // }, - // CreatedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // LastModifiedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // Message: to.Ptr("Some message"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/incidents/comments/GetIncidentCommentById.json -func ExampleIncidentCommentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIncidentCommentsClient().Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.IncidentComment = armsecurityinsights.IncidentComment{ - // Name: to.Ptr("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014"), - // Type: to.Ptr("Microsoft.SecurityInsights/incidents/comments"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/73e01a99-5cd7-4139-a149-9f2736ff2ab5/comments/4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014"), - // Etag: to.Ptr("0300bf09-0000-0000-0000-5c37296e0000"), - // Properties: &armsecurityinsights.IncidentCommentProperties{ - // Author: &armsecurityinsights.ClientInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john.doe@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // UserPrincipalName: to.Ptr("john@contoso.com"), - // }, - // CreatedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // LastModifiedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // Message: to.Ptr("Some message"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/incidents/comments/CreateIncidentComment.json -func ExampleIncidentCommentsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIncidentCommentsClient().CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", armsecurityinsights.IncidentComment{ - Properties: &armsecurityinsights.IncidentCommentProperties{ - Message: to.Ptr("Some message"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.IncidentComment = armsecurityinsights.IncidentComment{ - // Name: to.Ptr("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014"), - // Type: to.Ptr("Microsoft.SecurityInsights/incidents/comments"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/73e01a99-5cd7-4139-a149-9f2736ff2ab5/comments/4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014"), - // Etag: to.Ptr("0300bf09-0000-0000-0000-5c37296e0000"), - // Properties: &armsecurityinsights.IncidentCommentProperties{ - // Author: &armsecurityinsights.ClientInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john.doe@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // UserPrincipalName: to.Ptr("john@contoso.com"), - // }, - // CreatedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // LastModifiedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-04T13:15:30.000Z"); return t}()), - // Message: to.Ptr("Some message"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/incidents/comments/DeleteIncidentComment.json -func ExampleIncidentCommentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewIncidentCommentsClient().Delete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentrelations_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentrelations_client.go index 94fb8b9cf53c..9cb500dfa06c 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentrelations_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentrelations_client.go @@ -47,7 +47,7 @@ func NewIncidentRelationsClient(subscriptionID string, credential azcore.TokenCr // CreateOrUpdate - Creates or updates a relation for a given incident. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - incidentID - Incident ID @@ -105,7 +105,7 @@ func (client *IncidentRelationsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, relation); err != nil { @@ -126,7 +126,7 @@ func (client *IncidentRelationsClient) createOrUpdateHandleResponse(resp *http.R // Delete - Deletes a relation for a given incident. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - incidentID - Incident ID @@ -182,7 +182,7 @@ func (client *IncidentRelationsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -191,7 +191,7 @@ func (client *IncidentRelationsClient) deleteCreateRequest(ctx context.Context, // Get - Gets a relation for a given incident. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - incidentID - Incident ID @@ -247,7 +247,7 @@ func (client *IncidentRelationsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -264,7 +264,7 @@ func (client *IncidentRelationsClient) getHandleResponse(resp *http.Response) (I // NewListPager - Gets all relations for a given incident. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - incidentID - Incident ID @@ -317,7 +317,7 @@ func (client *IncidentRelationsClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentrelations_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentrelations_client_example_test.go deleted file mode 100644 index 3ec39d5cfe8d..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/incidentrelations_client_example_test.go +++ /dev/null @@ -1,157 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/incidents/relations/GetAllIncidentRelations.json -func ExampleIncidentRelationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIncidentRelationsClient().NewListPager("myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", &armsecurityinsights.IncidentRelationsClientListOptions{Filter: nil, - Orderby: nil, - Top: nil, - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.RelationList = armsecurityinsights.RelationList{ - // Value: []*armsecurityinsights.Relation{ - // { - // Name: to.Ptr("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014"), - // Type: to.Ptr("Microsoft.SecurityInsights/incidents/relations"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/afbd324f-6c48-459c-8710-8d1e1cd03812/relations/4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014"), - // Etag: to.Ptr("190057d0-0000-0d00-0000-5c6f5adb0000"), - // Properties: &armsecurityinsights.RelationProperties{ - // RelatedResourceID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/bookmarks/2216d0e1-91e3-4902-89fd-d2df8c535096"), - // RelatedResourceName: to.Ptr("2216d0e1-91e3-4902-89fd-d2df8c535096"), - // RelatedResourceType: to.Ptr("Microsoft.SecurityInsights/bookmarks"), - // }, - // }, - // { - // Name: to.Ptr("9673a17d-8bc7-4ca6-88ee-38a4f3efc032"), - // Type: to.Ptr("Microsoft.SecurityInsights/incidents/relations"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/afbd324f-6c48-459c-8710-8d1e1cd03812/relations/9673a17d-8bc7-4ca6-88ee-38a4f3efc032"), - // Etag: to.Ptr("6f714025-dd7c-46aa-b5d0-b9857488d060"), - // Properties: &armsecurityinsights.RelationProperties{ - // RelatedResourceID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/entities/1dd267cd-8a1f-4f6f-b92c-da43ac8819af"), - // RelatedResourceKind: to.Ptr("SecurityAlert"), - // RelatedResourceName: to.Ptr("1dd267cd-8a1f-4f6f-b92c-da43ac8819af"), - // RelatedResourceType: to.Ptr("Microsoft.SecurityInsights/entities"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/incidents/relations/GetIncidentRelationByName.json -func ExampleIncidentRelationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIncidentRelationsClient().Get(ctx, "myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Relation = armsecurityinsights.Relation{ - // Name: to.Ptr("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014"), - // Type: to.Ptr("Microsoft.SecurityInsights/incidents/relations"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/afbd324f-6c48-459c-8710-8d1e1cd03812/relations/4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014"), - // Etag: to.Ptr("190057d0-0000-0d00-0000-5c6f5adb0000"), - // Properties: &armsecurityinsights.RelationProperties{ - // RelatedResourceID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/bookmarks/2216d0e1-91e3-4902-89fd-d2df8c535096"), - // RelatedResourceName: to.Ptr("2216d0e1-91e3-4902-89fd-d2df8c535096"), - // RelatedResourceType: to.Ptr("Microsoft.SecurityInsights/bookmarks"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/incidents/relations/CreateIncidentRelation.json -func ExampleIncidentRelationsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIncidentRelationsClient().CreateOrUpdate(ctx, "myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", armsecurityinsights.Relation{ - Properties: &armsecurityinsights.RelationProperties{ - RelatedResourceID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/bookmarks/2216d0e1-91e3-4902-89fd-d2df8c535096"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Relation = armsecurityinsights.Relation{ - // Name: to.Ptr("4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014"), - // Type: to.Ptr("Microsoft.SecurityInsights/incidents/relations"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/afbd324f-6c48-459c-8710-8d1e1cd03812/relations/4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014"), - // Etag: to.Ptr("190057d0-0000-0d00-0000-5c6f5adb0000"), - // Properties: &armsecurityinsights.RelationProperties{ - // RelatedResourceID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/bookmarks/2216d0e1-91e3-4902-89fd-d2df8c535096"), - // RelatedResourceName: to.Ptr("2216d0e1-91e3-4902-89fd-d2df8c535096"), - // RelatedResourceType: to.Ptr("Microsoft.SecurityInsights/bookmarks"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/incidents/relations/DeleteIncidentRelation.json -func ExampleIncidentRelationsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewIncidentRelationsClient().Delete(ctx, "myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", "4bb36b7b-26ff-4d1c-9cbe-0d8ab3da0014", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/incidents_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidents_client.go index 6dbc3a042263..b64c47057ff7 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/incidents_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidents_client.go @@ -47,7 +47,7 @@ func NewIncidentsClient(subscriptionID string, credential azcore.TokenCredential // CreateOrUpdate - Creates or updates an incident. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - incidentID - Incident ID @@ -100,7 +100,7 @@ func (client *IncidentsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, incident); err != nil { @@ -121,7 +121,7 @@ func (client *IncidentsClient) createOrUpdateHandleResponse(resp *http.Response) // Delete - Deletes a given incident. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - incidentID - Incident ID @@ -171,7 +171,7 @@ func (client *IncidentsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -180,7 +180,7 @@ func (client *IncidentsClient) deleteCreateRequest(ctx context.Context, resource // Get - Gets a given incident. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - incidentID - Incident ID @@ -231,7 +231,7 @@ func (client *IncidentsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -248,7 +248,7 @@ func (client *IncidentsClient) getHandleResponse(resp *http.Response) (Incidents // NewListPager - Gets all incidents. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - options - IncidentsClientListOptions contains the optional parameters for the IncidentsClient.NewListPager method. @@ -295,7 +295,7 @@ func (client *IncidentsClient) listCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -325,7 +325,7 @@ func (client *IncidentsClient) listHandleResponse(resp *http.Response) (Incident // ListAlerts - Gets all alerts for an incident. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - incidentID - Incident ID @@ -376,7 +376,7 @@ func (client *IncidentsClient) listAlertsCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -394,7 +394,7 @@ func (client *IncidentsClient) listAlertsHandleResponse(resp *http.Response) (In // ListBookmarks - Gets all bookmarks for an incident. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - incidentID - Incident ID @@ -445,7 +445,7 @@ func (client *IncidentsClient) listBookmarksCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -463,7 +463,7 @@ func (client *IncidentsClient) listBookmarksHandleResponse(resp *http.Response) // ListEntities - Gets all entities for an incident. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - incidentID - Incident ID @@ -514,7 +514,7 @@ func (client *IncidentsClient) listEntitiesCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/incidents_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/incidents_client_example_test.go deleted file mode 100644 index 18b73f182846..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/incidents_client_example_test.go +++ /dev/null @@ -1,428 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/incidents/GetIncidents.json -func ExampleIncidentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewIncidentsClient().NewListPager("myRg", "myWorkspace", &armsecurityinsights.IncidentsClientListOptions{Filter: nil, - Orderby: to.Ptr("properties/createdTimeUtc desc"), - Top: to.Ptr[int32](1), - SkipToken: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.IncidentList = armsecurityinsights.IncidentList{ - // Value: []*armsecurityinsights.Incident{ - // { - // Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Type: to.Ptr("Microsoft.SecurityInsights/incidents"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Properties: &armsecurityinsights.IncidentProperties{ - // Description: to.Ptr("This is a demo incident"), - // AdditionalData: &armsecurityinsights.IncidentAdditionalData{ - // AlertProductNames: []*string{ - // }, - // AlertsCount: to.Ptr[int32](0), - // BookmarksCount: to.Ptr[int32](0), - // CommentsCount: to.Ptr[int32](3), - // Tactics: []*armsecurityinsights.AttackTactic{ - // to.Ptr(armsecurityinsights.AttackTacticPersistence)}, - // }, - // Classification: to.Ptr(armsecurityinsights.IncidentClassificationFalsePositive), - // ClassificationComment: to.Ptr("Not a malicious activity"), - // ClassificationReason: to.Ptr(armsecurityinsights.IncidentClassificationReasonIncorrectAlertLogic), - // CreatedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // FirstActivityTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:00:30.000Z"); return t}()), - // IncidentNumber: to.Ptr[int32](3177), - // IncidentURL: to.Ptr("https://portal.azure.com/#asset/Microsoft_Azure_Security_Insights/Incident/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Labels: []*armsecurityinsights.IncidentLabel{ - // }, - // LastActivityTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:05:30.000Z"); return t}()), - // LastModifiedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // Owner: &armsecurityinsights.IncidentOwnerInfo{ - // AssignedTo: to.Ptr("john doe"), - // Email: to.Ptr("john.doe@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // UserPrincipalName: to.Ptr("john@contoso.com"), - // }, - // RelatedAnalyticRuleIDs: []*string{ - // to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/fab3d2d4-747f-46a7-8ef0-9c0be8112bf7"), - // to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/8deb8303-e94d-46ff-96e0-5fd94b33df1a")}, - // Severity: to.Ptr(armsecurityinsights.IncidentSeverityHigh), - // Status: to.Ptr(armsecurityinsights.IncidentStatusClosed), - // Title: to.Ptr("My incident"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/incidents/GetIncidentById.json -func ExampleIncidentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIncidentsClient().Get(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Incident = armsecurityinsights.Incident{ - // Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Type: to.Ptr("Microsoft.SecurityInsights/incidents"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Properties: &armsecurityinsights.IncidentProperties{ - // Description: to.Ptr("This is a demo incident"), - // AdditionalData: &armsecurityinsights.IncidentAdditionalData{ - // AlertProductNames: []*string{ - // }, - // AlertsCount: to.Ptr[int32](0), - // BookmarksCount: to.Ptr[int32](0), - // CommentsCount: to.Ptr[int32](3), - // Tactics: []*armsecurityinsights.AttackTactic{ - // to.Ptr(armsecurityinsights.AttackTacticInitialAccess), - // to.Ptr(armsecurityinsights.AttackTacticPersistence)}, - // }, - // Classification: to.Ptr(armsecurityinsights.IncidentClassificationFalsePositive), - // ClassificationComment: to.Ptr("Not a malicious activity"), - // ClassificationReason: to.Ptr(armsecurityinsights.IncidentClassificationReasonInaccurateData), - // CreatedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // FirstActivityTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:00:30.000Z"); return t}()), - // IncidentNumber: to.Ptr[int32](3177), - // IncidentURL: to.Ptr("https://portal.azure.com/#asset/Microsoft_Azure_Security_Insights/Incident/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Labels: []*armsecurityinsights.IncidentLabel{ - // }, - // LastActivityTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:05:30.000Z"); return t}()), - // LastModifiedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // Owner: &armsecurityinsights.IncidentOwnerInfo{ - // AssignedTo: to.Ptr("john doe"), - // Email: to.Ptr("john.doe@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // UserPrincipalName: to.Ptr("john@contoso.com"), - // }, - // RelatedAnalyticRuleIDs: []*string{ - // to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/alertRules/fab3d2d4-747f-46a7-8ef0-9c0be8112bf7")}, - // Severity: to.Ptr(armsecurityinsights.IncidentSeverityHigh), - // Status: to.Ptr(armsecurityinsights.IncidentStatusClosed), - // Title: to.Ptr("My incident"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/incidents/CreateIncident.json -func ExampleIncidentsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIncidentsClient().CreateOrUpdate(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", armsecurityinsights.Incident{ - Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - Properties: &armsecurityinsights.IncidentProperties{ - Description: to.Ptr("This is a demo incident"), - Classification: to.Ptr(armsecurityinsights.IncidentClassificationFalsePositive), - ClassificationComment: to.Ptr("Not a malicious activity"), - ClassificationReason: to.Ptr(armsecurityinsights.IncidentClassificationReasonIncorrectAlertLogic), - FirstActivityTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:00:30.000Z"); return t }()), - LastActivityTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:05:30.000Z"); return t }()), - Owner: &armsecurityinsights.IncidentOwnerInfo{ - ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - }, - Severity: to.Ptr(armsecurityinsights.IncidentSeverityHigh), - Status: to.Ptr(armsecurityinsights.IncidentStatusClosed), - Title: to.Ptr("My incident"), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Incident = armsecurityinsights.Incident{ - // Name: to.Ptr("73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Type: to.Ptr("Microsoft.SecurityInsights/incidents"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0001\""), - // Properties: &armsecurityinsights.IncidentProperties{ - // Description: to.Ptr("This is a demo incident"), - // AdditionalData: &armsecurityinsights.IncidentAdditionalData{ - // AlertProductNames: []*string{ - // }, - // AlertsCount: to.Ptr[int32](0), - // BookmarksCount: to.Ptr[int32](0), - // CommentsCount: to.Ptr[int32](3), - // Tactics: []*armsecurityinsights.AttackTactic{ - // }, - // }, - // Classification: to.Ptr(armsecurityinsights.IncidentClassificationFalsePositive), - // ClassificationComment: to.Ptr("Not a malicious activity"), - // ClassificationReason: to.Ptr(armsecurityinsights.IncidentClassificationReasonIncorrectAlertLogic), - // CreatedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // FirstActivityTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:00:30.000Z"); return t}()), - // IncidentNumber: to.Ptr[int32](3177), - // IncidentURL: to.Ptr("https://portal.azure.com/#asset/Microsoft_Azure_Security_Insights/Incident/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/incidents/73e01a99-5cd7-4139-a149-9f2736ff2ab5"), - // Labels: []*armsecurityinsights.IncidentLabel{ - // }, - // LastActivityTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:05:30.000Z"); return t}()), - // LastModifiedTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-01-01T13:15:30.000Z"); return t}()), - // Owner: &armsecurityinsights.IncidentOwnerInfo{ - // AssignedTo: to.Ptr("john doe"), - // Email: to.Ptr("john.doe@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // UserPrincipalName: to.Ptr("john@contoso.com"), - // }, - // RelatedAnalyticRuleIDs: []*string{ - // }, - // Severity: to.Ptr(armsecurityinsights.IncidentSeverityHigh), - // Status: to.Ptr(armsecurityinsights.IncidentStatusClosed), - // Title: to.Ptr("My incident"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/incidents/DeleteIncident.json -func ExampleIncidentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewIncidentsClient().Delete(ctx, "myRg", "myWorkspace", "73e01a99-5cd7-4139-a149-9f2736ff2ab5", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/incidents/GetAllIncidentAlerts.json -func ExampleIncidentsClient_ListAlerts() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIncidentsClient().ListAlerts(ctx, "myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.IncidentAlertList = armsecurityinsights.IncidentAlertList{ - // Value: []*armsecurityinsights.SecurityAlert{ - // { - // Name: to.Ptr("baa8a239-6fde-4ab7-a093-d09f7b75c58c"), - // Type: to.Ptr("Microsoft.SecurityInsights/Entities"), - // ID: to.Ptr("/subscriptions/bd794837-4d29-4647-9105-6339bfdb4e6a/resourceGroups/myRG/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/Entities/baa8a239-6fde-4ab7-a093-d09f7b75c58c"), - // Kind: to.Ptr(armsecurityinsights.EntityKindEnumSecurityAlert), - // Properties: &armsecurityinsights.SecurityAlertProperties{ - // AdditionalData: map[string]any{ - // "AlertMessageEnqueueTime": "2020-07-20T18:21:57.304Z", - // }, - // FriendlyName: to.Ptr("myAlert"), - // AlertDisplayName: to.Ptr("myAlert"), - // AlertType: to.Ptr("myAlert"), - // ConfidenceLevel: to.Ptr(armsecurityinsights.ConfidenceLevelUnknown), - // EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-07-20T18:21:53.615Z"); return t}()), - // ProcessingEndTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-07-20T18:21:53.615Z"); return t}()), - // ProductName: to.Ptr("Azure Security Center"), - // ResourceIdentifiers: []any{ - // map[string]any{ - // "type": "LogAnalytics", - // "resourceGroup": "myRG", - // "subscriptionId": "bd794837-4d29-4647-9105-6339bfdb4e6a", - // "workspaceId": "c8c99641-985d-4e4e-8e91-fb3466cd0e5b", - // }}, - // Severity: to.Ptr(armsecurityinsights.AlertSeverityLow), - // StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-07-20T18:21:53.615Z"); return t}()), - // Status: to.Ptr(armsecurityinsights.AlertStatusNew), - // SystemAlertID: to.Ptr("baa8a239-6fde-4ab7-a093-d09f7b75c58c"), - // Tactics: []*armsecurityinsights.AttackTactic{ - // }, - // TimeGenerated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-07-20T18:21:53.615Z"); return t}()), - // VendorName: to.Ptr("Microsoft"), - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/incidents/GetAllIncidentBookmarks.json -func ExampleIncidentsClient_ListBookmarks() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIncidentsClient().ListBookmarks(ctx, "myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.IncidentBookmarkList = armsecurityinsights.IncidentBookmarkList{ - // Value: []*armsecurityinsights.HuntingBookmark{ - // { - // Name: to.Ptr("afbd324f-6c48-459c-8710-8d1e1cd03812"), - // Type: to.Ptr("Microsoft.SecurityInsights/Entities"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/bookmarks/afbd324f-6c48-459c-8710-8d1e1cd03812"), - // Kind: to.Ptr(armsecurityinsights.EntityKindEnumBookmark), - // Properties: &armsecurityinsights.HuntingBookmarkProperties{ - // AdditionalData: map[string]any{ - // "ETag": "\"3b00acab-0000-0d00-0000-5f15e4ed0000\"", - // "EntityId": "afbd324f-6c48-459c-8710-8d1e1cd03812", - // }, - // FriendlyName: to.Ptr("SecurityEvent - 868f40f4698d"), - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-17T15:34:01.426Z"); return t}()), - // CreatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("user"), - // Email: to.Ptr("user@microsoft.com"), - // ObjectID: to.Ptr("b03ca914-5eb6-45e5-9417-fe0797c372fd"), - // }, - // DisplayName: to.Ptr("SecurityEvent - 868f40f4698d"), - // EventTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-17T15:34:01.426Z"); return t}()), - // Labels: []*string{ - // }, - // Query: to.Ptr("SecurityEvent\r\n| take 1\n"), - // QueryResult: to.Ptr("{\"TimeGenerated\":\"2020-05-24T01:24:25.67Z\",\"Account\":\"\\\\ADMINISTRATOR\",\"AccountType\":\"User\",\"Computer\":\"SecurityEvents\",\"EventSourceName\":\"Microsoft-Windows-Security-Auditing\",\"Channel\":\"Security\",\"Task\":12544,\"Level\":\"16\",\"EventID\":4625,\"Activity\":\"4625 - An account failed to log on.\",\"AuthenticationPackageName\":\"NTLM\",\"FailureReason\":\"%%2313\",\"IpAddress\":\"176.113.115.73\",\"IpPort\":\"0\",\"LmPackageName\":\"-\",\"LogonProcessName\":\"NtLmSsp \",\"LogonType\":3,\"LogonTypeName\":\"3 - Network\",\"Process\":\"-\",\"ProcessId\":\"0x0\",\"__entityMapping\":{\"\\\\ADMINISTRATOR\":\"Account\",\"SecurityEvents\":\"Host\"}}"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-17T15:34:01.426Z"); return t}()), - // UpdatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("user"), - // Email: to.Ptr("user@microsoft.com"), - // ObjectID: to.Ptr("b03ca914-5eb6-45e5-9417-fe0797c372fd"), - // }, - // }, - // }, - // { - // Name: to.Ptr("bbbd324f-6c48-459c-8710-8d1e1cd03812"), - // Type: to.Ptr("Microsoft.SecurityInsights/Entities"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/bookmarks/bbbd324f-6c48-459c-8710-8d1e1cd03812"), - // Kind: to.Ptr(armsecurityinsights.EntityKindEnumBookmark), - // Properties: &armsecurityinsights.HuntingBookmarkProperties{ - // AdditionalData: map[string]any{ - // "ETag": "\"3b00acab-0000-0d00-0000-5f15e4ed0000\"", - // "EntityId": "afbd324f-6c48-459c-8710-8d1e1cd03812", - // }, - // FriendlyName: to.Ptr("SecurityEvent - 868f40f4698d"), - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-17T15:34:01.426Z"); return t}()), - // CreatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("user"), - // Email: to.Ptr("user@microsoft.com"), - // ObjectID: to.Ptr("303ca914-5eb6-45e5-9417-fe0797c372fd"), - // }, - // DisplayName: to.Ptr("SecurityEvent - 868f40f4698d"), - // EventTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-17T15:34:01.426Z"); return t}()), - // Labels: []*string{ - // }, - // Query: to.Ptr("SecurityEvent\r\n| take 1\n"), - // QueryResult: to.Ptr("{\"TimeGenerated\":\"2020-05-24T01:24:25.67Z\",\"Account\":\"\\\\ADMINISTRATOR\",\"AccountType\":\"User\",\"Computer\":\"SecurityEvents\",\"EventSourceName\":\"Microsoft-Windows-Security-Auditing\",\"Channel\":\"Security\",\"Task\":12544,\"Level\":\"16\",\"EventID\":4625,\"Activity\":\"4625 - An account failed to log on.\",\"AuthenticationPackageName\":\"NTLM\",\"FailureReason\":\"%%2313\",\"IpAddress\":\"176.113.115.73\",\"IpPort\":\"0\",\"LmPackageName\":\"-\",\"LogonProcessName\":\"NtLmSsp \",\"LogonType\":3,\"LogonTypeName\":\"3 - Network\",\"Process\":\"-\",\"ProcessId\":\"0x0\",\"__entityMapping\":{\"\\\\ADMINISTRATOR\":\"Account\",\"SecurityEvents\":\"Host\"}}"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-06-17T15:34:01.426Z"); return t}()), - // UpdatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("user"), - // Email: to.Ptr("user@microsoft.com"), - // ObjectID: to.Ptr("b03ca914-5eb6-45e5-9417-fe0797c372fd"), - // }, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/incidents/GetAllIncidentEntities.json -func ExampleIncidentsClient_ListEntities() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewIncidentsClient().ListEntities(ctx, "myRg", "myWorkspace", "afbd324f-6c48-459c-8710-8d1e1cd03812", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.IncidentEntitiesResponse = armsecurityinsights.IncidentEntitiesResponse{ - // Entities: []armsecurityinsights.EntityClassification{ - // &armsecurityinsights.AccountEntity{ - // Name: to.Ptr("e1d3d618-e11f-478b-98e3-bb381539a8e1"), - // Type: to.Ptr("Microsoft.SecurityInsights/Entities"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/Entities/e1d3d618-e11f-478b-98e3-bb381539a8e1"), - // Kind: to.Ptr(armsecurityinsights.EntityKindEnumAccount), - // Properties: &armsecurityinsights.AccountEntityProperties{ - // FriendlyName: to.Ptr("administrator"), - // AccountName: to.Ptr("administrator"), - // NtDomain: to.Ptr("domain"), - // }, - // }}, - // MetaData: []*armsecurityinsights.IncidentEntitiesResultsMetadata{ - // { - // Count: to.Ptr[int32](1), - // EntityKind: to.Ptr(armsecurityinsights.EntityKindEnumAccount), - // }}, - // } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/interfaces.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/interfaces.go index 3ca11105e621..6f092ca0d744 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/interfaces.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/interfaces.go @@ -38,7 +38,7 @@ type AutomationRuleActionClassification interface { // AutomationRuleConditionClassification provides polymorphic access to related types. // Call the interface's GetAutomationRuleCondition() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *AutomationRuleCondition, *PropertyConditionProperties +// - *AutomationRuleCondition, *PropertyArrayChangedConditionProperties, *PropertyChangedConditionProperties, *PropertyConditionProperties type AutomationRuleConditionClassification interface { // GetAutomationRuleCondition returns the AutomationRuleCondition content of the underlying type. GetAutomationRuleCondition() *AutomationRuleCondition @@ -66,6 +66,15 @@ type EntityClassification interface { GetEntity() *Entity } +// SecurityMLAnalyticsSettingClassification provides polymorphic access to related types. +// Call the interface's GetSecurityMLAnalyticsSetting() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AnomalySecurityMLAnalyticsSettings, *SecurityMLAnalyticsSetting +type SecurityMLAnalyticsSettingClassification interface { + // GetSecurityMLAnalyticsSetting returns the SecurityMLAnalyticsSetting content of the underlying type. + GetSecurityMLAnalyticsSetting() *SecurityMLAnalyticsSetting +} + // ThreatIntelligenceInformationClassification provides polymorphic access to related types. // Call the interface's GetThreatIntelligenceInformation() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/metadata_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/metadata_client.go new file mode 100644 index 000000000000..1f2dc9588d33 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/metadata_client.go @@ -0,0 +1,395 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// MetadataClient contains the methods for the Metadata group. +// Don't use this type directly, use NewMetadataClient() instead. +type MetadataClient struct { + internal *arm.Client + subscriptionID string +} + +// NewMetadataClient creates a new instance of MetadataClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewMetadataClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MetadataClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &MetadataClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Create a Metadata. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - metadataName - The Metadata name. +// - metadata - Metadata resource. +// - options - MetadataClientCreateOptions contains the optional parameters for the MetadataClient.Create method. +func (client *MetadataClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, metadata MetadataModel, options *MetadataClientCreateOptions) (MetadataClientCreateResponse, error) { + var err error + const operationName = "MetadataClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, workspaceName, metadataName, metadata, options) + if err != nil { + return MetadataClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MetadataClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return MetadataClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *MetadataClient) createCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, metadata MetadataModel, options *MetadataClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if metadataName == "" { + return nil, errors.New("parameter metadataName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{metadataName}", url.PathEscape(metadataName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, metadata); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *MetadataClient) createHandleResponse(resp *http.Response) (MetadataClientCreateResponse, error) { + result := MetadataClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetadataModel); err != nil { + return MetadataClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete a Metadata. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - metadataName - The Metadata name. +// - options - MetadataClientDeleteOptions contains the optional parameters for the MetadataClient.Delete method. +func (client *MetadataClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, options *MetadataClientDeleteOptions) (MetadataClientDeleteResponse, error) { + var err error + const operationName = "MetadataClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, workspaceName, metadataName, options) + if err != nil { + return MetadataClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MetadataClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return MetadataClientDeleteResponse{}, err + } + return MetadataClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *MetadataClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, options *MetadataClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if metadataName == "" { + return nil, errors.New("parameter metadataName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{metadataName}", url.PathEscape(metadataName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a Metadata. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - metadataName - The Metadata name. +// - options - MetadataClientGetOptions contains the optional parameters for the MetadataClient.Get method. +func (client *MetadataClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, options *MetadataClientGetOptions) (MetadataClientGetResponse, error) { + var err error + const operationName = "MetadataClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, workspaceName, metadataName, options) + if err != nil { + return MetadataClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MetadataClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MetadataClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *MetadataClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, options *MetadataClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if metadataName == "" { + return nil, errors.New("parameter metadataName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{metadataName}", url.PathEscape(metadataName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MetadataClient) getHandleResponse(resp *http.Response) (MetadataClientGetResponse, error) { + result := MetadataClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetadataModel); err != nil { + return MetadataClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List of all metadata +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - options - MetadataClientListOptions contains the optional parameters for the MetadataClient.NewListPager method. +func (client *MetadataClient) NewListPager(resourceGroupName string, workspaceName string, options *MetadataClientListOptions) *runtime.Pager[MetadataClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[MetadataClientListResponse]{ + More: func(page MetadataClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *MetadataClientListResponse) (MetadataClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "MetadataClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) + }, nil) + if err != nil { + return MetadataClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *MetadataClient) listCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *MetadataClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *MetadataClient) listHandleResponse(resp *http.Response) (MetadataClientListResponse, error) { + result := MetadataClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetadataList); err != nil { + return MetadataClientListResponse{}, err + } + return result, nil +} + +// Update - Update an existing Metadata. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - metadataName - The Metadata name. +// - metadataPatch - Partial metadata request. +// - options - MetadataClientUpdateOptions contains the optional parameters for the MetadataClient.Update method. +func (client *MetadataClient) Update(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, metadataPatch MetadataPatch, options *MetadataClientUpdateOptions) (MetadataClientUpdateResponse, error) { + var err error + const operationName = "MetadataClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, workspaceName, metadataName, metadataPatch, options) + if err != nil { + return MetadataClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return MetadataClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return MetadataClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *MetadataClient) updateCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, metadataName string, metadataPatch MetadataPatch, options *MetadataClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/metadata/{metadataName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if metadataName == "" { + return nil, errors.New("parameter metadataName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{metadataName}", url.PathEscape(metadataName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, metadataPatch); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *MetadataClient) updateHandleResponse(resp *http.Response) (MetadataClientUpdateResponse, error) { + result := MetadataClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MetadataModel); err != nil { + return MetadataClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/models.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/models.go index b1dacb47442b..1ca9303f49f9 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/models.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/models.go @@ -301,6 +301,9 @@ type AlertDetailsOverride struct { // the format containing columns name(s) to override the alert name AlertDisplayNameFormat *string + // List of additional dynamic properties to override + AlertDynamicProperties []*AlertPropertyMapping + // the column name to take the alert severity from AlertSeverityColumnName *string @@ -308,6 +311,15 @@ type AlertDetailsOverride struct { AlertTacticsColumnName *string } +// AlertPropertyMapping - A single alert property mapping to override +type AlertPropertyMapping struct { + // The V3 alert property + AlertProperty *AlertProperty + + // the column name to use to override this property + Value *string +} + // AlertRule - Alert rule. type AlertRule struct { // REQUIRED; The alert rule kind @@ -386,6 +398,88 @@ type AlertsDataTypeOfDataConnector struct { Alerts *DataConnectorDataTypeCommon } +// AnomalySecurityMLAnalyticsSettings - Represents Anomaly Security ML Analytics Settings +type AnomalySecurityMLAnalyticsSettings struct { + // REQUIRED; The kind of security ML Analytics Settings + Kind *SecurityMLAnalyticsSettingsKind + + // Etag of the azure resource + Etag *string + + // Anomaly Security ML Analytics Settings properties + Properties *AnomalySecurityMLAnalyticsSettingsProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// GetSecurityMLAnalyticsSetting implements the SecurityMLAnalyticsSettingClassification interface for type AnomalySecurityMLAnalyticsSettings. +func (a *AnomalySecurityMLAnalyticsSettings) GetSecurityMLAnalyticsSetting() *SecurityMLAnalyticsSetting { + return &SecurityMLAnalyticsSetting{ + Etag: a.Etag, + ID: a.ID, + Kind: a.Kind, + Name: a.Name, + SystemData: a.SystemData, + Type: a.Type, + } +} + +// AnomalySecurityMLAnalyticsSettingsProperties - AnomalySecurityMLAnalytics settings base property bag. +type AnomalySecurityMLAnalyticsSettingsProperties struct { + // REQUIRED; The anomaly version of the AnomalySecurityMLAnalyticsSettings. + AnomalyVersion *string + + // REQUIRED; The display name for settings created by this SecurityMLAnalyticsSettings. + DisplayName *string + + // REQUIRED; Determines whether this settings is enabled or disabled. + Enabled *bool + + // REQUIRED; The frequency that this SecurityMLAnalyticsSettings will be run. + Frequency *string + + // REQUIRED; Determines whether this anomaly security ml analytics settings is a default settings + IsDefaultSettings *bool + + // REQUIRED; The anomaly SecurityMLAnalyticsSettings status + SettingsStatus *SettingsStatus + + // The anomaly settings version of the Anomaly security ml analytics settings that dictates whether job version gets updated + // or not. + AnomalySettingsVersion *int32 + + // The customizable observations of the AnomalySecurityMLAnalyticsSettings. + CustomizableObservations any + + // The description of the SecurityMLAnalyticsSettings. + Description *string + + // The required data sources for this SecurityMLAnalyticsSettings + RequiredDataConnectors []*SecurityMLAnalyticsSettingsDataSource + + // The anomaly settings definition Id + SettingsDefinitionID *string + + // The tactics of the SecurityMLAnalyticsSettings + Tactics []*AttackTactic + + // The techniques of the SecurityMLAnalyticsSettings + Techniques []*string + + // READ-ONLY; The last time that this SecurityMLAnalyticsSettings has been modified. + LastModifiedUTC *time.Time +} + type AutomationRule struct { // REQUIRED; Automation rule properties Properties *AutomationRuleProperties @@ -406,9 +500,9 @@ type AutomationRule struct { Type *string } -// AutomationRuleAction - Describes an automation rule action +// AutomationRuleAction - Describes an automation rule action. type AutomationRuleAction struct { - // REQUIRED; The type of the automation rule action + // REQUIRED; The type of the automation rule action. ActionType *ActionType // REQUIRED @@ -418,7 +512,7 @@ type AutomationRuleAction struct { // GetAutomationRuleAction implements the AutomationRuleActionClassification interface for type AutomationRuleAction. func (a *AutomationRuleAction) GetAutomationRuleAction() *AutomationRuleAction { return a } -// AutomationRuleCondition - Describes an automation rule condition +// AutomationRuleCondition - Describes an automation rule condition. type AutomationRuleCondition struct { // REQUIRED ConditionType *ConditionType @@ -427,9 +521,9 @@ type AutomationRuleCondition struct { // GetAutomationRuleCondition implements the AutomationRuleConditionClassification interface for type AutomationRuleCondition. func (a *AutomationRuleCondition) GetAutomationRuleCondition() *AutomationRuleCondition { return a } -// AutomationRuleModifyPropertiesAction - Describes an automation rule action to modify an object's properties. +// AutomationRuleModifyPropertiesAction - Describes an automation rule action to modify an object's properties type AutomationRuleModifyPropertiesAction struct { - // REQUIRED; The type of the automation rule action + // REQUIRED; The type of the automation rule action. ActionType *ActionType // REQUIRED @@ -447,42 +541,54 @@ func (a *AutomationRuleModifyPropertiesAction) GetAutomationRuleAction() *Automa // AutomationRuleProperties - Automation rule properties type AutomationRuleProperties struct { - // REQUIRED; The actions to execute when the automation rule is triggered + // REQUIRED; The actions to execute when the automation rule is triggered. Actions []AutomationRuleActionClassification - // REQUIRED; The display name of the automation rule + // REQUIRED; The display name of the automation rule. DisplayName *string - // REQUIRED; The order of execution of the automation rule + // REQUIRED; The order of execution of the automation rule. Order *int32 - // REQUIRED; Describes automation rule triggering logic + // REQUIRED; Describes automation rule triggering logic. TriggeringLogic *AutomationRuleTriggeringLogic // READ-ONLY; Information on the client (user or application) that made some action CreatedBy *ClientInfo - // READ-ONLY; The time the automation rule was created + // READ-ONLY; The time the automation rule was created. CreatedTimeUTC *time.Time // READ-ONLY; Information on the client (user or application) that made some action LastModifiedBy *ClientInfo - // READ-ONLY; The last time the automation rule was updated + // READ-ONLY; The last time the automation rule was updated. LastModifiedTimeUTC *time.Time } +type AutomationRulePropertyArrayChangedValuesCondition struct { + ArrayType *AutomationRulePropertyArrayChangedConditionSupportedArrayType + ChangeType *AutomationRulePropertyArrayChangedConditionSupportedChangeType +} + +type AutomationRulePropertyValuesChangedCondition struct { + ChangeType *AutomationRulePropertyChangedConditionSupportedChangedType + Operator *AutomationRulePropertyConditionSupportedOperator + PropertyName *AutomationRulePropertyChangedConditionSupportedPropertyType + PropertyValues []*string +} + type AutomationRulePropertyValuesCondition struct { Operator *AutomationRulePropertyConditionSupportedOperator - // The property to evaluate in an automation rule property condition + // The property to evaluate in an automation rule property condition. PropertyName *AutomationRulePropertyConditionSupportedProperty PropertyValues []*string } // AutomationRuleRunPlaybookAction - Describes an automation rule action to run a playbook type AutomationRuleRunPlaybookAction struct { - // REQUIRED; The type of the automation rule action + // REQUIRED; The type of the automation rule action. ActionType *ActionType // REQUIRED @@ -498,9 +604,9 @@ func (a *AutomationRuleRunPlaybookAction) GetAutomationRuleAction() *AutomationR } } -// AutomationRuleTriggeringLogic - Describes automation rule triggering logic +// AutomationRuleTriggeringLogic - Describes automation rule triggering logic. type AutomationRuleTriggeringLogic struct { - // REQUIRED; Determines whether the automation rule is enabled or disabled + // REQUIRED; Determines whether the automation rule is enabled or disabled. IsEnabled *bool // REQUIRED @@ -509,7 +615,7 @@ type AutomationRuleTriggeringLogic struct { // REQUIRED TriggersWhen *TriggersWhen - // The conditions to evaluate to determine if the automation rule should be triggered on a given object + // The conditions to evaluate to determine if the automation rule should be triggered on a given object. Conditions []AutomationRuleConditionClassification // Determines when the automation rule should automatically expire and be disabled. @@ -578,6 +684,15 @@ type AwsCloudTrailDataConnectorProperties struct { DataTypes *AwsCloudTrailDataConnectorDataTypes } +// AzureDevOpsResourceInfo - Resources created in Azure DevOps repository. +type AzureDevOpsResourceInfo struct { + // Id of the pipeline created for the source-control. + PipelineID *string + + // Id of the service-connection created for the source-control. + ServiceConnectionID *string +} + // AzureResourceEntity - Represents an azure resource entity. type AzureResourceEntity struct { // REQUIRED; The kind of the entity. @@ -858,6 +973,36 @@ type DataConnectorList struct { NextLink *string } +// Deployment - Description about a deployment. +type Deployment struct { + // Deployment identifier. + DeploymentID *string + + // Url to access repository action logs. + DeploymentLogsURL *string + + // The outcome of the deployment. + DeploymentResult *DeploymentResult + + // Current status of the deployment. + DeploymentState *DeploymentState + + // The time when the deployment finished. + DeploymentTime *time.Time +} + +// DeploymentInfo - Information regarding a deployment. +type DeploymentInfo struct { + // Deployment information. + Deployment *Deployment + + // Status while fetching the last deployment. + DeploymentFetchStatus *DeploymentFetchStatus + + // Additional details about the deployment that can be shown to the user. + Message *string +} + // Entity - Specific entity. type Entity struct { // REQUIRED; The kind of the entity. @@ -1063,6 +1208,9 @@ type FusionAlertRuleProperties struct { // READ-ONLY; The tactics of the alert rule Tactics []*AttackTactic + + // READ-ONLY; The techniques of the alert rule + Techniques []*string } // FusionAlertRuleTemplate - Represents Fusion alert rule template. @@ -1120,6 +1268,9 @@ type FusionAlertRuleTemplateProperties struct { // The tactics of the alert rule template Tactics []*AttackTactic + // The techniques of the alert rule template + Techniques []*string + // READ-ONLY; The time that this alert rule template has been added. CreatedDateUTC *time.Time @@ -1155,6 +1306,12 @@ type GeoLocation struct { State *string } +// GitHubResourceInfo - Resources created in GitHub repository. +type GitHubResourceInfo struct { + // GitHub application installation id. + AppInstallationID *string +} + // GroupingConfiguration - Grouping configuration property bag. type GroupingConfiguration struct { // REQUIRED; Grouping enabled @@ -1413,6 +1570,9 @@ type IncidentAdditionalData struct { // READ-ONLY; The number of comments in the incident CommentsCount *int32 + // READ-ONLY; The provider incident url to the incident in Microsoft 365 Defender portal + ProviderIncidentURL *string + // READ-ONLY; The tactics associated with incident Tactics []*AttackTactic } @@ -1545,21 +1705,6 @@ type IncidentOwnerInfo struct { // The object id of the user the incident is assigned to. ObjectID *string - // The user principal name of the user the incident is assigned to. - UserPrincipalName *string -} - -// IncidentOwnerInfoAutoGenerated - Information on the user an incident is assigned to -type IncidentOwnerInfoAutoGenerated struct { - // The name of the user the incident is assigned to. - AssignedTo *string - - // The email of the user the incident is assigned to. - Email *string - - // The object id of the user the incident is assigned to. - ObjectID *string - // The type of the owner the incident is assigned to. OwnerType *OwnerType @@ -1617,6 +1762,12 @@ type IncidentProperties struct { // READ-ONLY; The last time the incident was updated LastModifiedTimeUTC *time.Time + // READ-ONLY; The incident ID assigned by the incident provider + ProviderIncidentID *string + + // READ-ONLY; The name of the source provider that generated the incident + ProviderName *string + // READ-ONLY; List of resource ids of Analytic rules related to the incident RelatedAnalyticRuleIDs []*string } @@ -1625,17 +1776,17 @@ type IncidentPropertiesAction struct { // The reason the incident was closed Classification *IncidentClassification - // Describes the reason the incident was closed + // Describes the reason the incident was closed. ClassificationComment *string // The classification reason the incident was closed with ClassificationReason *IncidentClassificationReason - // List of labels to add to the incident + // List of labels to add to the incident. Labels []*IncidentLabel // Information on the user an incident is assigned to - Owner *IncidentOwnerInfoAutoGenerated + Owner *IncidentOwnerInfo // The severity of the incident Severity *IncidentSeverity @@ -2150,6 +2301,250 @@ type MalwareEntityProperties struct { ProcessEntityIDs []*string } +// MetadataAuthor - Publisher or creator of the content item. +type MetadataAuthor struct { + // Email of author contact + Email *string + + // Link for author/vendor page + Link *string + + // Name of the author. Company or person. + Name *string +} + +// MetadataCategories - ies for the solution content item +type MetadataCategories struct { + // domain for the solution content item + Domains []*string + + // Industry verticals for the solution content item + Verticals []*string +} + +// MetadataDependencies - Dependencies for the content item, what other content items it requires to work. Can describe more +// complex dependencies using a recursive/nested structure. For a single dependency an id/kind/version +// can be supplied or operator/criteria for complex dependencies. +type MetadataDependencies struct { + // Id of the content item we depend on + ContentID *string + + // This is the list of dependencies we must fulfill, according to the AND/OR operator + Criteria []*MetadataDependencies + + // Type of the content item we depend on + Kind *Kind + + // Name of the content item + Name *string + + // Operator used for list of dependencies in criteria array. + Operator *Operator + + // Version of the the content item we depend on. Can be blank, * or missing to indicate any version fulfills the dependency. + // If version does not match our defined numeric format then an exact match is + // required. + Version *string +} + +// MetadataList - List of all the metadata. +type MetadataList struct { + // REQUIRED; Array of metadata. + Value []*MetadataModel + + // READ-ONLY; URL to fetch the next page of metadata. + NextLink *string +} + +// MetadataModel - Metadata resource definition. +type MetadataModel struct { + // Etag of the azure resource + Etag *string + + // Metadata properties + Properties *MetadataProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// MetadataPatch - Metadata patch request body. +type MetadataPatch struct { + // Metadata patch request body + Properties *MetadataPropertiesPatch +} + +// MetadataProperties - Metadata property bag. +type MetadataProperties struct { + // REQUIRED; The kind of content the metadata is for. + Kind *string + + // REQUIRED; Full parent resource ID of the content item the metadata is for. This is the full resource ID including the scope + // (subscription and resource group) + ParentID *string + + // The creator of the content item. + Author *MetadataAuthor + + // Categories for the solution content item + Categories *MetadataCategories + + // Static ID for the content. Used to identify dependencies and content from solutions or community. Hard-coded/static for + // out of the box content and solutions. Dynamic for user-created. This is the + // resource name + ContentID *string + + // Schema version of the content. Can be used to distinguish between different flow based on the schema version + ContentSchemaVersion *string + + // The custom version of the content. A optional free text + CustomVersion *string + + // Dependencies for the content item, what other content items it requires to work. Can describe more complex dependencies + // using a recursive/nested structure. For a single dependency an id/kind/version + // can be supplied or operator/criteria for complex formats. + Dependencies *MetadataDependencies + + // first publish date solution content item + FirstPublishDate *time.Time + + // the icon identifier. this id can later be fetched from the solution template + Icon *string + + // last publish date for the solution content item + LastPublishDate *time.Time + + // preview image file names. These will be taken from the solution artifacts + PreviewImages []*string + + // preview image file names. These will be taken from the solution artifacts. used for dark theme support + PreviewImagesDark []*string + + // Providers for the solution content item + Providers []*string + + // Source of the content. This is where/how it was created. + Source *MetadataSource + + // Support information for the metadata - type, name, contact information + Support *MetadataSupport + + // the tactics the resource covers + ThreatAnalysisTactics []*string + + // the techniques the resource covers, these have to be aligned with the tactics being used + ThreatAnalysisTechniques []*string + + // Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM template + // best practices. Can also be any string, but then we cannot guarantee any version + // checks + Version *string +} + +// MetadataPropertiesPatch - Metadata property bag for patch requests. This is the same as the MetadataProperties, but with +// nothing required +type MetadataPropertiesPatch struct { + // The creator of the content item. + Author *MetadataAuthor + + // Categories for the solution content item + Categories *MetadataCategories + + // Static ID for the content. Used to identify dependencies and content from solutions or community. Hard-coded/static for + // out of the box content and solutions. Dynamic for user-created. This is the + // resource name + ContentID *string + + // Schema version of the content. Can be used to distinguish between different flow based on the schema version + ContentSchemaVersion *string + + // The custom version of the content. A optional free text + CustomVersion *string + + // Dependencies for the content item, what other content items it requires to work. Can describe more complex dependencies + // using a recursive/nested structure. For a single dependency an id/kind/version + // can be supplied or operator/criteria for complex formats. + Dependencies *MetadataDependencies + + // first publish date solution content item + FirstPublishDate *time.Time + + // the icon identifier. this id can later be fetched from the solution template + Icon *string + + // The kind of content the metadata is for. + Kind *string + + // last publish date for the solution content item + LastPublishDate *time.Time + + // Full parent resource ID of the content item the metadata is for. This is the full resource ID including the scope (subscription + // and resource group) + ParentID *string + + // preview image file names. These will be taken from the solution artifacts + PreviewImages []*string + + // preview image file names. These will be taken from the solution artifacts. used for dark theme support + PreviewImagesDark []*string + + // Providers for the solution content item + Providers []*string + + // Source of the content. This is where/how it was created. + Source *MetadataSource + + // Support information for the metadata - type, name, contact information + Support *MetadataSupport + + // the tactics the resource covers + ThreatAnalysisTactics []*string + + // the techniques the resource covers, these have to be aligned with the tactics being used + ThreatAnalysisTechniques []*string + + // Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM template + // best practices. Can also be any string, but then we cannot guarantee any version + // checks + Version *string +} + +// MetadataSource - The original source of the content item, where it comes from. +type MetadataSource struct { + // REQUIRED; Source type of the content + Kind *SourceKind + + // Name of the content source. The repo name, solution name, LA workspace name etc. + Name *string + + // ID of the content source. The solution ID, workspace ID, etc + SourceID *string +} + +// MetadataSupport - Support information for the content item. +type MetadataSupport struct { + // REQUIRED; Type of support for content item + Tier *SupportTier + + // Email of support contact + Email *string + + // Link for support help, like to support page to open a ticket etc. + Link *string + + // Name of the support contact. Company or person. + Name *string +} + // MicrosoftSecurityIncidentCreationAlertRule - Represents MicrosoftSecurityIncidentCreation rule. type MicrosoftSecurityIncidentCreationAlertRule struct { // REQUIRED; The alert rule kind @@ -2250,9 +2645,6 @@ func (m *MicrosoftSecurityIncidentCreationAlertRuleTemplate) GetAlertRuleTemplat // MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties - MicrosoftSecurityIncidentCreation rule template properties type MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties struct { - // REQUIRED; The alerts' productName on which the cases will be generated - ProductFilter *MicrosoftSecurityProductName - // the number of alert rules that were created by this template AlertRulesCreatedByTemplateCount *int32 @@ -2268,6 +2660,9 @@ type MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties struct { // the alerts' displayNames on which the cases will be generated DisplayNamesFilter []*string + // The alerts' productName on which the cases will be generated + ProductFilter *MicrosoftSecurityProductName + // The required data connectors for this template RequiredDataConnectors []*AlertRuleTemplateDataSource @@ -2398,11 +2793,113 @@ type OperationsList struct { NextLink *string } +// PackageList - List available packages. +type PackageList struct { + // REQUIRED; Array of packages. + Value []*PackageModel + + // READ-ONLY; URL to fetch the next set of packages. + NextLink *string +} + +// PackageModel - Represents a Package in Azure Security Insights. +type PackageModel struct { + // Etag of the azure resource + Etag *string + + // package properties + Properties *PackageProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PackageProperties - Describes package properties +type PackageProperties struct { + // The author of the package + Author *MetadataAuthor + + // The categories of the package + Categories *MetadataCategories + + // The content id of the package + ContentID *string + + // The package kind + ContentKind *PackageKind + + // Unique ID for the content. It should be generated based on the contentId, contentKind and the contentVersion of the package + ContentProductID *string + + // The version of the content schema. + ContentSchemaVersion *string + + // The support tier of the package + Dependencies *MetadataDependencies + + // The description of the package + Description *string + + // The display name of the package + DisplayName *string + + // first publish date package item + FirstPublishDate *time.Time + + // the icon identifier. this id can later be fetched from the content metadata + Icon *string + + // Flag indicates if this template is deprecated + IsDeprecated *Flag + + // Flag indicates if this package is among the featured list. + IsFeatured *Flag + + // Flag indicates if this is a newly published package. + IsNew *Flag + + // Flag indicates if this package is in preview. + IsPreview *Flag + + // last publish date for the package item + LastPublishDate *time.Time + + // Providers for the package item + Providers []*string + + // The publisher display name of the package + PublisherDisplayName *string + + // The source of the package + Source *MetadataSource + + // The support tier of the package + Support *MetadataSupport + + // the tactics the resource covers + ThreatAnalysisTactics []*string + + // the techniques the resource covers, these have to be aligned with the tactics being used + ThreatAnalysisTechniques []*string + + // the latest version number of the package + Version *string +} + type PlaybookActionProperties struct { - // REQUIRED; The resource id of the playbook resource + // REQUIRED; The resource id of the playbook resource. LogicAppResourceID *string - // The tenant id of the playbook resource + // The tenant id of the playbook resource. TenantID *string } @@ -2475,22 +2972,291 @@ type ProcessEntityProperties struct { ProcessID *string } -// PropertyConditionProperties - Describes an automation rule condition that evaluates a property's value -type PropertyConditionProperties struct { - // REQUIRED - ConditionType *ConditionType - ConditionProperties *AutomationRulePropertyValuesCondition -} +// ProductPackageList - List available packages. +type ProductPackageList struct { + // REQUIRED; Array of packages. + Value []*ProductPackageModel -// GetAutomationRuleCondition implements the AutomationRuleConditionClassification interface for type PropertyConditionProperties. -func (p *PropertyConditionProperties) GetAutomationRuleCondition() *AutomationRuleCondition { - return &AutomationRuleCondition{ - ConditionType: p.ConditionType, - } + // READ-ONLY; URL to fetch the next set of packages. + NextLink *string } -// RegistryKeyEntity - Represents a registry key entity. -type RegistryKeyEntity struct { +// ProductPackageModel - Represents a Package in Azure Security Insights. +type ProductPackageModel struct { + // Etag of the azure resource + Etag *string + + // package properties + Properties *ProductPackageProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ProductPackageProperties - Describes package properties +type ProductPackageProperties struct { + // The author of the package + Author *MetadataAuthor + + // The categories of the package + Categories *MetadataCategories + + // The content id of the package + ContentID *string + + // The package kind + ContentKind *PackageKind + + // Unique ID for the content. It should be generated based on the contentId, contentKind and the contentVersion of the package + ContentProductID *string + + // The version of the content schema. + ContentSchemaVersion *string + + // The support tier of the package + Dependencies *MetadataDependencies + + // The description of the package + Description *string + + // The display name of the package + DisplayName *string + + // first publish date package item + FirstPublishDate *time.Time + + // the icon identifier. this id can later be fetched from the content metadata + Icon *string + + // The version of the installed package, null or absent means not installed. + InstalledVersion *string + + // Flag indicates if this template is deprecated + IsDeprecated *Flag + + // Flag indicates if this package is among the featured list. + IsFeatured *Flag + + // Flag indicates if this is a newly published package. + IsNew *Flag + + // Flag indicates if this package is in preview. + IsPreview *Flag + + // last publish date for the package item + LastPublishDate *time.Time + + // The metadata resource id. + MetadataResourceID *string + + // The json of the ARM template to deploy. Expandable. + PackagedContent any + + // Providers for the package item + Providers []*string + + // The publisher display name of the package + PublisherDisplayName *string + + // The source of the package + Source *MetadataSource + + // The support tier of the package + Support *MetadataSupport + + // the tactics the resource covers + ThreatAnalysisTactics []*string + + // the techniques the resource covers, these have to be aligned with the tactics being used + ThreatAnalysisTechniques []*string + + // the latest version number of the package + Version *string +} + +// ProductTemplateList - List of all the template. +type ProductTemplateList struct { + // REQUIRED; Array of templates. + Value []*ProductTemplateModel + + // READ-ONLY; URL to fetch the next page of template. + NextLink *string +} + +// ProductTemplateModel - Template resource definition. +type ProductTemplateModel struct { + // Etag of the azure resource + Etag *string + + // template properties + Properties *ProductTemplateProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ProductTemplateProperties - Template property bag. +type ProductTemplateProperties struct { + // The creator of the content item. + Author *MetadataAuthor + + // Categories for the item + Categories *MetadataCategories + + // Static ID for the content. Used to identify dependencies and content from solutions or community. Hard-coded/static for + // out of the box content and solutions. Dynamic for user-created. This is the + // resource name + ContentID *string + + // The kind of content the template is for. + ContentKind *Kind + + // Unique ID for the content. It should be generated based on the contentId of the package, contentId of the template, contentKind + // of the template and the contentVersion of the template + ContentProductID *string + + // Schema version of the content. Can be used to distinguish between different flow based on the schema version + ContentSchemaVersion *string + + // The custom version of the content. A optional free text + CustomVersion *string + + // Dependencies for the content item, what other content items it requires to work. Can describe more complex dependencies + // using a recursive/nested structure. For a single dependency an id/kind/version + // can be supplied or operator/criteria for complex formats. + Dependencies *MetadataDependencies + + // The display name of the template + DisplayName *string + + // first publish date content item + FirstPublishDate *time.Time + + // the icon identifier. this id can later be fetched from the content metadata + Icon *string + + // last publish date for the content item + LastPublishDate *time.Time + + // the package Id contains this template + PackageID *string + + // the packageKind of the package contains this template + PackageKind *PackageKind + + // the name of the package contains this template + PackageName *string + + // Version of the package. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata + // best practices. Can also be any string, but then we cannot guarantee any version + // checks + PackageVersion *string + + // The json of the ARM template to deploy + PackagedContent any + + // preview image file names. These will be taken from the solution artifacts + PreviewImages []*string + + // preview image file names. These will be taken from the solution artifacts. used for dark theme support + PreviewImagesDark []*string + + // Providers for the content item + Providers []*string + + // Source of the content. This is where/how it was created. + Source *MetadataSource + + // Support information for the template - type, name, contact information + Support *MetadataSupport + + // the tactics the resource covers + ThreatAnalysisTactics []*string + + // the techniques the resource covers, these have to be aligned with the tactics being used + ThreatAnalysisTechniques []*string + + // Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata + // best practices. Can also be any string, but then we cannot guarantee any version + // checks + Version *string + + // READ-ONLY; Flag indicates if this template is deprecated + IsDeprecated *Flag +} + +// PropertyArrayChangedConditionProperties - Describes an automation rule condition that evaluates an array property's value +// change +type PropertyArrayChangedConditionProperties struct { + // REQUIRED + ConditionType *ConditionType + ConditionProperties *AutomationRulePropertyArrayChangedValuesCondition +} + +// GetAutomationRuleCondition implements the AutomationRuleConditionClassification interface for type PropertyArrayChangedConditionProperties. +func (p *PropertyArrayChangedConditionProperties) GetAutomationRuleCondition() *AutomationRuleCondition { + return &AutomationRuleCondition{ + ConditionType: p.ConditionType, + } +} + +// PropertyChangedConditionProperties - Describes an automation rule condition that evaluates a property's value change +type PropertyChangedConditionProperties struct { + // REQUIRED + ConditionType *ConditionType + ConditionProperties *AutomationRulePropertyValuesChangedCondition +} + +// GetAutomationRuleCondition implements the AutomationRuleConditionClassification interface for type PropertyChangedConditionProperties. +func (p *PropertyChangedConditionProperties) GetAutomationRuleCondition() *AutomationRuleCondition { + return &AutomationRuleCondition{ + ConditionType: p.ConditionType, + } +} + +// PropertyConditionProperties - Describes an automation rule condition that evaluates a property's value +type PropertyConditionProperties struct { + // REQUIRED + ConditionType *ConditionType + ConditionProperties *AutomationRulePropertyValuesCondition +} + +// GetAutomationRuleCondition implements the AutomationRuleConditionClassification interface for type PropertyConditionProperties. +func (p *PropertyConditionProperties) GetAutomationRuleCondition() *AutomationRuleCondition { + return &AutomationRuleCondition{ + ConditionType: p.ConditionType, + } +} + +// PullRequest - Information regarding pull request for protected branches. +type PullRequest struct { + // READ-ONLY; State of the pull request + State *State + + // READ-ONLY; URL of pull request + URL *string +} + +// RegistryKeyEntity - Represents a registry key entity. +type RegistryKeyEntity struct { // REQUIRED; The kind of the entity. Kind *EntityKindEnum @@ -2637,6 +3403,90 @@ type RelationProperties struct { RelatedResourceType *string } +// Repo - Represents a repository. +type Repo struct { + // Array of branches. + Branches []*string + + // The name of the repository. + FullName *string + + // The installation id of the repository. + InstallationID *int64 + + // The url to access the repository. + URL *string +} + +// RepoList - List all the source controls. +type RepoList struct { + // REQUIRED; Array of repositories. + Value []*Repo + + // READ-ONLY; URL to fetch the next set of repositories. + NextLink *string +} + +// Repository - metadata of a repository. +type Repository struct { + // REQUIRED; Branch name of repository. + Branch *string + + // REQUIRED; Url of repository. + URL *string + + // Display url of repository. + DisplayURL *string + + // READ-ONLY; Url to access repository action logs. + DeploymentLogsURL *string +} + +// RepositoryAccess - Credentials to access repository. +type RepositoryAccess struct { + // REQUIRED; The kind of repository access credentials + Kind *RepositoryAccessKind + + // OAuth ClientId. Required when kind is OAuth + ClientID *string + + // OAuth Code. Required when kind is OAuth + Code *string + + // Application installation ID. Required when kind is App. Supported by GitHub only. + InstallationID *string + + // OAuth State. Required when kind is OAuth + State *string + + // Personal Access Token. Required when kind is PAT + Token *string +} + +// RepositoryAccessObject - Credentials to access repository. +type RepositoryAccessObject struct { + // REQUIRED; RepositoryAccess properties + RepositoryAccess *RepositoryAccess +} + +// RepositoryAccessProperties - Credentials to access repository. +type RepositoryAccessProperties struct { + // REQUIRED; RepositoryAccess properties + Properties *RepositoryAccessObject +} + +// RepositoryResourceInfo - Resources created in user's repository for the source-control. +type RepositoryResourceInfo struct { + // The webhook object created for the source-control. + Webhook *Webhook + + // READ-ONLY; Resources created in Azure DevOps for this source-control. + AzureDevOpsResourceInfo *AzureDevOpsResourceInfo + + // READ-ONLY; Resources created in GitHub for this source-control. + GitHubResourceInfo *GitHubResourceInfo +} + // ScheduledAlertRule - Represents scheduled alert rule. type ScheduledAlertRule struct { // REQUIRED; The alert rule kind @@ -2723,6 +3573,9 @@ type ScheduledAlertRuleProperties struct { // The tactics of the alert rule Tactics []*AttackTactic + // The techniques of the alert rule + Techniques []*string + // The version of the alert rule template used to create this rule - in format , where all are numbers, for example 0 TemplateVersion *string @@ -2812,6 +3665,9 @@ type ScheduledAlertRuleTemplateProperties struct { // The tactics of the alert rule template Tactics []*AttackTactic + // The techniques of the alert rule template + Techniques []*string + // The operation against the threshold that triggers alert rule. TriggerOperator *TriggerOperator @@ -3006,6 +3862,50 @@ type SecurityGroupEntityProperties struct { Sid *string } +// SecurityMLAnalyticsSetting - Security ML Analytics Setting +type SecurityMLAnalyticsSetting struct { + // REQUIRED; The kind of security ML Analytics Settings + Kind *SecurityMLAnalyticsSettingsKind + + // Etag of the azure resource + Etag *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// GetSecurityMLAnalyticsSetting implements the SecurityMLAnalyticsSettingClassification interface for type SecurityMLAnalyticsSetting. +func (s *SecurityMLAnalyticsSetting) GetSecurityMLAnalyticsSetting() *SecurityMLAnalyticsSetting { + return s +} + +// SecurityMLAnalyticsSettingsDataSource - security ml analytics settings data sources +type SecurityMLAnalyticsSettingsDataSource struct { + // The connector id that provides the following data types + ConnectorID *string + + // The data types used by the security ml analytics settings + DataTypes []*string +} + +// SecurityMLAnalyticsSettingsList - List all the SecurityMLAnalyticsSettings +type SecurityMLAnalyticsSettingsList struct { + // REQUIRED; Array of SecurityMLAnalyticsSettings + Value []SecurityMLAnalyticsSettingClassification + + // READ-ONLY; URL to fetch the next set of SecurityMLAnalyticsSettings. + NextLink *string +} + // SentinelOnboardingState - Sentinel onboarding state type SentinelOnboardingState struct { // Etag of the azure resource @@ -3039,6 +3939,90 @@ type SentinelOnboardingStatesList struct { Value []*SentinelOnboardingState } +// ServicePrincipal - Service principal metadata. +type ServicePrincipal struct { + // Expiration time of service principal credentials. + CredentialsExpireOn *time.Time + + // READ-ONLY; App id of service principal. + AppID *string + + // READ-ONLY; Id of service principal. + ID *string + + // READ-ONLY; Tenant id of service principal. + TenantID *string +} + +// SourceControl - Represents a SourceControl in Azure Security Insights. +type SourceControl struct { + // REQUIRED; source control properties + Properties *SourceControlProperties + + // Etag of the azure resource + Etag *string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SourceControlList - List all the source controls. +type SourceControlList struct { + // REQUIRED; Array of source controls. + Value []*SourceControl + + // READ-ONLY; URL to fetch the next set of source controls. + NextLink *string +} + +// SourceControlProperties - Describes source control properties +type SourceControlProperties struct { + // REQUIRED; Array of source control content types. + ContentTypes []*ContentType + + // REQUIRED; The display name of the source control + DisplayName *string + + // REQUIRED; The repository type of the source control + RepoType *RepoType + + // REQUIRED; Repository metadata. + Repository *Repository + + // A description of the source control + Description *string + + // Repository access credentials. This is write-only object and it never returns back to a user. + RepositoryAccess *RepositoryAccess + + // Information regarding the resources created in user's repository. + RepositoryResourceInfo *RepositoryResourceInfo + + // Service principal metadata. + ServicePrincipal *ServicePrincipal + + // READ-ONLY; The id (a Guid) of the source control + ID *string + + // READ-ONLY; Information regarding the latest deployment for the source control. + LastDeploymentInfo *DeploymentInfo + + // READ-ONLY; Information regarding the pull request of the source control. + PullRequest *PullRequest + + // READ-ONLY; The version number associated with the source control + Version *Version +} + // SubmissionMailEntity - Represents a submission mail entity. type SubmissionMailEntity struct { // REQUIRED; The kind of the entity. @@ -3192,6 +4176,129 @@ type TIDataConnectorProperties struct { TipLookbackPeriod *time.Time } +// TemplateList - List of all the template. +type TemplateList struct { + // REQUIRED; Array of templates. + Value []*TemplateModel + + // READ-ONLY; URL to fetch the next page of template. + NextLink *string +} + +// TemplateModel - Template resource definition. +type TemplateModel struct { + // Etag of the azure resource + Etag *string + + // template properties + Properties *TemplateProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// TemplateProperties - Template property bag. +type TemplateProperties struct { + // The creator of the content item. + Author *MetadataAuthor + + // Categories for the item + Categories *MetadataCategories + + // Static ID for the content. Used to identify dependencies and content from solutions or community. Hard-coded/static for + // out of the box content and solutions. Dynamic for user-created. This is the + // resource name + ContentID *string + + // The kind of content the template is for. + ContentKind *Kind + + // Unique ID for the content. It should be generated based on the contentId of the package, contentId of the template, contentKind + // of the template and the contentVersion of the template + ContentProductID *string + + // Schema version of the content. Can be used to distinguish between different flow based on the schema version + ContentSchemaVersion *string + + // The custom version of the content. A optional free text + CustomVersion *string + + // Dependencies for the content item, what other content items it requires to work. Can describe more complex dependencies + // using a recursive/nested structure. For a single dependency an id/kind/version + // can be supplied or operator/criteria for complex formats. + Dependencies *MetadataDependencies + + // The display name of the template + DisplayName *string + + // first publish date content item + FirstPublishDate *time.Time + + // the icon identifier. this id can later be fetched from the content metadata + Icon *string + + // last publish date for the content item + LastPublishDate *time.Time + + // The JSON of the ARM template to deploy active content. Expandable. + MainTemplate any + + // the package Id contains this template + PackageID *string + + // the packageKind of the package contains this template + PackageKind *PackageKind + + // the name of the package contains this template + PackageName *string + + // Version of the package. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata + // best practices. Can also be any string, but then we cannot guarantee any version + // checks + PackageVersion *string + + // preview image file names. These will be taken from the solution artifacts + PreviewImages []*string + + // preview image file names. These will be taken from the solution artifacts. used for dark theme support + PreviewImagesDark []*string + + // Providers for the content item + Providers []*string + + // Source of the content. This is where/how it was created. + Source *MetadataSource + + // Support information for the template - type, name, contact information + Support *MetadataSupport + + // the tactics the resource covers + ThreatAnalysisTactics []*string + + // the techniques the resource covers, these have to be aligned with the tactics being used + ThreatAnalysisTechniques []*string + + // Version of the content. Default and recommended format is numeric (e.g. 1, 1.0, 1.0.0, 1.0.0.0), following ARM metadata + // best practices. Can also be any string, but then we cannot guarantee any version + // checks + Version *string + + // READ-ONLY; Dependant templates. Expandable. + DependantTemplates []*TemplateProperties + + // READ-ONLY; Flag indicates if this template is deprecated + IsDeprecated *Flag +} + // ThreatIntelligence property bag. type ThreatIntelligence struct { // READ-ONLY; Confidence (must be between 0 and 1) @@ -3585,6 +4692,24 @@ type UserInfo struct { Name *string } +// Warning response structure. +type Warning struct { + // READ-ONLY; Warning data. + Warning *WarningBody +} + +// WarningBody - Warning details. +type WarningBody struct { + // READ-ONLY; An identifier for the warning. Codes are invariant and are intended to be consumed programmatically. + Code *WarningCode + + // READ-ONLY + Details []*WarningBody + + // READ-ONLY; A message describing the warning, intended to be suitable for display in a user interface. + Message *string +} + // Watchlist - Represents a Watchlist in Azure Security Insights. type Watchlist struct { // Etag of the azure resource @@ -3691,9 +4816,6 @@ type WatchlistProperties struct { // REQUIRED; The provider of the watchlist Provider *string - // REQUIRED; The source of the watchlist - Source *Source - // The content type of the raw content. For now, only text/csv is valid ContentType *string @@ -3721,6 +4843,9 @@ type WatchlistProperties struct { // The raw content that represents to watchlist items to create. Example : This line will be skipped header1,header2 value1,value2 RawContent *string + // The source of the watchlist. Only accepts "Local file" and "Remote storage". And it must included in the request. + Source *string + // The tenantId where the watchlist belongs to TenantID *string @@ -3743,3 +4868,18 @@ type WatchlistProperties struct { // The type of the watchlist WatchlistType *string } + +// Webhook - Detail about the webhook object. +type Webhook struct { + // A flag to instruct the backend service to rotate webhook secret. + RotateWebhookSecret *bool + + // READ-ONLY; Unique identifier for the webhook. + WebhookID *string + + // READ-ONLY; Time when the webhook secret was updated. + WebhookSecretUpdateTime *time.Time + + // READ-ONLY; URL that gets invoked by the webhook. + WebhookURL *string +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/models_serde.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/models_serde.go index ba0e6d7617f2..e4badc30491c 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/models_serde.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/models_serde.go @@ -579,6 +579,7 @@ func (a AlertDetailsOverride) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "alertDescriptionFormat", a.AlertDescriptionFormat) populate(objectMap, "alertDisplayNameFormat", a.AlertDisplayNameFormat) + populate(objectMap, "alertDynamicProperties", a.AlertDynamicProperties) populate(objectMap, "alertSeverityColumnName", a.AlertSeverityColumnName) populate(objectMap, "alertTacticsColumnName", a.AlertTacticsColumnName) return json.Marshal(objectMap) @@ -599,6 +600,9 @@ func (a *AlertDetailsOverride) UnmarshalJSON(data []byte) error { case "alertDisplayNameFormat": err = unpopulate(val, "AlertDisplayNameFormat", &a.AlertDisplayNameFormat) delete(rawMsg, key) + case "alertDynamicProperties": + err = unpopulate(val, "AlertDynamicProperties", &a.AlertDynamicProperties) + delete(rawMsg, key) case "alertSeverityColumnName": err = unpopulate(val, "AlertSeverityColumnName", &a.AlertSeverityColumnName) delete(rawMsg, key) @@ -613,6 +617,37 @@ func (a *AlertDetailsOverride) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AlertPropertyMapping. +func (a AlertPropertyMapping) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "alertProperty", a.AlertProperty) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertPropertyMapping. +func (a *AlertPropertyMapping) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertProperty": + err = unpopulate(val, "AlertProperty", &a.AlertProperty) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &a.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AlertRule. func (a AlertRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -823,6 +858,136 @@ func (a *AlertsDataTypeOfDataConnector) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AnomalySecurityMLAnalyticsSettings. +func (a AnomalySecurityMLAnalyticsSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + objectMap["kind"] = SecurityMLAnalyticsSettingsKindAnomaly + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AnomalySecurityMLAnalyticsSettings. +func (a *AnomalySecurityMLAnalyticsSettings) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &a.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AnomalySecurityMLAnalyticsSettingsProperties. +func (a AnomalySecurityMLAnalyticsSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "anomalySettingsVersion", a.AnomalySettingsVersion) + populate(objectMap, "anomalyVersion", a.AnomalyVersion) + populateAny(objectMap, "customizableObservations", a.CustomizableObservations) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "frequency", a.Frequency) + populate(objectMap, "isDefaultSettings", a.IsDefaultSettings) + populateDateTimeRFC3339(objectMap, "lastModifiedUtc", a.LastModifiedUTC) + populate(objectMap, "requiredDataConnectors", a.RequiredDataConnectors) + populate(objectMap, "settingsDefinitionId", a.SettingsDefinitionID) + populate(objectMap, "settingsStatus", a.SettingsStatus) + populate(objectMap, "tactics", a.Tactics) + populate(objectMap, "techniques", a.Techniques) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AnomalySecurityMLAnalyticsSettingsProperties. +func (a *AnomalySecurityMLAnalyticsSettingsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "anomalySettingsVersion": + err = unpopulate(val, "AnomalySettingsVersion", &a.AnomalySettingsVersion) + delete(rawMsg, key) + case "anomalyVersion": + err = unpopulate(val, "AnomalyVersion", &a.AnomalyVersion) + delete(rawMsg, key) + case "customizableObservations": + err = unpopulate(val, "CustomizableObservations", &a.CustomizableObservations) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + delete(rawMsg, key) + case "frequency": + err = unpopulate(val, "Frequency", &a.Frequency) + delete(rawMsg, key) + case "isDefaultSettings": + err = unpopulate(val, "IsDefaultSettings", &a.IsDefaultSettings) + delete(rawMsg, key) + case "lastModifiedUtc": + err = unpopulateDateTimeRFC3339(val, "LastModifiedUTC", &a.LastModifiedUTC) + delete(rawMsg, key) + case "requiredDataConnectors": + err = unpopulate(val, "RequiredDataConnectors", &a.RequiredDataConnectors) + delete(rawMsg, key) + case "settingsDefinitionId": + err = unpopulate(val, "SettingsDefinitionID", &a.SettingsDefinitionID) + delete(rawMsg, key) + case "settingsStatus": + err = unpopulate(val, "SettingsStatus", &a.SettingsStatus) + delete(rawMsg, key) + case "tactics": + err = unpopulate(val, "Tactics", &a.Tactics) + delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &a.Techniques) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AutomationRule. func (a AutomationRule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1018,6 +1183,76 @@ func (a *AutomationRuleProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AutomationRulePropertyArrayChangedValuesCondition. +func (a AutomationRulePropertyArrayChangedValuesCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "arrayType", a.ArrayType) + populate(objectMap, "changeType", a.ChangeType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRulePropertyArrayChangedValuesCondition. +func (a *AutomationRulePropertyArrayChangedValuesCondition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "arrayType": + err = unpopulate(val, "ArrayType", &a.ArrayType) + delete(rawMsg, key) + case "changeType": + err = unpopulate(val, "ChangeType", &a.ChangeType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AutomationRulePropertyValuesChangedCondition. +func (a AutomationRulePropertyValuesChangedCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "changeType", a.ChangeType) + populate(objectMap, "operator", a.Operator) + populate(objectMap, "propertyName", a.PropertyName) + populate(objectMap, "propertyValues", a.PropertyValues) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRulePropertyValuesChangedCondition. +func (a *AutomationRulePropertyValuesChangedCondition) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "changeType": + err = unpopulate(val, "ChangeType", &a.ChangeType) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &a.Operator) + delete(rawMsg, key) + case "propertyName": + err = unpopulate(val, "PropertyName", &a.PropertyName) + delete(rawMsg, key) + case "propertyValues": + err = unpopulate(val, "PropertyValues", &a.PropertyValues) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AutomationRulePropertyValuesCondition. func (a AutomationRulePropertyValuesCondition) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1298,6 +1533,37 @@ func (a *AwsCloudTrailDataConnectorProperties) UnmarshalJSON(data []byte) error return nil } +// MarshalJSON implements the json.Marshaller interface for type AzureDevOpsResourceInfo. +func (a AzureDevOpsResourceInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "pipelineId", a.PipelineID) + populate(objectMap, "serviceConnectionId", a.ServiceConnectionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDevOpsResourceInfo. +func (a *AzureDevOpsResourceInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "pipelineId": + err = unpopulate(val, "PipelineID", &a.PipelineID) + delete(rawMsg, key) + case "serviceConnectionId": + err = unpopulate(val, "ServiceConnectionID", &a.ServiceConnectionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type AzureResourceEntity. func (a AzureResourceEntity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -1865,6 +2131,84 @@ func (d *DataConnectorList) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Deployment. +func (d Deployment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "deploymentId", d.DeploymentID) + populate(objectMap, "deploymentLogsUrl", d.DeploymentLogsURL) + populate(objectMap, "deploymentResult", d.DeploymentResult) + populate(objectMap, "deploymentState", d.DeploymentState) + populateDateTimeRFC3339(objectMap, "deploymentTime", d.DeploymentTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Deployment. +func (d *Deployment) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "deploymentId": + err = unpopulate(val, "DeploymentID", &d.DeploymentID) + delete(rawMsg, key) + case "deploymentLogsUrl": + err = unpopulate(val, "DeploymentLogsURL", &d.DeploymentLogsURL) + delete(rawMsg, key) + case "deploymentResult": + err = unpopulate(val, "DeploymentResult", &d.DeploymentResult) + delete(rawMsg, key) + case "deploymentState": + err = unpopulate(val, "DeploymentState", &d.DeploymentState) + delete(rawMsg, key) + case "deploymentTime": + err = unpopulateDateTimeRFC3339(val, "DeploymentTime", &d.DeploymentTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DeploymentInfo. +func (d DeploymentInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "deployment", d.Deployment) + populate(objectMap, "deploymentFetchStatus", d.DeploymentFetchStatus) + populate(objectMap, "message", d.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentInfo. +func (d *DeploymentInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "deployment": + err = unpopulate(val, "Deployment", &d.Deployment) + delete(rawMsg, key) + case "deploymentFetchStatus": + err = unpopulate(val, "DeploymentFetchStatus", &d.DeploymentFetchStatus) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &d.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", d, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Entity. func (e Entity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2238,6 +2582,7 @@ func (f FusionAlertRuleProperties) MarshalJSON() ([]byte, error) { populateDateTimeRFC3339(objectMap, "lastModifiedUtc", f.LastModifiedUTC) populate(objectMap, "severity", f.Severity) populate(objectMap, "tactics", f.Tactics) + populate(objectMap, "techniques", f.Techniques) return json.Marshal(objectMap) } @@ -2271,6 +2616,9 @@ func (f *FusionAlertRuleProperties) UnmarshalJSON(data []byte) error { case "tactics": err = unpopulate(val, "Tactics", &f.Tactics) delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &f.Techniques) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", f, err) @@ -2338,6 +2686,7 @@ func (f FusionAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "severity", f.Severity) populate(objectMap, "status", f.Status) populate(objectMap, "tactics", f.Tactics) + populate(objectMap, "techniques", f.Techniques) return json.Marshal(objectMap) } @@ -2377,6 +2726,9 @@ func (f *FusionAlertRuleTemplateProperties) UnmarshalJSON(data []byte) error { case "tactics": err = unpopulate(val, "Tactics", &f.Tactics) delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &f.Techniques) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", f, err) @@ -2436,6 +2788,33 @@ func (g *GeoLocation) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type GitHubResourceInfo. +func (g GitHubResourceInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "appInstallationId", g.AppInstallationID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GitHubResourceInfo. +func (g *GitHubResourceInfo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "appInstallationId": + err = unpopulate(val, "AppInstallationID", &g.AppInstallationID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", g, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type GroupingConfiguration. func (g GroupingConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2867,6 +3246,7 @@ func (i IncidentAdditionalData) MarshalJSON() ([]byte, error) { populate(objectMap, "alertsCount", i.AlertsCount) populate(objectMap, "bookmarksCount", i.BookmarksCount) populate(objectMap, "commentsCount", i.CommentsCount) + populate(objectMap, "providerIncidentUrl", i.ProviderIncidentURL) populate(objectMap, "tactics", i.Tactics) return json.Marshal(objectMap) } @@ -2892,6 +3272,9 @@ func (i *IncidentAdditionalData) UnmarshalJSON(data []byte) error { case "commentsCount": err = unpopulate(val, "CommentsCount", &i.CommentsCount) delete(rawMsg, key) + case "providerIncidentUrl": + err = unpopulate(val, "ProviderIncidentURL", &i.ProviderIncidentURL) + delete(rawMsg, key) case "tactics": err = unpopulate(val, "Tactics", &i.Tactics) delete(rawMsg, key) @@ -3274,52 +3657,13 @@ func (i IncidentOwnerInfo) MarshalJSON() ([]byte, error) { populate(objectMap, "assignedTo", i.AssignedTo) populate(objectMap, "email", i.Email) populate(objectMap, "objectId", i.ObjectID) + populate(objectMap, "ownerType", i.OwnerType) populate(objectMap, "userPrincipalName", i.UserPrincipalName) return json.Marshal(objectMap) } // UnmarshalJSON implements the json.Unmarshaller interface for type IncidentOwnerInfo. func (i *IncidentOwnerInfo) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assignedTo": - err = unpopulate(val, "AssignedTo", &i.AssignedTo) - delete(rawMsg, key) - case "email": - err = unpopulate(val, "Email", &i.Email) - delete(rawMsg, key) - case "objectId": - err = unpopulate(val, "ObjectID", &i.ObjectID) - delete(rawMsg, key) - case "userPrincipalName": - err = unpopulate(val, "UserPrincipalName", &i.UserPrincipalName) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", i, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type IncidentOwnerInfoAutoGenerated. -func (i IncidentOwnerInfoAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "assignedTo", i.AssignedTo) - populate(objectMap, "email", i.Email) - populate(objectMap, "objectId", i.ObjectID) - populate(objectMap, "ownerType", i.OwnerType) - populate(objectMap, "userPrincipalName", i.UserPrincipalName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IncidentOwnerInfoAutoGenerated. -func (i *IncidentOwnerInfoAutoGenerated) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", i, err) @@ -3366,6 +3710,8 @@ func (i IncidentProperties) MarshalJSON() ([]byte, error) { populateDateTimeRFC3339(objectMap, "lastActivityTimeUtc", i.LastActivityTimeUTC) populateDateTimeRFC3339(objectMap, "lastModifiedTimeUtc", i.LastModifiedTimeUTC) populate(objectMap, "owner", i.Owner) + populate(objectMap, "providerIncidentId", i.ProviderIncidentID) + populate(objectMap, "providerName", i.ProviderName) populate(objectMap, "relatedAnalyticRuleIds", i.RelatedAnalyticRuleIDs) populate(objectMap, "severity", i.Severity) populate(objectMap, "status", i.Status) @@ -3421,6 +3767,12 @@ func (i *IncidentProperties) UnmarshalJSON(data []byte) error { case "owner": err = unpopulate(val, "Owner", &i.Owner) delete(rawMsg, key) + case "providerIncidentId": + err = unpopulate(val, "ProviderIncidentID", &i.ProviderIncidentID) + delete(rawMsg, key) + case "providerName": + err = unpopulate(val, "ProviderName", &i.ProviderName) + delete(rawMsg, key) case "relatedAnalyticRuleIds": err = unpopulate(val, "RelatedAnalyticRuleIDs", &i.RelatedAnalyticRuleIDs) delete(rawMsg, key) @@ -4337,21 +4689,17 @@ func (m *MalwareEntityProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRule. -func (m MicrosoftSecurityIncidentCreationAlertRule) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MetadataAuthor. +func (m MetadataAuthor) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "etag", m.Etag) - populate(objectMap, "id", m.ID) - objectMap["kind"] = AlertRuleKindMicrosoftSecurityIncidentCreation + populate(objectMap, "email", m.Email) + populate(objectMap, "link", m.Link) populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "type", m.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftSecurityIncidentCreationAlertRule. -func (m *MicrosoftSecurityIncidentCreationAlertRule) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataAuthor. +func (m *MetadataAuthor) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -4359,27 +4707,15 @@ func (m *MicrosoftSecurityIncidentCreationAlertRule) UnmarshalJSON(data []byte) for key, val := range rawMsg { var err error switch key { - case "etag": - err = unpopulate(val, "Etag", &m.Etag) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &m.ID) + case "email": + err = unpopulate(val, "Email", &m.Email) delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &m.Kind) + case "link": + err = unpopulate(val, "Link", &m.Link) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -4388,23 +4724,16 @@ func (m *MicrosoftSecurityIncidentCreationAlertRule) UnmarshalJSON(data []byte) return nil } -// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleProperties. -func (m MicrosoftSecurityIncidentCreationAlertRuleProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MetadataCategories. +func (m MetadataCategories) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "alertRuleTemplateName", m.AlertRuleTemplateName) - populate(objectMap, "description", m.Description) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "displayNamesExcludeFilter", m.DisplayNamesExcludeFilter) - populate(objectMap, "displayNamesFilter", m.DisplayNamesFilter) - populate(objectMap, "enabled", m.Enabled) - populateDateTimeRFC3339(objectMap, "lastModifiedUtc", m.LastModifiedUTC) - populate(objectMap, "productFilter", m.ProductFilter) - populate(objectMap, "severitiesFilter", m.SeveritiesFilter) + populate(objectMap, "domains", m.Domains) + populate(objectMap, "verticals", m.Verticals) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleProperties. -func (m *MicrosoftSecurityIncidentCreationAlertRuleProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataCategories. +func (m *MetadataCategories) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -4412,32 +4741,11 @@ func (m *MicrosoftSecurityIncidentCreationAlertRuleProperties) UnmarshalJSON(dat for key, val := range rawMsg { var err error switch key { - case "alertRuleTemplateName": - err = unpopulate(val, "AlertRuleTemplateName", &m.AlertRuleTemplateName) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) - delete(rawMsg, key) - case "displayNamesExcludeFilter": - err = unpopulate(val, "DisplayNamesExcludeFilter", &m.DisplayNamesExcludeFilter) - delete(rawMsg, key) - case "displayNamesFilter": - err = unpopulate(val, "DisplayNamesFilter", &m.DisplayNamesFilter) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &m.Enabled) - delete(rawMsg, key) - case "lastModifiedUtc": - err = unpopulateDateTimeRFC3339(val, "LastModifiedUTC", &m.LastModifiedUTC) + case "domains": + err = unpopulate(val, "Domains", &m.Domains) delete(rawMsg, key) - case "productFilter": - err = unpopulate(val, "ProductFilter", &m.ProductFilter) - delete(rawMsg, key) - case "severitiesFilter": - err = unpopulate(val, "SeveritiesFilter", &m.SeveritiesFilter) + case "verticals": + err = unpopulate(val, "Verticals", &m.Verticals) delete(rawMsg, key) } if err != nil { @@ -4447,20 +4755,20 @@ func (m *MicrosoftSecurityIncidentCreationAlertRuleProperties) UnmarshalJSON(dat return nil } -// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleTemplate. -func (m MicrosoftSecurityIncidentCreationAlertRuleTemplate) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MetadataDependencies. +func (m MetadataDependencies) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", m.ID) - objectMap["kind"] = AlertRuleKindMicrosoftSecurityIncidentCreation + populate(objectMap, "contentId", m.ContentID) + populate(objectMap, "criteria", m.Criteria) + populate(objectMap, "kind", m.Kind) populate(objectMap, "name", m.Name) - populate(objectMap, "properties", m.Properties) - populate(objectMap, "systemData", m.SystemData) - populate(objectMap, "type", m.Type) + populate(objectMap, "operator", m.Operator) + populate(objectMap, "version", m.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleTemplate. -func (m *MicrosoftSecurityIncidentCreationAlertRuleTemplate) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataDependencies. +func (m *MetadataDependencies) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -4468,8 +4776,11 @@ func (m *MicrosoftSecurityIncidentCreationAlertRuleTemplate) UnmarshalJSON(data for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &m.ID) + case "contentId": + err = unpopulate(val, "ContentID", &m.ContentID) + delete(rawMsg, key) + case "criteria": + err = unpopulate(val, "Criteria", &m.Criteria) delete(rawMsg, key) case "kind": err = unpopulate(val, "Kind", &m.Kind) @@ -4477,14 +4788,11 @@ func (m *MicrosoftSecurityIncidentCreationAlertRuleTemplate) UnmarshalJSON(data case "name": err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &m.Properties) - delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &m.SystemData) + case "operator": + err = unpopulate(val, "Operator", &m.Operator) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &m.Type) + case "version": + err = unpopulate(val, "Version", &m.Version) delete(rawMsg, key) } if err != nil { @@ -4494,25 +4802,16 @@ func (m *MicrosoftSecurityIncidentCreationAlertRuleTemplate) UnmarshalJSON(data return nil } -// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties. -func (m MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MetadataList. +func (m MetadataList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "alertRulesCreatedByTemplateCount", m.AlertRulesCreatedByTemplateCount) - populateDateTimeRFC3339(objectMap, "createdDateUTC", m.CreatedDateUTC) - populate(objectMap, "description", m.Description) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "displayNamesExcludeFilter", m.DisplayNamesExcludeFilter) - populate(objectMap, "displayNamesFilter", m.DisplayNamesFilter) - populateDateTimeRFC3339(objectMap, "lastUpdatedDateUTC", m.LastUpdatedDateUTC) - populate(objectMap, "productFilter", m.ProductFilter) - populate(objectMap, "requiredDataConnectors", m.RequiredDataConnectors) - populate(objectMap, "severitiesFilter", m.SeveritiesFilter) - populate(objectMap, "status", m.Status) + populate(objectMap, "nextLink", m.NextLink) + populate(objectMap, "value", m.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties. -func (m *MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataList. +func (m *MetadataList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", m, err) @@ -4520,38 +4819,11 @@ func (m *MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties) Unmarshal for key, val := range rawMsg { var err error switch key { - case "alertRulesCreatedByTemplateCount": - err = unpopulate(val, "AlertRulesCreatedByTemplateCount", &m.AlertRulesCreatedByTemplateCount) - delete(rawMsg, key) - case "createdDateUTC": - err = unpopulateDateTimeRFC3339(val, "CreatedDateUTC", &m.CreatedDateUTC) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) - delete(rawMsg, key) - case "displayNamesExcludeFilter": - err = unpopulate(val, "DisplayNamesExcludeFilter", &m.DisplayNamesExcludeFilter) - delete(rawMsg, key) - case "displayNamesFilter": - err = unpopulate(val, "DisplayNamesFilter", &m.DisplayNamesFilter) - delete(rawMsg, key) - case "lastUpdatedDateUTC": - err = unpopulateDateTimeRFC3339(val, "LastUpdatedDateUTC", &m.LastUpdatedDateUTC) - delete(rawMsg, key) - case "productFilter": - err = unpopulate(val, "ProductFilter", &m.ProductFilter) - delete(rawMsg, key) - case "requiredDataConnectors": - err = unpopulate(val, "RequiredDataConnectors", &m.RequiredDataConnectors) - delete(rawMsg, key) - case "severitiesFilter": - err = unpopulate(val, "SeveritiesFilter", &m.SeveritiesFilter) + case "nextLink": + err = unpopulate(val, "NextLink", &m.NextLink) delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &m.Status) + case "value": + err = unpopulate(val, "Value", &m.Value) delete(rawMsg, key) } if err != nil { @@ -4561,128 +4833,825 @@ func (m *MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties) Unmarshal return nil } -// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnector. -func (o OfficeDataConnector) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MetadataModel. +func (m MetadataModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "etag", o.Etag) - populate(objectMap, "id", o.ID) - objectMap["kind"] = DataConnectorKindOffice365 - populate(objectMap, "name", o.Name) - populate(objectMap, "properties", o.Properties) - populate(objectMap, "systemData", o.SystemData) - populate(objectMap, "type", o.Type) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnector. -func (o *OfficeDataConnector) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataModel. +func (m *MetadataModel) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { case "etag": - err = unpopulate(val, "Etag", &o.Etag) + err = unpopulate(val, "Etag", &m.Etag) delete(rawMsg, key) case "id": - err = unpopulate(val, "ID", &o.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &o.Kind) + err = unpopulate(val, "ID", &m.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &o.Name) + err = unpopulate(val, "Name", &m.Name) delete(rawMsg, key) case "properties": - err = unpopulate(val, "Properties", &o.Properties) + err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) case "systemData": - err = unpopulate(val, "SystemData", &o.SystemData) + err = unpopulate(val, "SystemData", &m.SystemData) delete(rawMsg, key) case "type": - err = unpopulate(val, "Type", &o.Type) + err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnectorDataTypes. -func (o OfficeDataConnectorDataTypes) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MetadataPatch. +func (m MetadataPatch) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "exchange", o.Exchange) - populate(objectMap, "sharePoint", o.SharePoint) - populate(objectMap, "teams", o.Teams) + populate(objectMap, "properties", m.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnectorDataTypes. -func (o *OfficeDataConnectorDataTypes) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataPatch. +func (m *MetadataPatch) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "exchange": - err = unpopulate(val, "Exchange", &o.Exchange) - delete(rawMsg, key) - case "sharePoint": - err = unpopulate(val, "SharePoint", &o.SharePoint) - delete(rawMsg, key) - case "teams": - err = unpopulate(val, "Teams", &o.Teams) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnectorDataTypesExchange. -func (o OfficeDataConnectorDataTypesExchange) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type MetadataProperties. +func (m MetadataProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "state", o.State) + populate(objectMap, "author", m.Author) + populate(objectMap, "categories", m.Categories) + populate(objectMap, "contentId", m.ContentID) + populate(objectMap, "contentSchemaVersion", m.ContentSchemaVersion) + populate(objectMap, "customVersion", m.CustomVersion) + populate(objectMap, "dependencies", m.Dependencies) + populateDateType(objectMap, "firstPublishDate", m.FirstPublishDate) + populate(objectMap, "icon", m.Icon) + populate(objectMap, "kind", m.Kind) + populateDateType(objectMap, "lastPublishDate", m.LastPublishDate) + populate(objectMap, "parentId", m.ParentID) + populate(objectMap, "previewImages", m.PreviewImages) + populate(objectMap, "previewImagesDark", m.PreviewImagesDark) + populate(objectMap, "providers", m.Providers) + populate(objectMap, "source", m.Source) + populate(objectMap, "support", m.Support) + populate(objectMap, "threatAnalysisTactics", m.ThreatAnalysisTactics) + populate(objectMap, "threatAnalysisTechniques", m.ThreatAnalysisTechniques) + populate(objectMap, "version", m.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnectorDataTypesExchange. -func (o *OfficeDataConnectorDataTypesExchange) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataProperties. +func (m *MetadataProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", m, err) } for key, val := range rawMsg { var err error switch key { - case "state": - err = unpopulate(val, "State", &o.State) + case "author": + err = unpopulate(val, "Author", &m.Author) delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnectorDataTypesSharePoint. -func (o OfficeDataConnectorDataTypesSharePoint) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "state", o.State) - return json.Marshal(objectMap) + case "categories": + err = unpopulate(val, "Categories", &m.Categories) + delete(rawMsg, key) + case "contentId": + err = unpopulate(val, "ContentID", &m.ContentID) + delete(rawMsg, key) + case "contentSchemaVersion": + err = unpopulate(val, "ContentSchemaVersion", &m.ContentSchemaVersion) + delete(rawMsg, key) + case "customVersion": + err = unpopulate(val, "CustomVersion", &m.CustomVersion) + delete(rawMsg, key) + case "dependencies": + err = unpopulate(val, "Dependencies", &m.Dependencies) + delete(rawMsg, key) + case "firstPublishDate": + err = unpopulateDateType(val, "FirstPublishDate", &m.FirstPublishDate) + delete(rawMsg, key) + case "icon": + err = unpopulate(val, "Icon", &m.Icon) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "lastPublishDate": + err = unpopulateDateType(val, "LastPublishDate", &m.LastPublishDate) + delete(rawMsg, key) + case "parentId": + err = unpopulate(val, "ParentID", &m.ParentID) + delete(rawMsg, key) + case "previewImages": + err = unpopulate(val, "PreviewImages", &m.PreviewImages) + delete(rawMsg, key) + case "previewImagesDark": + err = unpopulate(val, "PreviewImagesDark", &m.PreviewImagesDark) + delete(rawMsg, key) + case "providers": + err = unpopulate(val, "Providers", &m.Providers) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &m.Source) + delete(rawMsg, key) + case "support": + err = unpopulate(val, "Support", &m.Support) + delete(rawMsg, key) + case "threatAnalysisTactics": + err = unpopulate(val, "ThreatAnalysisTactics", &m.ThreatAnalysisTactics) + delete(rawMsg, key) + case "threatAnalysisTechniques": + err = unpopulate(val, "ThreatAnalysisTechniques", &m.ThreatAnalysisTechniques) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &m.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetadataPropertiesPatch. +func (m MetadataPropertiesPatch) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "author", m.Author) + populate(objectMap, "categories", m.Categories) + populate(objectMap, "contentId", m.ContentID) + populate(objectMap, "contentSchemaVersion", m.ContentSchemaVersion) + populate(objectMap, "customVersion", m.CustomVersion) + populate(objectMap, "dependencies", m.Dependencies) + populateDateType(objectMap, "firstPublishDate", m.FirstPublishDate) + populate(objectMap, "icon", m.Icon) + populate(objectMap, "kind", m.Kind) + populateDateType(objectMap, "lastPublishDate", m.LastPublishDate) + populate(objectMap, "parentId", m.ParentID) + populate(objectMap, "previewImages", m.PreviewImages) + populate(objectMap, "previewImagesDark", m.PreviewImagesDark) + populate(objectMap, "providers", m.Providers) + populate(objectMap, "source", m.Source) + populate(objectMap, "support", m.Support) + populate(objectMap, "threatAnalysisTactics", m.ThreatAnalysisTactics) + populate(objectMap, "threatAnalysisTechniques", m.ThreatAnalysisTechniques) + populate(objectMap, "version", m.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataPropertiesPatch. +func (m *MetadataPropertiesPatch) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "author": + err = unpopulate(val, "Author", &m.Author) + delete(rawMsg, key) + case "categories": + err = unpopulate(val, "Categories", &m.Categories) + delete(rawMsg, key) + case "contentId": + err = unpopulate(val, "ContentID", &m.ContentID) + delete(rawMsg, key) + case "contentSchemaVersion": + err = unpopulate(val, "ContentSchemaVersion", &m.ContentSchemaVersion) + delete(rawMsg, key) + case "customVersion": + err = unpopulate(val, "CustomVersion", &m.CustomVersion) + delete(rawMsg, key) + case "dependencies": + err = unpopulate(val, "Dependencies", &m.Dependencies) + delete(rawMsg, key) + case "firstPublishDate": + err = unpopulateDateType(val, "FirstPublishDate", &m.FirstPublishDate) + delete(rawMsg, key) + case "icon": + err = unpopulate(val, "Icon", &m.Icon) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "lastPublishDate": + err = unpopulateDateType(val, "LastPublishDate", &m.LastPublishDate) + delete(rawMsg, key) + case "parentId": + err = unpopulate(val, "ParentID", &m.ParentID) + delete(rawMsg, key) + case "previewImages": + err = unpopulate(val, "PreviewImages", &m.PreviewImages) + delete(rawMsg, key) + case "previewImagesDark": + err = unpopulate(val, "PreviewImagesDark", &m.PreviewImagesDark) + delete(rawMsg, key) + case "providers": + err = unpopulate(val, "Providers", &m.Providers) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &m.Source) + delete(rawMsg, key) + case "support": + err = unpopulate(val, "Support", &m.Support) + delete(rawMsg, key) + case "threatAnalysisTactics": + err = unpopulate(val, "ThreatAnalysisTactics", &m.ThreatAnalysisTactics) + delete(rawMsg, key) + case "threatAnalysisTechniques": + err = unpopulate(val, "ThreatAnalysisTechniques", &m.ThreatAnalysisTechniques) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &m.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetadataSource. +func (m MetadataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "kind", m.Kind) + populate(objectMap, "name", m.Name) + populate(objectMap, "sourceId", m.SourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataSource. +func (m *MetadataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "sourceId": + err = unpopulate(val, "SourceID", &m.SourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MetadataSupport. +func (m MetadataSupport) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "email", m.Email) + populate(objectMap, "link", m.Link) + populate(objectMap, "name", m.Name) + populate(objectMap, "tier", m.Tier) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MetadataSupport. +func (m *MetadataSupport) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "email": + err = unpopulate(val, "Email", &m.Email) + delete(rawMsg, key) + case "link": + err = unpopulate(val, "Link", &m.Link) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "tier": + err = unpopulate(val, "Tier", &m.Tier) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRule. +func (m MicrosoftSecurityIncidentCreationAlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", m.Etag) + populate(objectMap, "id", m.ID) + objectMap["kind"] = AlertRuleKindMicrosoftSecurityIncidentCreation + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftSecurityIncidentCreationAlertRule. +func (m *MicrosoftSecurityIncidentCreationAlertRule) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &m.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleProperties. +func (m MicrosoftSecurityIncidentCreationAlertRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "alertRuleTemplateName", m.AlertRuleTemplateName) + populate(objectMap, "description", m.Description) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "displayNamesExcludeFilter", m.DisplayNamesExcludeFilter) + populate(objectMap, "displayNamesFilter", m.DisplayNamesFilter) + populate(objectMap, "enabled", m.Enabled) + populateDateTimeRFC3339(objectMap, "lastModifiedUtc", m.LastModifiedUTC) + populate(objectMap, "productFilter", m.ProductFilter) + populate(objectMap, "severitiesFilter", m.SeveritiesFilter) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleProperties. +func (m *MicrosoftSecurityIncidentCreationAlertRuleProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertRuleTemplateName": + err = unpopulate(val, "AlertRuleTemplateName", &m.AlertRuleTemplateName) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "displayNamesExcludeFilter": + err = unpopulate(val, "DisplayNamesExcludeFilter", &m.DisplayNamesExcludeFilter) + delete(rawMsg, key) + case "displayNamesFilter": + err = unpopulate(val, "DisplayNamesFilter", &m.DisplayNamesFilter) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &m.Enabled) + delete(rawMsg, key) + case "lastModifiedUtc": + err = unpopulateDateTimeRFC3339(val, "LastModifiedUTC", &m.LastModifiedUTC) + delete(rawMsg, key) + case "productFilter": + err = unpopulate(val, "ProductFilter", &m.ProductFilter) + delete(rawMsg, key) + case "severitiesFilter": + err = unpopulate(val, "SeveritiesFilter", &m.SeveritiesFilter) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleTemplate. +func (m MicrosoftSecurityIncidentCreationAlertRuleTemplate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", m.ID) + objectMap["kind"] = AlertRuleKindMicrosoftSecurityIncidentCreation + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleTemplate. +func (m *MicrosoftSecurityIncidentCreationAlertRuleTemplate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &m.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &m.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &m.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties. +func (m MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "alertRulesCreatedByTemplateCount", m.AlertRulesCreatedByTemplateCount) + populateDateTimeRFC3339(objectMap, "createdDateUTC", m.CreatedDateUTC) + populate(objectMap, "description", m.Description) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "displayNamesExcludeFilter", m.DisplayNamesExcludeFilter) + populate(objectMap, "displayNamesFilter", m.DisplayNamesFilter) + populateDateTimeRFC3339(objectMap, "lastUpdatedDateUTC", m.LastUpdatedDateUTC) + populate(objectMap, "productFilter", m.ProductFilter) + populate(objectMap, "requiredDataConnectors", m.RequiredDataConnectors) + populate(objectMap, "severitiesFilter", m.SeveritiesFilter) + populate(objectMap, "status", m.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties. +func (m *MicrosoftSecurityIncidentCreationAlertRuleTemplateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertRulesCreatedByTemplateCount": + err = unpopulate(val, "AlertRulesCreatedByTemplateCount", &m.AlertRulesCreatedByTemplateCount) + delete(rawMsg, key) + case "createdDateUTC": + err = unpopulateDateTimeRFC3339(val, "CreatedDateUTC", &m.CreatedDateUTC) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "displayNamesExcludeFilter": + err = unpopulate(val, "DisplayNamesExcludeFilter", &m.DisplayNamesExcludeFilter) + delete(rawMsg, key) + case "displayNamesFilter": + err = unpopulate(val, "DisplayNamesFilter", &m.DisplayNamesFilter) + delete(rawMsg, key) + case "lastUpdatedDateUTC": + err = unpopulateDateTimeRFC3339(val, "LastUpdatedDateUTC", &m.LastUpdatedDateUTC) + delete(rawMsg, key) + case "productFilter": + err = unpopulate(val, "ProductFilter", &m.ProductFilter) + delete(rawMsg, key) + case "requiredDataConnectors": + err = unpopulate(val, "RequiredDataConnectors", &m.RequiredDataConnectors) + delete(rawMsg, key) + case "severitiesFilter": + err = unpopulate(val, "SeveritiesFilter", &m.SeveritiesFilter) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &m.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", m, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnector. +func (o OfficeDataConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", o.Etag) + populate(objectMap, "id", o.ID) + objectMap["kind"] = DataConnectorKindOffice365 + populate(objectMap, "name", o.Name) + populate(objectMap, "properties", o.Properties) + populate(objectMap, "systemData", o.SystemData) + populate(objectMap, "type", o.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnector. +func (o *OfficeDataConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &o.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &o.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &o.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &o.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &o.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnectorDataTypes. +func (o OfficeDataConnectorDataTypes) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "exchange", o.Exchange) + populate(objectMap, "sharePoint", o.SharePoint) + populate(objectMap, "teams", o.Teams) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnectorDataTypes. +func (o *OfficeDataConnectorDataTypes) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "exchange": + err = unpopulate(val, "Exchange", &o.Exchange) + delete(rawMsg, key) + case "sharePoint": + err = unpopulate(val, "SharePoint", &o.SharePoint) + delete(rawMsg, key) + case "teams": + err = unpopulate(val, "Teams", &o.Teams) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnectorDataTypesExchange. +func (o OfficeDataConnectorDataTypesExchange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "state", o.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnectorDataTypesExchange. +func (o *OfficeDataConnectorDataTypesExchange) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &o.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnectorDataTypesSharePoint. +func (o OfficeDataConnectorDataTypesSharePoint) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "state", o.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnectorDataTypesSharePoint. +func (o *OfficeDataConnectorDataTypesSharePoint) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &o.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnectorDataTypesTeams. +func (o OfficeDataConnectorDataTypesTeams) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "state", o.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnectorDataTypesTeams. +func (o *OfficeDataConnectorDataTypesTeams) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &o.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnectorProperties. +func (o OfficeDataConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "dataTypes", o.DataTypes) + populate(objectMap, "tenantId", o.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnectorProperties. +func (o *OfficeDataConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "dataTypes": + err = unpopulate(val, "DataTypes", &o.DataTypes) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &o.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Operation. +func (o Operation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) + populate(objectMap, "name", o.Name) + populate(objectMap, "origin", o.Origin) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. +func (o *Operation) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "display": + err = unpopulate(val, "Display", &o.Display) + delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &o.Name) + delete(rawMsg, key) + case "origin": + err = unpopulate(val, "Origin", &o.Origin) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. +func (o OperationDisplay) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", o.Description) + populate(objectMap, "operation", o.Operation) + populate(objectMap, "provider", o.Provider) + populate(objectMap, "resource", o.Resource) + return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnectorDataTypesSharePoint. -func (o *OfficeDataConnectorDataTypesSharePoint) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. +func (o *OperationDisplay) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) @@ -4690,8 +5659,17 @@ func (o *OfficeDataConnectorDataTypesSharePoint) UnmarshalJSON(data []byte) erro for key, val := range rawMsg { var err error switch key { - case "state": - err = unpopulate(val, "State", &o.State) + case "description": + err = unpopulate(val, "Description", &o.Description) + delete(rawMsg, key) + case "operation": + err = unpopulate(val, "Operation", &o.Operation) + delete(rawMsg, key) + case "provider": + err = unpopulate(val, "Provider", &o.Provider) + delete(rawMsg, key) + case "resource": + err = unpopulate(val, "Resource", &o.Resource) delete(rawMsg, key) } if err != nil { @@ -4701,15 +5679,16 @@ func (o *OfficeDataConnectorDataTypesSharePoint) UnmarshalJSON(data []byte) erro return nil } -// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnectorDataTypesTeams. -func (o OfficeDataConnectorDataTypesTeams) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationsList. +func (o OperationsList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "state", o.State) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnectorDataTypesTeams. -func (o *OfficeDataConnectorDataTypesTeams) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationsList. +func (o *OperationsList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", o, err) @@ -4717,167 +5696,608 @@ func (o *OfficeDataConnectorDataTypesTeams) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "state": - err = unpopulate(val, "State", &o.State) + case "nextLink": + err = unpopulate(val, "NextLink", &o.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &o.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PackageList. +func (p PackageList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageList. +func (p *PackageList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PackageModel. +func (p PackageModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageModel. +func (p *PackageModel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &p.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PackageProperties. +func (p PackageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "author", p.Author) + populate(objectMap, "categories", p.Categories) + populate(objectMap, "contentId", p.ContentID) + populate(objectMap, "contentKind", p.ContentKind) + populate(objectMap, "contentProductId", p.ContentProductID) + populate(objectMap, "contentSchemaVersion", p.ContentSchemaVersion) + populate(objectMap, "dependencies", p.Dependencies) + populate(objectMap, "description", p.Description) + populate(objectMap, "displayName", p.DisplayName) + populateDateType(objectMap, "firstPublishDate", p.FirstPublishDate) + populate(objectMap, "icon", p.Icon) + populate(objectMap, "isDeprecated", p.IsDeprecated) + populate(objectMap, "isFeatured", p.IsFeatured) + populate(objectMap, "isNew", p.IsNew) + populate(objectMap, "isPreview", p.IsPreview) + populateDateType(objectMap, "lastPublishDate", p.LastPublishDate) + populate(objectMap, "providers", p.Providers) + populate(objectMap, "publisherDisplayName", p.PublisherDisplayName) + populate(objectMap, "source", p.Source) + populate(objectMap, "support", p.Support) + populate(objectMap, "threatAnalysisTactics", p.ThreatAnalysisTactics) + populate(objectMap, "threatAnalysisTechniques", p.ThreatAnalysisTechniques) + populate(objectMap, "version", p.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PackageProperties. +func (p *PackageProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "author": + err = unpopulate(val, "Author", &p.Author) + delete(rawMsg, key) + case "categories": + err = unpopulate(val, "Categories", &p.Categories) + delete(rawMsg, key) + case "contentId": + err = unpopulate(val, "ContentID", &p.ContentID) + delete(rawMsg, key) + case "contentKind": + err = unpopulate(val, "ContentKind", &p.ContentKind) + delete(rawMsg, key) + case "contentProductId": + err = unpopulate(val, "ContentProductID", &p.ContentProductID) + delete(rawMsg, key) + case "contentSchemaVersion": + err = unpopulate(val, "ContentSchemaVersion", &p.ContentSchemaVersion) + delete(rawMsg, key) + case "dependencies": + err = unpopulate(val, "Dependencies", &p.Dependencies) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "firstPublishDate": + err = unpopulateDateType(val, "FirstPublishDate", &p.FirstPublishDate) + delete(rawMsg, key) + case "icon": + err = unpopulate(val, "Icon", &p.Icon) + delete(rawMsg, key) + case "isDeprecated": + err = unpopulate(val, "IsDeprecated", &p.IsDeprecated) + delete(rawMsg, key) + case "isFeatured": + err = unpopulate(val, "IsFeatured", &p.IsFeatured) + delete(rawMsg, key) + case "isNew": + err = unpopulate(val, "IsNew", &p.IsNew) + delete(rawMsg, key) + case "isPreview": + err = unpopulate(val, "IsPreview", &p.IsPreview) + delete(rawMsg, key) + case "lastPublishDate": + err = unpopulateDateType(val, "LastPublishDate", &p.LastPublishDate) + delete(rawMsg, key) + case "providers": + err = unpopulate(val, "Providers", &p.Providers) + delete(rawMsg, key) + case "publisherDisplayName": + err = unpopulate(val, "PublisherDisplayName", &p.PublisherDisplayName) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &p.Source) + delete(rawMsg, key) + case "support": + err = unpopulate(val, "Support", &p.Support) + delete(rawMsg, key) + case "threatAnalysisTactics": + err = unpopulate(val, "ThreatAnalysisTactics", &p.ThreatAnalysisTactics) + delete(rawMsg, key) + case "threatAnalysisTechniques": + err = unpopulate(val, "ThreatAnalysisTechniques", &p.ThreatAnalysisTechniques) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &p.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PlaybookActionProperties. +func (p PlaybookActionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "logicAppResourceId", p.LogicAppResourceID) + populate(objectMap, "tenantId", p.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PlaybookActionProperties. +func (p *PlaybookActionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "logicAppResourceId": + err = unpopulate(val, "LogicAppResourceID", &p.LogicAppResourceID) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &p.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProcessEntity. +func (p ProcessEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + objectMap["kind"] = EntityKindEnumProcess + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProcessEntity. +func (p *ProcessEntity) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &p.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProcessEntityProperties. +func (p ProcessEntityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accountEntityId", p.AccountEntityID) + populate(objectMap, "additionalData", p.AdditionalData) + populate(objectMap, "commandLine", p.CommandLine) + populateDateTimeRFC3339(objectMap, "creationTimeUtc", p.CreationTimeUTC) + populate(objectMap, "elevationToken", p.ElevationToken) + populate(objectMap, "friendlyName", p.FriendlyName) + populate(objectMap, "hostEntityId", p.HostEntityID) + populate(objectMap, "hostLogonSessionEntityId", p.HostLogonSessionEntityID) + populate(objectMap, "imageFileEntityId", p.ImageFileEntityID) + populate(objectMap, "parentProcessEntityId", p.ParentProcessEntityID) + populate(objectMap, "processId", p.ProcessID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProcessEntityProperties. +func (p *ProcessEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "accountEntityId": + err = unpopulate(val, "AccountEntityID", &p.AccountEntityID) + delete(rawMsg, key) + case "additionalData": + err = unpopulate(val, "AdditionalData", &p.AdditionalData) + delete(rawMsg, key) + case "commandLine": + err = unpopulate(val, "CommandLine", &p.CommandLine) + delete(rawMsg, key) + case "creationTimeUtc": + err = unpopulateDateTimeRFC3339(val, "CreationTimeUTC", &p.CreationTimeUTC) + delete(rawMsg, key) + case "elevationToken": + err = unpopulate(val, "ElevationToken", &p.ElevationToken) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &p.FriendlyName) + delete(rawMsg, key) + case "hostEntityId": + err = unpopulate(val, "HostEntityID", &p.HostEntityID) + delete(rawMsg, key) + case "hostLogonSessionEntityId": + err = unpopulate(val, "HostLogonSessionEntityID", &p.HostLogonSessionEntityID) + delete(rawMsg, key) + case "imageFileEntityId": + err = unpopulate(val, "ImageFileEntityID", &p.ImageFileEntityID) + delete(rawMsg, key) + case "parentProcessEntityId": + err = unpopulate(val, "ParentProcessEntityID", &p.ParentProcessEntityID) + delete(rawMsg, key) + case "processId": + err = unpopulate(val, "ProcessID", &p.ProcessID) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OfficeDataConnectorProperties. -func (o OfficeDataConnectorProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductPackageList. +func (p ProductPackageList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dataTypes", o.DataTypes) - populate(objectMap, "tenantId", o.TenantID) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OfficeDataConnectorProperties. -func (o *OfficeDataConnectorProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductPackageList. +func (p *ProductPackageList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "dataTypes": - err = unpopulate(val, "DataTypes", &o.DataTypes) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &o.TenantID) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type Operation. -func (o Operation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductPackageModel. +func (p ProductPackageModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "display", o.Display) - populate(objectMap, "isDataAction", o.IsDataAction) - populate(objectMap, "name", o.Name) - populate(objectMap, "origin", o.Origin) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Operation. -func (o *Operation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductPackageModel. +func (p *ProductPackageModel) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { - case "display": - err = unpopulate(val, "Display", &o.Display) + case "etag": + err = unpopulate(val, "Etag", &p.Etag) delete(rawMsg, key) - case "isDataAction": - err = unpopulate(val, "IsDataAction", &o.IsDataAction) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) case "name": - err = unpopulate(val, "Name", &o.Name) + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "origin": - err = unpopulate(val, "Origin", &o.Origin) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationDisplay. -func (o OperationDisplay) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductPackageProperties. +func (p ProductPackageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "description", o.Description) - populate(objectMap, "operation", o.Operation) - populate(objectMap, "provider", o.Provider) - populate(objectMap, "resource", o.Resource) + populate(objectMap, "author", p.Author) + populate(objectMap, "categories", p.Categories) + populate(objectMap, "contentId", p.ContentID) + populate(objectMap, "contentKind", p.ContentKind) + populate(objectMap, "contentProductId", p.ContentProductID) + populate(objectMap, "contentSchemaVersion", p.ContentSchemaVersion) + populate(objectMap, "dependencies", p.Dependencies) + populate(objectMap, "description", p.Description) + populate(objectMap, "displayName", p.DisplayName) + populateDateType(objectMap, "firstPublishDate", p.FirstPublishDate) + populate(objectMap, "icon", p.Icon) + populate(objectMap, "installedVersion", p.InstalledVersion) + populate(objectMap, "isDeprecated", p.IsDeprecated) + populate(objectMap, "isFeatured", p.IsFeatured) + populate(objectMap, "isNew", p.IsNew) + populate(objectMap, "isPreview", p.IsPreview) + populateDateType(objectMap, "lastPublishDate", p.LastPublishDate) + populate(objectMap, "metadataResourceId", p.MetadataResourceID) + populateAny(objectMap, "packagedContent", p.PackagedContent) + populate(objectMap, "providers", p.Providers) + populate(objectMap, "publisherDisplayName", p.PublisherDisplayName) + populate(objectMap, "source", p.Source) + populate(objectMap, "support", p.Support) + populate(objectMap, "threatAnalysisTactics", p.ThreatAnalysisTactics) + populate(objectMap, "threatAnalysisTechniques", p.ThreatAnalysisTechniques) + populate(objectMap, "version", p.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationDisplay. -func (o *OperationDisplay) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductPackageProperties. +func (p *ProductPackageProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { + case "author": + err = unpopulate(val, "Author", &p.Author) + delete(rawMsg, key) + case "categories": + err = unpopulate(val, "Categories", &p.Categories) + delete(rawMsg, key) + case "contentId": + err = unpopulate(val, "ContentID", &p.ContentID) + delete(rawMsg, key) + case "contentKind": + err = unpopulate(val, "ContentKind", &p.ContentKind) + delete(rawMsg, key) + case "contentProductId": + err = unpopulate(val, "ContentProductID", &p.ContentProductID) + delete(rawMsg, key) + case "contentSchemaVersion": + err = unpopulate(val, "ContentSchemaVersion", &p.ContentSchemaVersion) + delete(rawMsg, key) + case "dependencies": + err = unpopulate(val, "Dependencies", &p.Dependencies) + delete(rawMsg, key) case "description": - err = unpopulate(val, "Description", &o.Description) + err = unpopulate(val, "Description", &p.Description) delete(rawMsg, key) - case "operation": - err = unpopulate(val, "Operation", &o.Operation) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) delete(rawMsg, key) - case "provider": - err = unpopulate(val, "Provider", &o.Provider) + case "firstPublishDate": + err = unpopulateDateType(val, "FirstPublishDate", &p.FirstPublishDate) delete(rawMsg, key) - case "resource": - err = unpopulate(val, "Resource", &o.Resource) + case "icon": + err = unpopulate(val, "Icon", &p.Icon) + delete(rawMsg, key) + case "installedVersion": + err = unpopulate(val, "InstalledVersion", &p.InstalledVersion) + delete(rawMsg, key) + case "isDeprecated": + err = unpopulate(val, "IsDeprecated", &p.IsDeprecated) + delete(rawMsg, key) + case "isFeatured": + err = unpopulate(val, "IsFeatured", &p.IsFeatured) + delete(rawMsg, key) + case "isNew": + err = unpopulate(val, "IsNew", &p.IsNew) + delete(rawMsg, key) + case "isPreview": + err = unpopulate(val, "IsPreview", &p.IsPreview) + delete(rawMsg, key) + case "lastPublishDate": + err = unpopulateDateType(val, "LastPublishDate", &p.LastPublishDate) + delete(rawMsg, key) + case "metadataResourceId": + err = unpopulate(val, "MetadataResourceID", &p.MetadataResourceID) + delete(rawMsg, key) + case "packagedContent": + err = unpopulate(val, "PackagedContent", &p.PackagedContent) + delete(rawMsg, key) + case "providers": + err = unpopulate(val, "Providers", &p.Providers) + delete(rawMsg, key) + case "publisherDisplayName": + err = unpopulate(val, "PublisherDisplayName", &p.PublisherDisplayName) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &p.Source) + delete(rawMsg, key) + case "support": + err = unpopulate(val, "Support", &p.Support) + delete(rawMsg, key) + case "threatAnalysisTactics": + err = unpopulate(val, "ThreatAnalysisTactics", &p.ThreatAnalysisTactics) + delete(rawMsg, key) + case "threatAnalysisTechniques": + err = unpopulate(val, "ThreatAnalysisTechniques", &p.ThreatAnalysisTechniques) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &p.Version) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationsList. -func (o OperationsList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductTemplateList. +func (p ProductTemplateList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", o.NextLink) - populate(objectMap, "value", o.Value) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationsList. -func (o *OperationsList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductTemplateList. +func (p *ProductTemplateList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } for key, val := range rawMsg { var err error switch key { case "nextLink": - err = unpopulate(val, "NextLink", &o.NextLink) + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) case "value": - err = unpopulate(val, "Value", &o.Value) + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", o, err) + return fmt.Errorf("unmarshalling type %T: %v", p, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type PlaybookActionProperties. -func (p PlaybookActionProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductTemplateModel. +func (p ProductTemplateModel) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "logicAppResourceId", p.LogicAppResourceID) - populate(objectMap, "tenantId", p.TenantID) + populate(objectMap, "etag", p.Etag) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PlaybookActionProperties. -func (p *PlaybookActionProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductTemplateModel. +func (p *ProductTemplateModel) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -4885,11 +6305,23 @@ func (p *PlaybookActionProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "logicAppResourceId": - err = unpopulate(val, "LogicAppResourceID", &p.LogicAppResourceID) + case "etag": + err = unpopulate(val, "Etag", &p.Etag) delete(rawMsg, key) - case "tenantId": - err = unpopulate(val, "TenantID", &p.TenantID) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { @@ -4899,20 +6331,40 @@ func (p *PlaybookActionProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProcessEntity. -func (p ProcessEntity) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ProductTemplateProperties. +func (p ProductTemplateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - objectMap["kind"] = EntityKindEnumProcess - populate(objectMap, "name", p.Name) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - populate(objectMap, "type", p.Type) + populate(objectMap, "author", p.Author) + populate(objectMap, "categories", p.Categories) + populate(objectMap, "contentId", p.ContentID) + populate(objectMap, "contentKind", p.ContentKind) + populate(objectMap, "contentProductId", p.ContentProductID) + populate(objectMap, "contentSchemaVersion", p.ContentSchemaVersion) + populate(objectMap, "customVersion", p.CustomVersion) + populate(objectMap, "dependencies", p.Dependencies) + populate(objectMap, "displayName", p.DisplayName) + populateDateType(objectMap, "firstPublishDate", p.FirstPublishDate) + populate(objectMap, "icon", p.Icon) + populate(objectMap, "isDeprecated", p.IsDeprecated) + populateDateType(objectMap, "lastPublishDate", p.LastPublishDate) + populate(objectMap, "packageId", p.PackageID) + populate(objectMap, "packageKind", p.PackageKind) + populate(objectMap, "packageName", p.PackageName) + populate(objectMap, "packageVersion", p.PackageVersion) + populateAny(objectMap, "packagedContent", p.PackagedContent) + populate(objectMap, "previewImages", p.PreviewImages) + populate(objectMap, "previewImagesDark", p.PreviewImagesDark) + populate(objectMap, "providers", p.Providers) + populate(objectMap, "source", p.Source) + populate(objectMap, "support", p.Support) + populate(objectMap, "threatAnalysisTactics", p.ThreatAnalysisTactics) + populate(objectMap, "threatAnalysisTechniques", p.ThreatAnalysisTechniques) + populate(objectMap, "version", p.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProcessEntity. -func (p *ProcessEntity) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ProductTemplateProperties. +func (p *ProductTemplateProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -4920,23 +6372,83 @@ func (p *ProcessEntity) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "id": - err = unpopulate(val, "ID", &p.ID) + case "author": + err = unpopulate(val, "Author", &p.Author) delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &p.Kind) + case "categories": + err = unpopulate(val, "Categories", &p.Categories) delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &p.Name) + case "contentId": + err = unpopulate(val, "ContentID", &p.ContentID) delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &p.Properties) + case "contentKind": + err = unpopulate(val, "ContentKind", &p.ContentKind) delete(rawMsg, key) - case "systemData": - err = unpopulate(val, "SystemData", &p.SystemData) + case "contentProductId": + err = unpopulate(val, "ContentProductID", &p.ContentProductID) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &p.Type) + case "contentSchemaVersion": + err = unpopulate(val, "ContentSchemaVersion", &p.ContentSchemaVersion) + delete(rawMsg, key) + case "customVersion": + err = unpopulate(val, "CustomVersion", &p.CustomVersion) + delete(rawMsg, key) + case "dependencies": + err = unpopulate(val, "Dependencies", &p.Dependencies) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &p.DisplayName) + delete(rawMsg, key) + case "firstPublishDate": + err = unpopulateDateType(val, "FirstPublishDate", &p.FirstPublishDate) + delete(rawMsg, key) + case "icon": + err = unpopulate(val, "Icon", &p.Icon) + delete(rawMsg, key) + case "isDeprecated": + err = unpopulate(val, "IsDeprecated", &p.IsDeprecated) + delete(rawMsg, key) + case "lastPublishDate": + err = unpopulateDateType(val, "LastPublishDate", &p.LastPublishDate) + delete(rawMsg, key) + case "packageId": + err = unpopulate(val, "PackageID", &p.PackageID) + delete(rawMsg, key) + case "packageKind": + err = unpopulate(val, "PackageKind", &p.PackageKind) + delete(rawMsg, key) + case "packageName": + err = unpopulate(val, "PackageName", &p.PackageName) + delete(rawMsg, key) + case "packageVersion": + err = unpopulate(val, "PackageVersion", &p.PackageVersion) + delete(rawMsg, key) + case "packagedContent": + err = unpopulate(val, "PackagedContent", &p.PackagedContent) + delete(rawMsg, key) + case "previewImages": + err = unpopulate(val, "PreviewImages", &p.PreviewImages) + delete(rawMsg, key) + case "previewImagesDark": + err = unpopulate(val, "PreviewImagesDark", &p.PreviewImagesDark) + delete(rawMsg, key) + case "providers": + err = unpopulate(val, "Providers", &p.Providers) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &p.Source) + delete(rawMsg, key) + case "support": + err = unpopulate(val, "Support", &p.Support) + delete(rawMsg, key) + case "threatAnalysisTactics": + err = unpopulate(val, "ThreatAnalysisTactics", &p.ThreatAnalysisTactics) + delete(rawMsg, key) + case "threatAnalysisTechniques": + err = unpopulate(val, "ThreatAnalysisTechniques", &p.ThreatAnalysisTechniques) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &p.Version) delete(rawMsg, key) } if err != nil { @@ -4946,25 +6458,47 @@ func (p *ProcessEntity) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProcessEntityProperties. -func (p ProcessEntityProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PropertyArrayChangedConditionProperties. +func (p PropertyArrayChangedConditionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "accountEntityId", p.AccountEntityID) - populate(objectMap, "additionalData", p.AdditionalData) - populate(objectMap, "commandLine", p.CommandLine) - populateDateTimeRFC3339(objectMap, "creationTimeUtc", p.CreationTimeUTC) - populate(objectMap, "elevationToken", p.ElevationToken) - populate(objectMap, "friendlyName", p.FriendlyName) - populate(objectMap, "hostEntityId", p.HostEntityID) - populate(objectMap, "hostLogonSessionEntityId", p.HostLogonSessionEntityID) - populate(objectMap, "imageFileEntityId", p.ImageFileEntityID) - populate(objectMap, "parentProcessEntityId", p.ParentProcessEntityID) - populate(objectMap, "processId", p.ProcessID) + populate(objectMap, "conditionProperties", p.ConditionProperties) + objectMap["conditionType"] = ConditionTypePropertyArrayChanged + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PropertyArrayChangedConditionProperties. +func (p *PropertyArrayChangedConditionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "conditionProperties": + err = unpopulate(val, "ConditionProperties", &p.ConditionProperties) + delete(rawMsg, key) + case "conditionType": + err = unpopulate(val, "ConditionType", &p.ConditionType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PropertyChangedConditionProperties. +func (p PropertyChangedConditionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "conditionProperties", p.ConditionProperties) + objectMap["conditionType"] = ConditionTypePropertyChanged return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProcessEntityProperties. -func (p *ProcessEntityProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PropertyChangedConditionProperties. +func (p *PropertyChangedConditionProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", p, err) @@ -4972,38 +6506,11 @@ func (p *ProcessEntityProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "accountEntityId": - err = unpopulate(val, "AccountEntityID", &p.AccountEntityID) - delete(rawMsg, key) - case "additionalData": - err = unpopulate(val, "AdditionalData", &p.AdditionalData) - delete(rawMsg, key) - case "commandLine": - err = unpopulate(val, "CommandLine", &p.CommandLine) - delete(rawMsg, key) - case "creationTimeUtc": - err = unpopulateDateTimeRFC3339(val, "CreationTimeUTC", &p.CreationTimeUTC) - delete(rawMsg, key) - case "elevationToken": - err = unpopulate(val, "ElevationToken", &p.ElevationToken) - delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &p.FriendlyName) - delete(rawMsg, key) - case "hostEntityId": - err = unpopulate(val, "HostEntityID", &p.HostEntityID) - delete(rawMsg, key) - case "hostLogonSessionEntityId": - err = unpopulate(val, "HostLogonSessionEntityID", &p.HostLogonSessionEntityID) - delete(rawMsg, key) - case "imageFileEntityId": - err = unpopulate(val, "ImageFileEntityID", &p.ImageFileEntityID) - delete(rawMsg, key) - case "parentProcessEntityId": - err = unpopulate(val, "ParentProcessEntityID", &p.ParentProcessEntityID) + case "conditionProperties": + err = unpopulate(val, "ConditionProperties", &p.ConditionProperties) delete(rawMsg, key) - case "processId": - err = unpopulate(val, "ProcessID", &p.ProcessID) + case "conditionType": + err = unpopulate(val, "ConditionType", &p.ConditionType) delete(rawMsg, key) } if err != nil { @@ -5044,6 +6551,37 @@ func (p *PropertyConditionProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type PullRequest. +func (p PullRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "state", p.State) + populate(objectMap, "url", p.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PullRequest. +func (p *PullRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "state": + err = unpopulate(val, "State", &p.State) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &p.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type RegistryKeyEntity. func (r RegistryKeyEntity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -5274,13 +6812,265 @@ func (r *Relation) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RelationList. func (r RelationList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", r.NextLink) - populate(objectMap, "value", r.Value) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RelationList. +func (r *RelationList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RelationProperties. +func (r RelationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "relatedResourceId", r.RelatedResourceID) + populate(objectMap, "relatedResourceKind", r.RelatedResourceKind) + populate(objectMap, "relatedResourceName", r.RelatedResourceName) + populate(objectMap, "relatedResourceType", r.RelatedResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RelationProperties. +func (r *RelationProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "relatedResourceId": + err = unpopulate(val, "RelatedResourceID", &r.RelatedResourceID) + delete(rawMsg, key) + case "relatedResourceKind": + err = unpopulate(val, "RelatedResourceKind", &r.RelatedResourceKind) + delete(rawMsg, key) + case "relatedResourceName": + err = unpopulate(val, "RelatedResourceName", &r.RelatedResourceName) + delete(rawMsg, key) + case "relatedResourceType": + err = unpopulate(val, "RelatedResourceType", &r.RelatedResourceType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Repo. +func (r Repo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "branches", r.Branches) + populate(objectMap, "fullName", r.FullName) + populate(objectMap, "installationId", r.InstallationID) + populate(objectMap, "url", r.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Repo. +func (r *Repo) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "branches": + err = unpopulate(val, "Branches", &r.Branches) + delete(rawMsg, key) + case "fullName": + err = unpopulate(val, "FullName", &r.FullName) + delete(rawMsg, key) + case "installationId": + err = unpopulate(val, "InstallationID", &r.InstallationID) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &r.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RepoList. +func (r RepoList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RepoList. +func (r *RepoList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &r.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Repository. +func (r Repository) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "branch", r.Branch) + populate(objectMap, "deploymentLogsUrl", r.DeploymentLogsURL) + populate(objectMap, "displayUrl", r.DisplayURL) + populate(objectMap, "url", r.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Repository. +func (r *Repository) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "branch": + err = unpopulate(val, "Branch", &r.Branch) + delete(rawMsg, key) + case "deploymentLogsUrl": + err = unpopulate(val, "DeploymentLogsURL", &r.DeploymentLogsURL) + delete(rawMsg, key) + case "displayUrl": + err = unpopulate(val, "DisplayURL", &r.DisplayURL) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &r.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RepositoryAccess. +func (r RepositoryAccess) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", r.ClientID) + populate(objectMap, "code", r.Code) + populate(objectMap, "installationId", r.InstallationID) + populate(objectMap, "kind", r.Kind) + populate(objectMap, "state", r.State) + populate(objectMap, "token", r.Token) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RepositoryAccess. +func (r *RepositoryAccess) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &r.ClientID) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &r.Code) + delete(rawMsg, key) + case "installationId": + err = unpopulate(val, "InstallationID", &r.InstallationID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &r.Kind) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &r.State) + delete(rawMsg, key) + case "token": + err = unpopulate(val, "Token", &r.Token) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RepositoryAccessObject. +func (r RepositoryAccessObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "repositoryAccess", r.RepositoryAccess) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RepositoryAccessObject. +func (r *RepositoryAccessObject) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "repositoryAccess": + err = unpopulate(val, "RepositoryAccess", &r.RepositoryAccess) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", r, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RepositoryAccessProperties. +func (r RepositoryAccessProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", r.Properties) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RelationList. -func (r *RelationList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RepositoryAccessProperties. +func (r *RepositoryAccessProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -5288,11 +7078,8 @@ func (r *RelationList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &r.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &r.Value) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) } if err != nil { @@ -5302,18 +7089,17 @@ func (r *RelationList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type RelationProperties. -func (r RelationProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type RepositoryResourceInfo. +func (r RepositoryResourceInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "relatedResourceId", r.RelatedResourceID) - populate(objectMap, "relatedResourceKind", r.RelatedResourceKind) - populate(objectMap, "relatedResourceName", r.RelatedResourceName) - populate(objectMap, "relatedResourceType", r.RelatedResourceType) + populate(objectMap, "azureDevOpsResourceInfo", r.AzureDevOpsResourceInfo) + populate(objectMap, "gitHubResourceInfo", r.GitHubResourceInfo) + populate(objectMap, "webhook", r.Webhook) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type RelationProperties. -func (r *RelationProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RepositoryResourceInfo. +func (r *RepositoryResourceInfo) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -5321,17 +7107,14 @@ func (r *RelationProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "relatedResourceId": - err = unpopulate(val, "RelatedResourceID", &r.RelatedResourceID) - delete(rawMsg, key) - case "relatedResourceKind": - err = unpopulate(val, "RelatedResourceKind", &r.RelatedResourceKind) + case "azureDevOpsResourceInfo": + err = unpopulate(val, "AzureDevOpsResourceInfo", &r.AzureDevOpsResourceInfo) delete(rawMsg, key) - case "relatedResourceName": - err = unpopulate(val, "RelatedResourceName", &r.RelatedResourceName) + case "gitHubResourceInfo": + err = unpopulate(val, "GitHubResourceInfo", &r.GitHubResourceInfo) delete(rawMsg, key) - case "relatedResourceType": - err = unpopulate(val, "RelatedResourceType", &r.RelatedResourceType) + case "webhook": + err = unpopulate(val, "Webhook", &r.Webhook) delete(rawMsg, key) } if err != nil { @@ -5412,6 +7195,7 @@ func (s ScheduledAlertRuleProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "suppressionDuration", s.SuppressionDuration) populate(objectMap, "suppressionEnabled", s.SuppressionEnabled) populate(objectMap, "tactics", s.Tactics) + populate(objectMap, "techniques", s.Techniques) populate(objectMap, "templateVersion", s.TemplateVersion) populate(objectMap, "triggerOperator", s.TriggerOperator) populate(objectMap, "triggerThreshold", s.TriggerThreshold) @@ -5478,6 +7262,9 @@ func (s *ScheduledAlertRuleProperties) UnmarshalJSON(data []byte) error { case "tactics": err = unpopulate(val, "Tactics", &s.Tactics) delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &s.Techniques) + delete(rawMsg, key) case "templateVersion": err = unpopulate(val, "TemplateVersion", &s.TemplateVersion) delete(rawMsg, key) @@ -5561,6 +7348,7 @@ func (s ScheduledAlertRuleTemplateProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "severity", s.Severity) populate(objectMap, "status", s.Status) populate(objectMap, "tactics", s.Tactics) + populate(objectMap, "techniques", s.Techniques) populate(objectMap, "triggerOperator", s.TriggerOperator) populate(objectMap, "triggerThreshold", s.TriggerThreshold) populate(objectMap, "version", s.Version) @@ -5624,6 +7412,9 @@ func (s *ScheduledAlertRuleTemplateProperties) UnmarshalJSON(data []byte) error case "tactics": err = unpopulate(val, "Tactics", &s.Tactics) delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &s.Techniques) + delete(rawMsg, key) case "triggerOperator": err = unpopulate(val, "TriggerOperator", &s.TriggerOperator) delete(rawMsg, key) @@ -5908,8 +7699,260 @@ func (s SecurityGroupEntityProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityGroupEntityProperties. -func (s *SecurityGroupEntityProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityGroupEntityProperties. +func (s *SecurityGroupEntityProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "additionalData": + err = unpopulate(val, "AdditionalData", &s.AdditionalData) + delete(rawMsg, key) + case "distinguishedName": + err = unpopulate(val, "DistinguishedName", &s.DistinguishedName) + delete(rawMsg, key) + case "friendlyName": + err = unpopulate(val, "FriendlyName", &s.FriendlyName) + delete(rawMsg, key) + case "objectGuid": + err = unpopulate(val, "ObjectGUID", &s.ObjectGUID) + delete(rawMsg, key) + case "sid": + err = unpopulate(val, "Sid", &s.Sid) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityMLAnalyticsSetting. +func (s SecurityMLAnalyticsSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + objectMap["kind"] = s.Kind + populate(objectMap, "name", s.Name) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityMLAnalyticsSetting. +func (s *SecurityMLAnalyticsSetting) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityMLAnalyticsSettingsDataSource. +func (s SecurityMLAnalyticsSettingsDataSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "connectorId", s.ConnectorID) + populate(objectMap, "dataTypes", s.DataTypes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityMLAnalyticsSettingsDataSource. +func (s *SecurityMLAnalyticsSettingsDataSource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectorId": + err = unpopulate(val, "ConnectorID", &s.ConnectorID) + delete(rawMsg, key) + case "dataTypes": + err = unpopulate(val, "DataTypes", &s.DataTypes) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityMLAnalyticsSettingsList. +func (s SecurityMLAnalyticsSettingsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityMLAnalyticsSettingsList. +func (s *SecurityMLAnalyticsSettingsList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + s.Value, err = unmarshalSecurityMLAnalyticsSettingClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SentinelOnboardingState. +func (s SentinelOnboardingState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SentinelOnboardingState. +func (s *SentinelOnboardingState) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &s.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SentinelOnboardingStateProperties. +func (s SentinelOnboardingStateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "customerManagedKey", s.CustomerManagedKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SentinelOnboardingStateProperties. +func (s *SentinelOnboardingStateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "customerManagedKey": + err = unpopulate(val, "CustomerManagedKey", &s.CustomerManagedKey) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SentinelOnboardingStatesList. +func (s SentinelOnboardingStatesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SentinelOnboardingStatesList. +func (s *SentinelOnboardingStatesList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &s.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ServicePrincipal. +func (s ServicePrincipal) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "appId", s.AppID) + populateDateTimeRFC3339(objectMap, "credentialsExpireOn", s.CredentialsExpireOn) + populate(objectMap, "id", s.ID) + populate(objectMap, "tenantId", s.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServicePrincipal. +func (s *ServicePrincipal) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -5917,20 +7960,17 @@ func (s *SecurityGroupEntityProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "additionalData": - err = unpopulate(val, "AdditionalData", &s.AdditionalData) - delete(rawMsg, key) - case "distinguishedName": - err = unpopulate(val, "DistinguishedName", &s.DistinguishedName) + case "appId": + err = unpopulate(val, "AppID", &s.AppID) delete(rawMsg, key) - case "friendlyName": - err = unpopulate(val, "FriendlyName", &s.FriendlyName) + case "credentialsExpireOn": + err = unpopulateDateTimeRFC3339(val, "CredentialsExpireOn", &s.CredentialsExpireOn) delete(rawMsg, key) - case "objectGuid": - err = unpopulate(val, "ObjectGUID", &s.ObjectGUID) + case "id": + err = unpopulate(val, "ID", &s.ID) delete(rawMsg, key) - case "sid": - err = unpopulate(val, "Sid", &s.Sid) + case "tenantId": + err = unpopulate(val, "TenantID", &s.TenantID) delete(rawMsg, key) } if err != nil { @@ -5940,8 +7980,8 @@ func (s *SecurityGroupEntityProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SentinelOnboardingState. -func (s SentinelOnboardingState) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SourceControl. +func (s SourceControl) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "etag", s.Etag) populate(objectMap, "id", s.ID) @@ -5952,8 +7992,8 @@ func (s SentinelOnboardingState) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SentinelOnboardingState. -func (s *SentinelOnboardingState) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceControl. +func (s *SourceControl) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -5987,15 +8027,16 @@ func (s *SentinelOnboardingState) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SentinelOnboardingStateProperties. -func (s SentinelOnboardingStateProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SourceControlList. +func (s SourceControlList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "customerManagedKey", s.CustomerManagedKey) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SentinelOnboardingStateProperties. -func (s *SentinelOnboardingStateProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceControlList. +func (s *SourceControlList) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6003,8 +8044,11 @@ func (s *SentinelOnboardingStateProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "customerManagedKey": - err = unpopulate(val, "CustomerManagedKey", &s.CustomerManagedKey) + case "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) } if err != nil { @@ -6014,15 +8058,26 @@ func (s *SentinelOnboardingStateProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SentinelOnboardingStatesList. -func (s SentinelOnboardingStatesList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SourceControlProperties. +func (s SourceControlProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", s.Value) + populate(objectMap, "contentTypes", s.ContentTypes) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "id", s.ID) + populate(objectMap, "lastDeploymentInfo", s.LastDeploymentInfo) + populate(objectMap, "pullRequest", s.PullRequest) + populate(objectMap, "repoType", s.RepoType) + populate(objectMap, "repository", s.Repository) + populate(objectMap, "repositoryAccess", s.RepositoryAccess) + populate(objectMap, "repositoryResourceInfo", s.RepositoryResourceInfo) + populate(objectMap, "servicePrincipal", s.ServicePrincipal) + populate(objectMap, "version", s.Version) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SentinelOnboardingStatesList. -func (s *SentinelOnboardingStatesList) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SourceControlProperties. +func (s *SourceControlProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return fmt.Errorf("unmarshalling type %T: %v", s, err) @@ -6030,8 +8085,41 @@ func (s *SentinelOnboardingStatesList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &s.Value) + case "contentTypes": + err = unpopulate(val, "ContentTypes", &s.ContentTypes) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "lastDeploymentInfo": + err = unpopulate(val, "LastDeploymentInfo", &s.LastDeploymentInfo) + delete(rawMsg, key) + case "pullRequest": + err = unpopulate(val, "PullRequest", &s.PullRequest) + delete(rawMsg, key) + case "repoType": + err = unpopulate(val, "RepoType", &s.RepoType) + delete(rawMsg, key) + case "repository": + err = unpopulate(val, "Repository", &s.Repository) + delete(rawMsg, key) + case "repositoryAccess": + err = unpopulate(val, "RepositoryAccess", &s.RepositoryAccess) + delete(rawMsg, key) + case "repositoryResourceInfo": + err = unpopulate(val, "RepositoryResourceInfo", &s.RepositoryResourceInfo) + delete(rawMsg, key) + case "servicePrincipal": + err = unpopulate(val, "ServicePrincipal", &s.ServicePrincipal) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) delete(rawMsg, key) } if err != nil { @@ -6346,6 +8434,215 @@ func (t *TIDataConnectorProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TemplateList. +func (t TemplateList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TemplateList. +func (t *TemplateList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TemplateModel. +func (t TemplateModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", t.Etag) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TemplateModel. +func (t *TemplateModel) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &t.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TemplateProperties. +func (t TemplateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "author", t.Author) + populate(objectMap, "categories", t.Categories) + populate(objectMap, "contentId", t.ContentID) + populate(objectMap, "contentKind", t.ContentKind) + populate(objectMap, "contentProductId", t.ContentProductID) + populate(objectMap, "contentSchemaVersion", t.ContentSchemaVersion) + populate(objectMap, "customVersion", t.CustomVersion) + populate(objectMap, "dependantTemplates", t.DependantTemplates) + populate(objectMap, "dependencies", t.Dependencies) + populate(objectMap, "displayName", t.DisplayName) + populateDateType(objectMap, "firstPublishDate", t.FirstPublishDate) + populate(objectMap, "icon", t.Icon) + populate(objectMap, "isDeprecated", t.IsDeprecated) + populateDateType(objectMap, "lastPublishDate", t.LastPublishDate) + populateAny(objectMap, "mainTemplate", t.MainTemplate) + populate(objectMap, "packageId", t.PackageID) + populate(objectMap, "packageKind", t.PackageKind) + populate(objectMap, "packageName", t.PackageName) + populate(objectMap, "packageVersion", t.PackageVersion) + populate(objectMap, "previewImages", t.PreviewImages) + populate(objectMap, "previewImagesDark", t.PreviewImagesDark) + populate(objectMap, "providers", t.Providers) + populate(objectMap, "source", t.Source) + populate(objectMap, "support", t.Support) + populate(objectMap, "threatAnalysisTactics", t.ThreatAnalysisTactics) + populate(objectMap, "threatAnalysisTechniques", t.ThreatAnalysisTechniques) + populate(objectMap, "version", t.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TemplateProperties. +func (t *TemplateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "author": + err = unpopulate(val, "Author", &t.Author) + delete(rawMsg, key) + case "categories": + err = unpopulate(val, "Categories", &t.Categories) + delete(rawMsg, key) + case "contentId": + err = unpopulate(val, "ContentID", &t.ContentID) + delete(rawMsg, key) + case "contentKind": + err = unpopulate(val, "ContentKind", &t.ContentKind) + delete(rawMsg, key) + case "contentProductId": + err = unpopulate(val, "ContentProductID", &t.ContentProductID) + delete(rawMsg, key) + case "contentSchemaVersion": + err = unpopulate(val, "ContentSchemaVersion", &t.ContentSchemaVersion) + delete(rawMsg, key) + case "customVersion": + err = unpopulate(val, "CustomVersion", &t.CustomVersion) + delete(rawMsg, key) + case "dependantTemplates": + err = unpopulate(val, "DependantTemplates", &t.DependantTemplates) + delete(rawMsg, key) + case "dependencies": + err = unpopulate(val, "Dependencies", &t.Dependencies) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &t.DisplayName) + delete(rawMsg, key) + case "firstPublishDate": + err = unpopulateDateType(val, "FirstPublishDate", &t.FirstPublishDate) + delete(rawMsg, key) + case "icon": + err = unpopulate(val, "Icon", &t.Icon) + delete(rawMsg, key) + case "isDeprecated": + err = unpopulate(val, "IsDeprecated", &t.IsDeprecated) + delete(rawMsg, key) + case "lastPublishDate": + err = unpopulateDateType(val, "LastPublishDate", &t.LastPublishDate) + delete(rawMsg, key) + case "mainTemplate": + err = unpopulate(val, "MainTemplate", &t.MainTemplate) + delete(rawMsg, key) + case "packageId": + err = unpopulate(val, "PackageID", &t.PackageID) + delete(rawMsg, key) + case "packageKind": + err = unpopulate(val, "PackageKind", &t.PackageKind) + delete(rawMsg, key) + case "packageName": + err = unpopulate(val, "PackageName", &t.PackageName) + delete(rawMsg, key) + case "packageVersion": + err = unpopulate(val, "PackageVersion", &t.PackageVersion) + delete(rawMsg, key) + case "previewImages": + err = unpopulate(val, "PreviewImages", &t.PreviewImages) + delete(rawMsg, key) + case "previewImagesDark": + err = unpopulate(val, "PreviewImagesDark", &t.PreviewImagesDark) + delete(rawMsg, key) + case "providers": + err = unpopulate(val, "Providers", &t.Providers) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &t.Source) + delete(rawMsg, key) + case "support": + err = unpopulate(val, "Support", &t.Support) + delete(rawMsg, key) + case "threatAnalysisTactics": + err = unpopulate(val, "ThreatAnalysisTactics", &t.ThreatAnalysisTactics) + delete(rawMsg, key) + case "threatAnalysisTechniques": + err = unpopulate(val, "ThreatAnalysisTechniques", &t.ThreatAnalysisTechniques) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &t.Version) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type ThreatIntelligence. func (t ThreatIntelligence) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -7210,6 +9507,68 @@ func (u *UserInfo) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Warning. +func (w Warning) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "warning", w.Warning) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Warning. +func (w *Warning) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "warning": + err = unpopulate(val, "Warning", &w.Warning) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WarningBody. +func (w WarningBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", w.Code) + populate(objectMap, "details", w.Details) + populate(objectMap, "message", w.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WarningBody. +func (w *WarningBody) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "code": + err = unpopulate(val, "Code", &w.Code) + delete(rawMsg, key) + case "details": + err = unpopulate(val, "Details", &w.Details) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &w.Message) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type Watchlist. func (w Watchlist) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -7532,6 +9891,45 @@ func (w *WatchlistProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type Webhook. +func (w Webhook) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "rotateWebhookSecret", w.RotateWebhookSecret) + populate(objectMap, "webhookId", w.WebhookID) + populateDateTimeRFC3339(objectMap, "webhookSecretUpdateTime", w.WebhookSecretUpdateTime) + populate(objectMap, "webhookUrl", w.WebhookURL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Webhook. +func (w *Webhook) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "rotateWebhookSecret": + err = unpopulate(val, "RotateWebhookSecret", &w.RotateWebhookSecret) + delete(rawMsg, key) + case "webhookId": + err = unpopulate(val, "WebhookID", &w.WebhookID) + delete(rawMsg, key) + case "webhookSecretUpdateTime": + err = unpopulateDateTimeRFC3339(val, "WebhookSecretUpdateTime", &w.WebhookSecretUpdateTime) + delete(rawMsg, key) + case "webhookUrl": + err = unpopulate(val, "WebhookURL", &w.WebhookURL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + func populate(m map[string]any, k string, v any) { if v == nil { return diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/operations_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/operations_client.go index ff76ba0ae629..d11132a05a05 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/operations_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/operations_client.go @@ -39,7 +39,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Lists all operations available Azure Security Insights Resource Provider. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -72,7 +72,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/operations_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/operations_client_example_test.go deleted file mode 100644 index 74b9d12ca31e..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/operations_client_example_test.go +++ /dev/null @@ -1,596 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/operations/ListOperations.json -func ExampleOperationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewOperationsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.OperationsList = armsecurityinsights.OperationsList{ - // Value: []*armsecurityinsights.Operation{ - // { - // Name: to.Ptr("Microsoft.SecurityInsights/operations/read"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Gets operations"), - // Operation: to.Ptr("Get Operations"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Operations"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/automationRules/read"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Gets an automation rule"), - // Operation: to.Ptr("Get Automation Rules"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("AutomationRules"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/automationRules/write"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Updates an automation rule"), - // Operation: to.Ptr("Update Automation Rules"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("AutomationRules"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/automationRules/delete"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Deletes an automation rule"), - // Operation: to.Ptr("Delete Automation Rules"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("AutomationRules"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/Bookmarks/read"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Gets bookmarks"), - // Operation: to.Ptr("Get Bookmarks"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Bookmarks"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/Bookmarks/write"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Updates bookmarks"), - // Operation: to.Ptr("Update Bookmarks"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Bookmarks"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/Bookmarks/delete"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Deletes bookmarks"), - // Operation: to.Ptr("Delete Bookmarks"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Bookmarks"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/Bookmarks/expand/action"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Gets related entities of an entity by a specific expansion"), - // Operation: to.Ptr("Expand on entity"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Bookmarks"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/bookmarks/relations/read"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Gets a bookmark relation"), - // Operation: to.Ptr("Get Bookmark Relations"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Bookmark Relations"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/bookmarks/relations/write"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Updates a bookmark relation"), - // Operation: to.Ptr("Update Bookmark Relations"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Bookmark Relations"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/bookmarks/relations/delete"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Deletes a bookmark relation"), - // Operation: to.Ptr("Delete Bookmark Relations"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Bookmark Relations"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/alertRules/read"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Gets the alert rules"), - // Operation: to.Ptr("Get Alert Rules"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/alertRules/write"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Updates alert rules"), - // Operation: to.Ptr("Update Alert Rules"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/alertRules/delete"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Deletes alert rules"), - // Operation: to.Ptr("Delete Alert Rules"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Alert Rules"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/alertRules/actions/read"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Gets the response actions of an alert rule"), - // Operation: to.Ptr("Get Alert Rule Response Actions"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Alert Rules Actions"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/alertRules/actions/write"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Updates the response actions of an alert rule"), - // Operation: to.Ptr("Update Alert Rule Response Actions"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Alert Rules Actions"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/alertRules/actions/delete"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Deletes the response actions of an alert rule"), - // Operation: to.Ptr("Delete Alert Rule Response Actions"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Alert Rules Actions"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/dataConnectors/read"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Gets the data connectors"), - // Operation: to.Ptr("Get Data Connectors"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("DataConnectors"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/dataConnectors/write"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Updates a data connector"), - // Operation: to.Ptr("Update Data Connectors"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("DataConnectors"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/dataConnectors/delete"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Deletes a data connector"), - // Operation: to.Ptr("Delete a Data Connector"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("DataConnectors"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/dataConnectorsCheckRequirements/action"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Check user authorization and license"), - // Operation: to.Ptr("Check user authorization and license"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("DataConnectorsCheckRequirements"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/incidents/read"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Gets an incident"), - // Operation: to.Ptr("Get Incidents"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Incidents"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/incidents/write"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Updates an incident"), - // Operation: to.Ptr("Update Incidents"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Incidents"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/incidents/delete"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Deletes an incident"), - // Operation: to.Ptr("Delete Incidents"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Incidents"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/incidents/comments/read"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Gets the incident comments"), - // Operation: to.Ptr("Get Incident Comments"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Incident Comments"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/incidents/comments/write"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Creates a comment on the incident"), - // Operation: to.Ptr("Create Incident Comments"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Incident Comments"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/incidents/comments/delete"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Deletes a comment on the incident"), - // Operation: to.Ptr("Delete Incident Comment"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Incident Comments"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/incidents/relations/read"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Gets a relation between the incident and related resources"), - // Operation: to.Ptr("Get Incident Relations"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Incident Relations"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/incidents/relations/write"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Updates a relation between the incident and related resources"), - // Operation: to.Ptr("Update Incident Relations"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Incident Relations"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/incidents/relations/delete"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Deletes a relation between the incident and related resources"), - // Operation: to.Ptr("Delete Incident Relations"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Incident Relations"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/read"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Gets Threat Intelligence"), - // Operation: to.Ptr("Get Threat Intelligence"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/write"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Updates Threat Intelligence"), - // Operation: to.Ptr("Update Threat Intelligence"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/delete"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Deletes Threat Intelligence"), - // Operation: to.Ptr("Delete Threat Intelligence"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/query/action"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Query Threat Intelligence"), - // Operation: to.Ptr("Query Threat Intelligence"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/metrics/action"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Collect Threat Intelligence Metrics"), - // Operation: to.Ptr("Collect Threat Intelligence Metrics"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/bulkDelete/action"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Bulk Delete Threat Intelligence"), - // Operation: to.Ptr("Bulk Delete Threat Intelligence"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/bulkTag/action"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Bulk Tags Threat Intelligence"), - // Operation: to.Ptr("Bulk Tags Threat Intelligence"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/indicators/write"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Updates Threat Intelligence Indicators"), - // Operation: to.Ptr("Update Threat Intelligence Indicators"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/indicators/delete"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Deletes Threat Intelligence Indicators"), - // Operation: to.Ptr("Delete Threat Intelligence Indicators"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/indicators/query/action"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Query Threat Intelligence Indicators"), - // Operation: to.Ptr("Query Threat Intelligence Indicators"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/indicators/metrics/action"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Get Threat Intelligence Indicator Metrics"), - // Operation: to.Ptr("Get Threat Intelligence Indicator Metrics"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/indicators/bulkDelete/action"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Bulk Delete Threat Intelligence Indicators"), - // Operation: to.Ptr("Bulk Delete Threat Intelligence Indicators"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/indicators/bulkTag/action"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Bulk Tags Threat Intelligence Indicators"), - // Operation: to.Ptr("Bulk Tags Threat Intelligence Indicators"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/indicators/read"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Gets Threat Intelligence Indicators"), - // Operation: to.Ptr("Get Threat Intelligence Indicators"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/metrics/read"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Collect Threat Intelligence Metrics"), - // Operation: to.Ptr("Collect Threat Intelligence Metrics"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/createIndicator/action"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Create Threat Intelligence Indicator"), - // Operation: to.Ptr("Create Threat Intelligence Indicator"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/indicators/appendTags/action"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Append tags to Threat Intelligence Indicator"), - // Operation: to.Ptr("Append tags to Threat Intelligence Indicator"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/indicators/replaceTags/action"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Replace Tags of Threat Intelligence Indicator"), - // Operation: to.Ptr("Replace Tags of Threat Intelligence Indicator"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/threatintelligence/queryIndicators/action"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Query Threat Intelligence Indicators"), - // Operation: to.Ptr("Query Threat Intelligence Indicators"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("ThreatIntelligence"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/Watchlists/read"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Gets Watchlists"), - // Operation: to.Ptr("Get Watchlists"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Watchlists"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/Watchlists/write"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Create Watchlists"), - // Operation: to.Ptr("Create Watchlists"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Watchlists"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/Watchlists/delete"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Deletes Watchlists"), - // Operation: to.Ptr("Delete Watchlists"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Watchlists"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/onboardingStates/read"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Gets an onboarding state"), - // Operation: to.Ptr("Get Onboarding States"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Onboarding States"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/onboardingStates/write"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Updates an onboarding state"), - // Operation: to.Ptr("Update Onboarding States"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Onboarding States"), - // }, - // Origin: to.Ptr("user"), - // }, - // { - // Name: to.Ptr("Microsoft.SecurityInsights/onboardingStates/delete"), - // Display: &armsecurityinsights.OperationDisplay{ - // Description: to.Ptr("Deletes an onboarding state"), - // Operation: to.Ptr("Delete Onboarding States"), - // Provider: to.Ptr("Microsoft Security Insights"), - // Resource: to.Ptr("Onboarding States"), - // }, - // Origin: to.Ptr("user"), - // }}, - // } - } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/options.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/options.go index 6eb4ae99efa3..3acddef6e6b1 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/options.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/options.go @@ -100,6 +100,91 @@ type BookmarksClientListOptions struct { // placeholder for future optional parameters } +// ContentPackageClientInstallOptions contains the optional parameters for the ContentPackageClient.Install method. +type ContentPackageClientInstallOptions struct { + // placeholder for future optional parameters +} + +// ContentPackageClientUninstallOptions contains the optional parameters for the ContentPackageClient.Uninstall method. +type ContentPackageClientUninstallOptions struct { + // placeholder for future optional parameters +} + +// ContentPackagesClientGetOptions contains the optional parameters for the ContentPackagesClient.Get method. +type ContentPackagesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ContentPackagesClientListOptions contains the optional parameters for the ContentPackagesClient.NewListPager method. +type ContentPackagesClientListOptions struct { + // Instructs the server to return only object count without actual body. Optional. + Count *bool + + // Filters the results, based on a Boolean condition. Optional. + Filter *string + + // Sorts the results. Optional. + Orderby *string + + // Searches for a substring in the response. Optional. + Search *string + + // Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results if there are any left. + Skip *int32 + + // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, + // the value of the nextLink element will include a skiptoken parameter that + // specifies a starting point to use for subsequent calls. Optional. + SkipToken *string + + // Returns only the first n results. Optional. + Top *int32 +} + +// ContentTemplateClientDeleteOptions contains the optional parameters for the ContentTemplateClient.Delete method. +type ContentTemplateClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ContentTemplateClientGetOptions contains the optional parameters for the ContentTemplateClient.Get method. +type ContentTemplateClientGetOptions struct { + // placeholder for future optional parameters +} + +// ContentTemplateClientInstallOptions contains the optional parameters for the ContentTemplateClient.Install method. +type ContentTemplateClientInstallOptions struct { + // placeholder for future optional parameters +} + +// ContentTemplatesClientListOptions contains the optional parameters for the ContentTemplatesClient.NewListPager method. +type ContentTemplatesClientListOptions struct { + // Instructs the server to return only object count without actual body. Optional. + Count *bool + + // Expands the object with optional fiends that are not included by default. Optional. + Expand *string + + // Filters the results, based on a Boolean condition. Optional. + Filter *string + + // Sorts the results. Optional. + Orderby *string + + // Searches for a substring in the response. Optional. + Search *string + + // Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results if there are any left. + Skip *int32 + + // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, + // the value of the nextLink element will include a skiptoken parameter that + // specifies a starting point to use for subsequent calls. Optional. + SkipToken *string + + // Returns only the first n results. Optional. + Top *int32 +} + // DataConnectorsClientCreateOrUpdateOptions contains the optional parameters for the DataConnectorsClient.CreateOrUpdate // method. type DataConnectorsClientCreateOrUpdateOptions struct { @@ -234,11 +319,123 @@ type IncidentsClientListOptions struct { Top *int32 } +// MetadataClientCreateOptions contains the optional parameters for the MetadataClient.Create method. +type MetadataClientCreateOptions struct { + // placeholder for future optional parameters +} + +// MetadataClientDeleteOptions contains the optional parameters for the MetadataClient.Delete method. +type MetadataClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// MetadataClientGetOptions contains the optional parameters for the MetadataClient.Get method. +type MetadataClientGetOptions struct { + // placeholder for future optional parameters +} + +// MetadataClientListOptions contains the optional parameters for the MetadataClient.NewListPager method. +type MetadataClientListOptions struct { + // Filters the results, based on a Boolean condition. Optional. + Filter *string + + // Sorts the results. Optional. + Orderby *string + + // Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results if there are any left. + Skip *int32 + + // Returns only the first n results. Optional. + Top *int32 +} + +// MetadataClientUpdateOptions contains the optional parameters for the MetadataClient.Update method. +type MetadataClientUpdateOptions struct { + // placeholder for future optional parameters +} + // OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters } +// ProductPackageClientGetOptions contains the optional parameters for the ProductPackageClient.Get method. +type ProductPackageClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProductPackagesClientListOptions contains the optional parameters for the ProductPackagesClient.NewListPager method. +type ProductPackagesClientListOptions struct { + // Filters the results, based on a Boolean condition. Optional. + Filter *string + + // Sorts the results. Optional. + Orderby *string + + // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, + // the value of the nextLink element will include a skiptoken parameter that + // specifies a starting point to use for subsequent calls. Optional. + SkipToken *string + + // Returns only the first n results. Optional. + Top *int32 +} + +// ProductTemplateClientGetOptions contains the optional parameters for the ProductTemplateClient.Get method. +type ProductTemplateClientGetOptions struct { + // placeholder for future optional parameters +} + +// ProductTemplatesClientListOptions contains the optional parameters for the ProductTemplatesClient.NewListPager method. +type ProductTemplatesClientListOptions struct { + // Instructs the server to return only object count without actual body. Optional. + Count *bool + + // Filters the results, based on a Boolean condition. Optional. + Filter *string + + // Sorts the results. Optional. + Orderby *string + + // Searches for a substring in the response. Optional. + Search *string + + // Used to skip n elements in the OData query (offset). Returns a nextLink to the next page of results if there are any left. + Skip *int32 + + // Skiptoken is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, + // the value of the nextLink element will include a skiptoken parameter that + // specifies a starting point to use for subsequent calls. Optional. + SkipToken *string + + // Returns only the first n results. Optional. + Top *int32 +} + +// SecurityMLAnalyticsSettingsClientCreateOrUpdateOptions contains the optional parameters for the SecurityMLAnalyticsSettingsClient.CreateOrUpdate +// method. +type SecurityMLAnalyticsSettingsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SecurityMLAnalyticsSettingsClientDeleteOptions contains the optional parameters for the SecurityMLAnalyticsSettingsClient.Delete +// method. +type SecurityMLAnalyticsSettingsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SecurityMLAnalyticsSettingsClientGetOptions contains the optional parameters for the SecurityMLAnalyticsSettingsClient.Get +// method. +type SecurityMLAnalyticsSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SecurityMLAnalyticsSettingsClientListOptions contains the optional parameters for the SecurityMLAnalyticsSettingsClient.NewListPager +// method. +type SecurityMLAnalyticsSettingsClientListOptions struct { + // placeholder for future optional parameters +} + // SentinelOnboardingStatesClientCreateOptions contains the optional parameters for the SentinelOnboardingStatesClient.Create // method. type SentinelOnboardingStatesClientCreateOptions struct { @@ -263,6 +460,32 @@ type SentinelOnboardingStatesClientListOptions struct { // placeholder for future optional parameters } +// SourceControlClientListRepositoriesOptions contains the optional parameters for the SourceControlClient.NewListRepositoriesPager +// method. +type SourceControlClientListRepositoriesOptions struct { + // placeholder for future optional parameters +} + +// SourceControlsClientCreateOptions contains the optional parameters for the SourceControlsClient.Create method. +type SourceControlsClientCreateOptions struct { + // placeholder for future optional parameters +} + +// SourceControlsClientDeleteOptions contains the optional parameters for the SourceControlsClient.Delete method. +type SourceControlsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SourceControlsClientGetOptions contains the optional parameters for the SourceControlsClient.Get method. +type SourceControlsClientGetOptions struct { + // placeholder for future optional parameters +} + +// SourceControlsClientListOptions contains the optional parameters for the SourceControlsClient.NewListPager method. +type SourceControlsClientListOptions struct { + // placeholder for future optional parameters +} + // ThreatIntelligenceIndicatorClientAppendTagsOptions contains the optional parameters for the ThreatIntelligenceIndicatorClient.AppendTags // method. type ThreatIntelligenceIndicatorClientAppendTagsOptions struct { diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/polymorphic_helpers.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/polymorphic_helpers.go index 43f6a5c636d9..7d70e0c7de13 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/polymorphic_helpers.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/polymorphic_helpers.go @@ -152,6 +152,10 @@ func unmarshalAutomationRuleConditionClassification(rawMsg json.RawMessage) (Aut switch m["conditionType"] { case string(ConditionTypeProperty): b = &PropertyConditionProperties{} + case string(ConditionTypePropertyArrayChanged): + b = &PropertyArrayChangedConditionProperties{} + case string(ConditionTypePropertyChanged): + b = &PropertyChangedConditionProperties{} default: b = &AutomationRuleCondition{} } @@ -314,6 +318,46 @@ func unmarshalEntityClassificationArray(rawMsg json.RawMessage) ([]EntityClassif return fArray, nil } +func unmarshalSecurityMLAnalyticsSettingClassification(rawMsg json.RawMessage) (SecurityMLAnalyticsSettingClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b SecurityMLAnalyticsSettingClassification + switch m["kind"] { + case string(SecurityMLAnalyticsSettingsKindAnomaly): + b = &AnomalySecurityMLAnalyticsSettings{} + default: + b = &SecurityMLAnalyticsSetting{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + +func unmarshalSecurityMLAnalyticsSettingClassificationArray(rawMsg json.RawMessage) ([]SecurityMLAnalyticsSettingClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]SecurityMLAnalyticsSettingClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalSecurityMLAnalyticsSettingClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + func unmarshalThreatIntelligenceInformationClassification(rawMsg json.RawMessage) (ThreatIntelligenceInformationClassification, error) { if rawMsg == nil { return nil, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/productpackage_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/productpackage_client.go new file mode 100644 index 000000000000..8edca04017d9 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/productpackage_client.go @@ -0,0 +1,113 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ProductPackageClient contains the methods for the ProductPackage group. +// Don't use this type directly, use NewProductPackageClient() instead. +type ProductPackageClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProductPackageClient creates a new instance of ProductPackageClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProductPackageClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProductPackageClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProductPackageClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets a package by its identifier from the catalog. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - packageID - package Id +// - options - ProductPackageClientGetOptions contains the optional parameters for the ProductPackageClient.Get method. +func (client *ProductPackageClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, packageID string, options *ProductPackageClientGetOptions) (ProductPackageClientGetResponse, error) { + var err error + const operationName = "ProductPackageClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, workspaceName, packageID, options) + if err != nil { + return ProductPackageClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductPackageClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProductPackageClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ProductPackageClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, packageID string, options *ProductPackageClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentProductPackages/{packageId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if packageID == "" { + return nil, errors.New("parameter packageID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{packageId}", url.PathEscape(packageID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProductPackageClient) getHandleResponse(resp *http.Response) (ProductPackageClientGetResponse, error) { + result := ProductPackageClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductPackageModel); err != nil { + return ProductPackageClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/productpackages_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/productpackages_client.go new file mode 100644 index 000000000000..a79306f05d41 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/productpackages_client.go @@ -0,0 +1,124 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ProductPackagesClient contains the methods for the ProductPackages group. +// Don't use this type directly, use NewProductPackagesClient() instead. +type ProductPackagesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProductPackagesClient creates a new instance of ProductPackagesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProductPackagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProductPackagesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProductPackagesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Gets all packages from the catalog. Expandable properties: +// * properties/installed +// * properties/packagedContent +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - options - ProductPackagesClientListOptions contains the optional parameters for the ProductPackagesClient.NewListPager +// method. +func (client *ProductPackagesClient) NewListPager(resourceGroupName string, workspaceName string, options *ProductPackagesClientListOptions) *runtime.Pager[ProductPackagesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ProductPackagesClientListResponse]{ + More: func(page ProductPackagesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProductPackagesClientListResponse) (ProductPackagesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProductPackagesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) + }, nil) + if err != nil { + return ProductPackagesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ProductPackagesClient) listCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *ProductPackagesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentProductPackages" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ProductPackagesClient) listHandleResponse(resp *http.Response) (ProductPackagesClientListResponse, error) { + result := ProductPackagesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductPackageList); err != nil { + return ProductPackagesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/producttemplate_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/producttemplate_client.go new file mode 100644 index 000000000000..019df72ebfdf --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/producttemplate_client.go @@ -0,0 +1,113 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// ProductTemplateClient contains the methods for the ProductTemplate group. +// Don't use this type directly, use NewProductTemplateClient() instead. +type ProductTemplateClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProductTemplateClient creates a new instance of ProductTemplateClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProductTemplateClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProductTemplateClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProductTemplateClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Gets a template by its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - templateID - template Id +// - options - ProductTemplateClientGetOptions contains the optional parameters for the ProductTemplateClient.Get method. +func (client *ProductTemplateClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, templateID string, options *ProductTemplateClientGetOptions) (ProductTemplateClientGetResponse, error) { + var err error + const operationName = "ProductTemplateClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, workspaceName, templateID, options) + if err != nil { + return ProductTemplateClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ProductTemplateClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ProductTemplateClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ProductTemplateClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, templateID string, options *ProductTemplateClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentproducttemplates/{templateId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if templateID == "" { + return nil, errors.New("parameter templateID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{templateId}", url.PathEscape(templateID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ProductTemplateClient) getHandleResponse(resp *http.Response) (ProductTemplateClientGetResponse, error) { + result := ProductTemplateClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductTemplateModel); err != nil { + return ProductTemplateClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/producttemplates_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/producttemplates_client.go new file mode 100644 index 000000000000..5195c09acd5b --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/producttemplates_client.go @@ -0,0 +1,131 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// ProductTemplatesClient contains the methods for the ProductTemplates group. +// Don't use this type directly, use NewProductTemplatesClient() instead. +type ProductTemplatesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewProductTemplatesClient creates a new instance of ProductTemplatesClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewProductTemplatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ProductTemplatesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ProductTemplatesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListPager - Gets all templates in the catalog. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - options - ProductTemplatesClientListOptions contains the optional parameters for the ProductTemplatesClient.NewListPager +// method. +func (client *ProductTemplatesClient) NewListPager(resourceGroupName string, workspaceName string, options *ProductTemplatesClientListOptions) *runtime.Pager[ProductTemplatesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ProductTemplatesClientListResponse]{ + More: func(page ProductTemplatesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ProductTemplatesClientListResponse) (ProductTemplatesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ProductTemplatesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) + }, nil) + if err != nil { + return ProductTemplatesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ProductTemplatesClient) listCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *ProductTemplatesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/contentProductTemplates" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + if options != nil && options.Filter != nil { + reqQP.Set("$filter", *options.Filter) + } + if options != nil && options.Orderby != nil { + reqQP.Set("$orderby", *options.Orderby) + } + if options != nil && options.Search != nil { + reqQP.Set("$search", *options.Search) + } + if options != nil && options.Count != nil { + reqQP.Set("$count", strconv.FormatBool(*options.Count)) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + if options != nil && options.SkipToken != nil { + reqQP.Set("$skipToken", *options.SkipToken) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ProductTemplatesClient) listHandleResponse(resp *http.Response) (ProductTemplatesClientListResponse, error) { + result := ProductTemplatesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ProductTemplateList); err != nil { + return ProductTemplatesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/response_types.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/response_types.go index cbd9de53030e..c5caa2a39dfa 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/response_types.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/response_types.go @@ -140,6 +140,52 @@ type BookmarksClientListResponse struct { BookmarkList } +// ContentPackageClientInstallResponse contains the response from method ContentPackageClient.Install. +type ContentPackageClientInstallResponse struct { + // Represents a Package in Azure Security Insights. + PackageModel +} + +// ContentPackageClientUninstallResponse contains the response from method ContentPackageClient.Uninstall. +type ContentPackageClientUninstallResponse struct { + // placeholder for future response values +} + +// ContentPackagesClientGetResponse contains the response from method ContentPackagesClient.Get. +type ContentPackagesClientGetResponse struct { + // Represents a Package in Azure Security Insights. + PackageModel +} + +// ContentPackagesClientListResponse contains the response from method ContentPackagesClient.NewListPager. +type ContentPackagesClientListResponse struct { + // List available packages. + PackageList +} + +// ContentTemplateClientDeleteResponse contains the response from method ContentTemplateClient.Delete. +type ContentTemplateClientDeleteResponse struct { + // placeholder for future response values +} + +// ContentTemplateClientGetResponse contains the response from method ContentTemplateClient.Get. +type ContentTemplateClientGetResponse struct { + // Template resource definition. + TemplateModel +} + +// ContentTemplateClientInstallResponse contains the response from method ContentTemplateClient.Install. +type ContentTemplateClientInstallResponse struct { + // Template resource definition. + TemplateModel +} + +// ContentTemplatesClientListResponse contains the response from method ContentTemplatesClient.NewListPager. +type ContentTemplatesClientListResponse struct { + // List of all the template. + TemplateList +} + // DataConnectorsClientCreateOrUpdateResponse contains the response from method DataConnectorsClient.CreateOrUpdate. type DataConnectorsClientCreateOrUpdateResponse struct { // Data connector. @@ -270,12 +316,108 @@ type IncidentsClientListResponse struct { IncidentList } +// MetadataClientCreateResponse contains the response from method MetadataClient.Create. +type MetadataClientCreateResponse struct { + // Metadata resource definition. + MetadataModel +} + +// MetadataClientDeleteResponse contains the response from method MetadataClient.Delete. +type MetadataClientDeleteResponse struct { + // placeholder for future response values +} + +// MetadataClientGetResponse contains the response from method MetadataClient.Get. +type MetadataClientGetResponse struct { + // Metadata resource definition. + MetadataModel +} + +// MetadataClientListResponse contains the response from method MetadataClient.NewListPager. +type MetadataClientListResponse struct { + // List of all the metadata. + MetadataList +} + +// MetadataClientUpdateResponse contains the response from method MetadataClient.Update. +type MetadataClientUpdateResponse struct { + // Metadata resource definition. + MetadataModel +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { // Lists the operations available in the SecurityInsights RP. OperationsList } +// ProductPackageClientGetResponse contains the response from method ProductPackageClient.Get. +type ProductPackageClientGetResponse struct { + // Represents a Package in Azure Security Insights. + ProductPackageModel +} + +// ProductPackagesClientListResponse contains the response from method ProductPackagesClient.NewListPager. +type ProductPackagesClientListResponse struct { + // List available packages. + ProductPackageList +} + +// ProductTemplateClientGetResponse contains the response from method ProductTemplateClient.Get. +type ProductTemplateClientGetResponse struct { + // Template resource definition. + ProductTemplateModel +} + +// ProductTemplatesClientListResponse contains the response from method ProductTemplatesClient.NewListPager. +type ProductTemplatesClientListResponse struct { + // List of all the template. + ProductTemplateList +} + +// SecurityMLAnalyticsSettingsClientCreateOrUpdateResponse contains the response from method SecurityMLAnalyticsSettingsClient.CreateOrUpdate. +type SecurityMLAnalyticsSettingsClientCreateOrUpdateResponse struct { + // Security ML Analytics Setting + SecurityMLAnalyticsSettingClassification +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityMLAnalyticsSettingsClientCreateOrUpdateResponse. +func (s *SecurityMLAnalyticsSettingsClientCreateOrUpdateResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalSecurityMLAnalyticsSettingClassification(data) + if err != nil { + return err + } + s.SecurityMLAnalyticsSettingClassification = res + return nil +} + +// SecurityMLAnalyticsSettingsClientDeleteResponse contains the response from method SecurityMLAnalyticsSettingsClient.Delete. +type SecurityMLAnalyticsSettingsClientDeleteResponse struct { + // placeholder for future response values +} + +// SecurityMLAnalyticsSettingsClientGetResponse contains the response from method SecurityMLAnalyticsSettingsClient.Get. +type SecurityMLAnalyticsSettingsClientGetResponse struct { + // Security ML Analytics Setting + SecurityMLAnalyticsSettingClassification +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityMLAnalyticsSettingsClientGetResponse. +func (s *SecurityMLAnalyticsSettingsClientGetResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalSecurityMLAnalyticsSettingClassification(data) + if err != nil { + return err + } + s.SecurityMLAnalyticsSettingClassification = res + return nil +} + +// SecurityMLAnalyticsSettingsClientListResponse contains the response from method SecurityMLAnalyticsSettingsClient.NewListPager. +type SecurityMLAnalyticsSettingsClientListResponse struct { + // List all the SecurityMLAnalyticsSettings + SecurityMLAnalyticsSettingsList +} + // SentinelOnboardingStatesClientCreateResponse contains the response from method SentinelOnboardingStatesClient.Create. type SentinelOnboardingStatesClientCreateResponse struct { // Sentinel onboarding state @@ -299,6 +441,36 @@ type SentinelOnboardingStatesClientListResponse struct { SentinelOnboardingStatesList } +// SourceControlClientListRepositoriesResponse contains the response from method SourceControlClient.NewListRepositoriesPager. +type SourceControlClientListRepositoriesResponse struct { + // List all the source controls. + RepoList +} + +// SourceControlsClientCreateResponse contains the response from method SourceControlsClient.Create. +type SourceControlsClientCreateResponse struct { + // Represents a SourceControl in Azure Security Insights. + SourceControl +} + +// SourceControlsClientDeleteResponse contains the response from method SourceControlsClient.Delete. +type SourceControlsClientDeleteResponse struct { + // Warning response structure. + Warning +} + +// SourceControlsClientGetResponse contains the response from method SourceControlsClient.Get. +type SourceControlsClientGetResponse struct { + // Represents a SourceControl in Azure Security Insights. + SourceControl +} + +// SourceControlsClientListResponse contains the response from method SourceControlsClient.NewListPager. +type SourceControlsClientListResponse struct { + // List all the source controls. + SourceControlList +} + // ThreatIntelligenceIndicatorClientAppendTagsResponse contains the response from method ThreatIntelligenceIndicatorClient.AppendTags. type ThreatIntelligenceIndicatorClientAppendTagsResponse struct { // placeholder for future response values diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/securitymlanalyticssettings_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/securitymlanalyticssettings_client.go new file mode 100644 index 000000000000..08aefbe201d9 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/securitymlanalyticssettings_client.go @@ -0,0 +1,313 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SecurityMLAnalyticsSettingsClient contains the methods for the SecurityMLAnalyticsSettings group. +// Don't use this type directly, use NewSecurityMLAnalyticsSettingsClient() instead. +type SecurityMLAnalyticsSettingsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSecurityMLAnalyticsSettingsClient creates a new instance of SecurityMLAnalyticsSettingsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSecurityMLAnalyticsSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecurityMLAnalyticsSettingsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SecurityMLAnalyticsSettingsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates the Security ML Analytics Settings. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - settingsResourceName - Security ML Analytics Settings resource name +// - securityMLAnalyticsSetting - The security ML Analytics setting +// - options - SecurityMLAnalyticsSettingsClientCreateOrUpdateOptions contains the optional parameters for the SecurityMLAnalyticsSettingsClient.CreateOrUpdate +// method. +func (client *SecurityMLAnalyticsSettingsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, workspaceName string, settingsResourceName string, securityMLAnalyticsSetting SecurityMLAnalyticsSettingClassification, options *SecurityMLAnalyticsSettingsClientCreateOrUpdateOptions) (SecurityMLAnalyticsSettingsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "SecurityMLAnalyticsSettingsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, workspaceName, settingsResourceName, securityMLAnalyticsSetting, options) + if err != nil { + return SecurityMLAnalyticsSettingsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecurityMLAnalyticsSettingsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SecurityMLAnalyticsSettingsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SecurityMLAnalyticsSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, settingsResourceName string, securityMLAnalyticsSetting SecurityMLAnalyticsSettingClassification, options *SecurityMLAnalyticsSettingsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/securityMLAnalyticsSettings/{settingsResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if settingsResourceName == "" { + return nil, errors.New("parameter settingsResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{settingsResourceName}", url.PathEscape(settingsResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, securityMLAnalyticsSetting); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *SecurityMLAnalyticsSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (SecurityMLAnalyticsSettingsClientCreateOrUpdateResponse, error) { + result := SecurityMLAnalyticsSettingsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { + return SecurityMLAnalyticsSettingsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete the Security ML Analytics Settings. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - settingsResourceName - Security ML Analytics Settings resource name +// - options - SecurityMLAnalyticsSettingsClientDeleteOptions contains the optional parameters for the SecurityMLAnalyticsSettingsClient.Delete +// method. +func (client *SecurityMLAnalyticsSettingsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, settingsResourceName string, options *SecurityMLAnalyticsSettingsClientDeleteOptions) (SecurityMLAnalyticsSettingsClientDeleteResponse, error) { + var err error + const operationName = "SecurityMLAnalyticsSettingsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, workspaceName, settingsResourceName, options) + if err != nil { + return SecurityMLAnalyticsSettingsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecurityMLAnalyticsSettingsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SecurityMLAnalyticsSettingsClientDeleteResponse{}, err + } + return SecurityMLAnalyticsSettingsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SecurityMLAnalyticsSettingsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, settingsResourceName string, options *SecurityMLAnalyticsSettingsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/securityMLAnalyticsSettings/{settingsResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if settingsResourceName == "" { + return nil, errors.New("parameter settingsResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{settingsResourceName}", url.PathEscape(settingsResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Gets the Security ML Analytics Settings. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - settingsResourceName - Security ML Analytics Settings resource name +// - options - SecurityMLAnalyticsSettingsClientGetOptions contains the optional parameters for the SecurityMLAnalyticsSettingsClient.Get +// method. +func (client *SecurityMLAnalyticsSettingsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, settingsResourceName string, options *SecurityMLAnalyticsSettingsClientGetOptions) (SecurityMLAnalyticsSettingsClientGetResponse, error) { + var err error + const operationName = "SecurityMLAnalyticsSettingsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, workspaceName, settingsResourceName, options) + if err != nil { + return SecurityMLAnalyticsSettingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SecurityMLAnalyticsSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SecurityMLAnalyticsSettingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SecurityMLAnalyticsSettingsClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, settingsResourceName string, options *SecurityMLAnalyticsSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/securityMLAnalyticsSettings/{settingsResourceName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if settingsResourceName == "" { + return nil, errors.New("parameter settingsResourceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{settingsResourceName}", url.PathEscape(settingsResourceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SecurityMLAnalyticsSettingsClient) getHandleResponse(resp *http.Response) (SecurityMLAnalyticsSettingsClientGetResponse, error) { + result := SecurityMLAnalyticsSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { + return SecurityMLAnalyticsSettingsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all Security ML Analytics Settings. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - options - SecurityMLAnalyticsSettingsClientListOptions contains the optional parameters for the SecurityMLAnalyticsSettingsClient.NewListPager +// method. +func (client *SecurityMLAnalyticsSettingsClient) NewListPager(resourceGroupName string, workspaceName string, options *SecurityMLAnalyticsSettingsClientListOptions) *runtime.Pager[SecurityMLAnalyticsSettingsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SecurityMLAnalyticsSettingsClientListResponse]{ + More: func(page SecurityMLAnalyticsSettingsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SecurityMLAnalyticsSettingsClientListResponse) (SecurityMLAnalyticsSettingsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SecurityMLAnalyticsSettingsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) + }, nil) + if err != nil { + return SecurityMLAnalyticsSettingsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *SecurityMLAnalyticsSettingsClient) listCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *SecurityMLAnalyticsSettingsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/securityMLAnalyticsSettings" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SecurityMLAnalyticsSettingsClient) listHandleResponse(resp *http.Response) (SecurityMLAnalyticsSettingsClientListResponse, error) { + result := SecurityMLAnalyticsSettingsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityMLAnalyticsSettingsList); err != nil { + return SecurityMLAnalyticsSettingsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/sentinelonboardingstates_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/sentinelonboardingstates_client.go index 249ca7924fcc..92ba826fde7c 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/sentinelonboardingstates_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/sentinelonboardingstates_client.go @@ -46,7 +46,7 @@ func NewSentinelOnboardingStatesClient(subscriptionID string, credential azcore. // Create - Create Sentinel onboarding state // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - sentinelOnboardingStateName - The Sentinel onboarding state name. Supports - default @@ -98,7 +98,7 @@ func (client *SentinelOnboardingStatesClient) createCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.SentinelOnboardingStateParameter != nil { @@ -122,7 +122,7 @@ func (client *SentinelOnboardingStatesClient) createHandleResponse(resp *http.Re // Delete - Delete Sentinel onboarding state // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - sentinelOnboardingStateName - The Sentinel onboarding state name. Supports - default @@ -173,7 +173,7 @@ func (client *SentinelOnboardingStatesClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -182,7 +182,7 @@ func (client *SentinelOnboardingStatesClient) deleteCreateRequest(ctx context.Co // Get - Get Sentinel onboarding state // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - sentinelOnboardingStateName - The Sentinel onboarding state name. Supports - default @@ -234,7 +234,7 @@ func (client *SentinelOnboardingStatesClient) getCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -252,7 +252,7 @@ func (client *SentinelOnboardingStatesClient) getHandleResponse(resp *http.Respo // List - Gets all Sentinel onboarding states // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - options - SentinelOnboardingStatesClientListOptions contains the optional parameters for the SentinelOnboardingStatesClient.List @@ -299,7 +299,7 @@ func (client *SentinelOnboardingStatesClient) listCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/sentinelonboardingstates_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/sentinelonboardingstates_client_example_test.go deleted file mode 100644 index f9e5695bde6d..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/sentinelonboardingstates_client_example_test.go +++ /dev/null @@ -1,128 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/onboardingStates/GetSentinelOnboardingState.json -func ExampleSentinelOnboardingStatesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSentinelOnboardingStatesClient().Get(ctx, "myRg", "myWorkspace", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SentinelOnboardingState = armsecurityinsights.SentinelOnboardingState{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.SecurityInsights/onboardingStates"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/onboardingStates/default"), - // Properties: &armsecurityinsights.SentinelOnboardingStateProperties{ - // CustomerManagedKey: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/onboardingStates/CreateSentinelOnboardingState.json -func ExampleSentinelOnboardingStatesClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSentinelOnboardingStatesClient().Create(ctx, "myRg", "myWorkspace", "default", &armsecurityinsights.SentinelOnboardingStatesClientCreateOptions{SentinelOnboardingStateParameter: &armsecurityinsights.SentinelOnboardingState{ - Properties: &armsecurityinsights.SentinelOnboardingStateProperties{ - CustomerManagedKey: to.Ptr(false), - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SentinelOnboardingState = armsecurityinsights.SentinelOnboardingState{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.SecurityInsights/onboardingStates"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/onboardingStates/default"), - // Properties: &armsecurityinsights.SentinelOnboardingStateProperties{ - // CustomerManagedKey: to.Ptr(false), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/onboardingStates/DeleteSentinelOnboardingState.json -func ExampleSentinelOnboardingStatesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewSentinelOnboardingStatesClient().Delete(ctx, "myRg", "myWorkspace", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/onboardingStates/GetAllSentinelOnboardingStates.json -func ExampleSentinelOnboardingStatesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewSentinelOnboardingStatesClient().List(ctx, "myRg", "myWorkspace", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.SentinelOnboardingStatesList = armsecurityinsights.SentinelOnboardingStatesList{ - // Value: []*armsecurityinsights.SentinelOnboardingState{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.SecurityInsights/onboardingStates"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/onboardingStates/default"), - // Properties: &armsecurityinsights.SentinelOnboardingStateProperties{ - // CustomerManagedKey: to.Ptr(false), - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrol_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrol_client.go new file mode 100644 index 000000000000..096fe2808231 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrol_client.go @@ -0,0 +1,113 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SourceControlClient contains the methods for the SourceControl group. +// Don't use this type directly, use NewSourceControlClient() instead. +type SourceControlClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSourceControlClient creates a new instance of SourceControlClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSourceControlClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SourceControlClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SourceControlClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// NewListRepositoriesPager - Gets a list of repositories metadata. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - repositoryAccess - The repository access credentials. +// - options - SourceControlClientListRepositoriesOptions contains the optional parameters for the SourceControlClient.NewListRepositoriesPager +// method. +func (client *SourceControlClient) NewListRepositoriesPager(resourceGroupName string, workspaceName string, repositoryAccess RepositoryAccessProperties, options *SourceControlClientListRepositoriesOptions) *runtime.Pager[SourceControlClientListRepositoriesResponse] { + return runtime.NewPager(runtime.PagingHandler[SourceControlClientListRepositoriesResponse]{ + More: func(page SourceControlClientListRepositoriesResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SourceControlClientListRepositoriesResponse) (SourceControlClientListRepositoriesResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SourceControlClient.NewListRepositoriesPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listRepositoriesCreateRequest(ctx, resourceGroupName, workspaceName, repositoryAccess, options) + }, nil) + if err != nil { + return SourceControlClientListRepositoriesResponse{}, err + } + return client.listRepositoriesHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listRepositoriesCreateRequest creates the ListRepositories request. +func (client *SourceControlClient) listRepositoriesCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, repositoryAccess RepositoryAccessProperties, options *SourceControlClientListRepositoriesOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/listRepositories" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, repositoryAccess); err != nil { + return nil, err + } + return req, nil +} + +// listRepositoriesHandleResponse handles the ListRepositories response. +func (client *SourceControlClient) listRepositoriesHandleResponse(resp *http.Response) (SourceControlClientListRepositoriesResponse, error) { + result := SourceControlClientListRepositoriesResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.RepoList); err != nil { + return SourceControlClientListRepositoriesResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrols_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrols_client.go new file mode 100644 index 000000000000..e4c31e4f78b9 --- /dev/null +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/sourcecontrols_client.go @@ -0,0 +1,323 @@ +//go:build go1.18 +// +build go1.18 + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package armsecurityinsights + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SourceControlsClient contains the methods for the SourceControls group. +// Don't use this type directly, use NewSourceControlsClient() instead. +type SourceControlsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewSourceControlsClient creates a new instance of SourceControlsClient with the specified values. +// - subscriptionID - The ID of the target subscription. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewSourceControlsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SourceControlsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SourceControlsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Create - Creates a source control. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - sourceControlID - Source control Id +// - sourceControl - The SourceControl +// - options - SourceControlsClientCreateOptions contains the optional parameters for the SourceControlsClient.Create method. +func (client *SourceControlsClient) Create(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string, sourceControl SourceControl, options *SourceControlsClientCreateOptions) (SourceControlsClientCreateResponse, error) { + var err error + const operationName = "SourceControlsClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, workspaceName, sourceControlID, sourceControl, options) + if err != nil { + return SourceControlsClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SourceControlsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SourceControlsClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *SourceControlsClient) createCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string, sourceControl SourceControl, options *SourceControlsClientCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if sourceControlID == "" { + return nil, errors.New("parameter sourceControlID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sourceControlId}", url.PathEscape(sourceControlID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, sourceControl); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *SourceControlsClient) createHandleResponse(resp *http.Response) (SourceControlsClientCreateResponse, error) { + result := SourceControlsClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SourceControl); err != nil { + return SourceControlsClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Delete a source control. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - sourceControlID - Source control Id +// - repositoryAccess - The repository access credentials. +// - options - SourceControlsClientDeleteOptions contains the optional parameters for the SourceControlsClient.Delete method. +func (client *SourceControlsClient) Delete(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string, repositoryAccess RepositoryAccessProperties, options *SourceControlsClientDeleteOptions) (SourceControlsClientDeleteResponse, error) { + var err error + const operationName = "SourceControlsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, workspaceName, sourceControlID, repositoryAccess, options) + if err != nil { + return SourceControlsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SourceControlsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SourceControlsClientDeleteResponse{}, err + } + resp, err := client.deleteHandleResponse(httpResp) + return resp, err +} + +// deleteCreateRequest creates the Delete request. +func (client *SourceControlsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string, repositoryAccess RepositoryAccessProperties, options *SourceControlsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}/delete" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if sourceControlID == "" { + return nil, errors.New("parameter sourceControlID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sourceControlId}", url.PathEscape(sourceControlID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, repositoryAccess); err != nil { + return nil, err + } + return req, nil +} + +// deleteHandleResponse handles the Delete response. +func (client *SourceControlsClient) deleteHandleResponse(resp *http.Response) (SourceControlsClientDeleteResponse, error) { + result := SourceControlsClientDeleteResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Warning); err != nil { + return SourceControlsClientDeleteResponse{}, err + } + return result, nil +} + +// Get - Gets a source control byt its identifier. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - sourceControlID - Source control Id +// - options - SourceControlsClientGetOptions contains the optional parameters for the SourceControlsClient.Get method. +func (client *SourceControlsClient) Get(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string, options *SourceControlsClientGetOptions) (SourceControlsClientGetResponse, error) { + var err error + const operationName = "SourceControlsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, workspaceName, sourceControlID, options) + if err != nil { + return SourceControlsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SourceControlsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SourceControlsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SourceControlsClient) getCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, sourceControlID string, options *SourceControlsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols/{sourceControlId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + if sourceControlID == "" { + return nil, errors.New("parameter sourceControlID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{sourceControlId}", url.PathEscape(sourceControlID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SourceControlsClient) getHandleResponse(resp *http.Response) (SourceControlsClientGetResponse, error) { + result := SourceControlsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SourceControl); err != nil { + return SourceControlsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all source controls, without source control items. +// +// Generated from API version 2023-11-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - workspaceName - The name of the workspace. +// - options - SourceControlsClientListOptions contains the optional parameters for the SourceControlsClient.NewListPager method. +func (client *SourceControlsClient) NewListPager(resourceGroupName string, workspaceName string, options *SourceControlsClientListOptions) *runtime.Pager[SourceControlsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SourceControlsClientListResponse]{ + More: func(page SourceControlsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SourceControlsClientListResponse) (SourceControlsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SourceControlsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, workspaceName, options) + }, nil) + if err != nil { + return SourceControlsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *SourceControlsClient) listCreateRequest(ctx context.Context, resourceGroupName string, workspaceName string, options *SourceControlsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OperationalInsights/workspaces/{workspaceName}/providers/Microsoft.SecurityInsights/sourcecontrols" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if workspaceName == "" { + return nil, errors.New("parameter workspaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{workspaceName}", url.PathEscape(workspaceName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2023-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SourceControlsClient) listHandleResponse(resp *http.Response) (SourceControlsClientListResponse, error) { + result := SourceControlsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SourceControlList); err != nil { + return SourceControlsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicator_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicator_client.go index c85cb12b04a9..ed4811087883 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicator_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicator_client.go @@ -46,7 +46,7 @@ func NewThreatIntelligenceIndicatorClient(subscriptionID string, credential azco // AppendTags - Append tags to a threat intelligence indicator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - name - Threat intelligence indicator name field. @@ -98,7 +98,7 @@ func (client *ThreatIntelligenceIndicatorClient) appendTagsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, threatIntelligenceAppendTags); err != nil { @@ -110,7 +110,7 @@ func (client *ThreatIntelligenceIndicatorClient) appendTagsCreateRequest(ctx con // Create - Update a threat Intelligence indicator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - name - Threat intelligence indicator name field. @@ -163,7 +163,7 @@ func (client *ThreatIntelligenceIndicatorClient) createCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, threatIntelligenceProperties); err != nil { @@ -184,7 +184,7 @@ func (client *ThreatIntelligenceIndicatorClient) createHandleResponse(resp *http // CreateIndicator - Create a new threat intelligence indicator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - threatIntelligenceProperties - Properties of threat intelligence indicators to create and update. @@ -232,7 +232,7 @@ func (client *ThreatIntelligenceIndicatorClient) createIndicatorCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, threatIntelligenceProperties); err != nil { @@ -253,7 +253,7 @@ func (client *ThreatIntelligenceIndicatorClient) createIndicatorHandleResponse(r // Delete - Delete a threat intelligence indicator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - name - Threat intelligence indicator name field. @@ -304,7 +304,7 @@ func (client *ThreatIntelligenceIndicatorClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -313,7 +313,7 @@ func (client *ThreatIntelligenceIndicatorClient) deleteCreateRequest(ctx context // Get - View a threat intelligence indicator by name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - name - Threat intelligence indicator name field. @@ -365,7 +365,7 @@ func (client *ThreatIntelligenceIndicatorClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -382,7 +382,7 @@ func (client *ThreatIntelligenceIndicatorClient) getHandleResponse(resp *http.Re // NewQueryIndicatorsPager - Query threat intelligence indicators as per filtering criteria. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - threatIntelligenceFilteringCriteria - Filtering criteria for querying threat intelligence indicators. @@ -431,7 +431,7 @@ func (client *ThreatIntelligenceIndicatorClient) queryIndicatorsCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, threatIntelligenceFilteringCriteria); err != nil { @@ -452,7 +452,7 @@ func (client *ThreatIntelligenceIndicatorClient) queryIndicatorsHandleResponse(r // ReplaceTags - Replace tags added to a threat intelligence indicator. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - name - Threat intelligence indicator name field. @@ -505,7 +505,7 @@ func (client *ThreatIntelligenceIndicatorClient) replaceTagsCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, threatIntelligenceReplaceTags); err != nil { diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicator_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicator_client_example_test.go deleted file mode 100644 index 8a3034824832..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicator_client_example_test.go +++ /dev/null @@ -1,438 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/threatintelligence/CreateThreatIntelligence.json -func ExampleThreatIntelligenceIndicatorClient_CreateIndicator() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewThreatIntelligenceIndicatorClient().CreateIndicator(ctx, "myRg", "myWorkspace", armsecurityinsights.ThreatIntelligenceIndicatorModel{ - Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceInnerKindIndicator), - Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ - Description: to.Ptr("debugging indicators"), - Confidence: to.Ptr[int32](78), - CreatedByRef: to.Ptr("contoso@contoso.com"), - DisplayName: to.Ptr("new schema"), - ExternalReferences: []*armsecurityinsights.ThreatIntelligenceExternalReference{}, - GranularMarkings: []*armsecurityinsights.ThreatIntelligenceGranularMarkingModel{}, - KillChainPhases: []*armsecurityinsights.ThreatIntelligenceKillChainPhase{}, - Labels: []*string{}, - Modified: to.Ptr(""), - Pattern: to.Ptr("[url:value = 'https://www.contoso.com']"), - PatternType: to.Ptr("url"), - Revoked: to.Ptr(false), - Source: to.Ptr("Azure Sentinel"), - ThreatIntelligenceTags: []*string{ - to.Ptr("new schema")}, - ThreatTypes: []*string{ - to.Ptr("compromised")}, - ValidFrom: to.Ptr("2020-04-15T17:44:00.114052Z"), - ValidUntil: to.Ptr(""), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.ThreatIntelligenceIndicatorClientCreateIndicatorResponse{ - // ThreatIntelligenceInformationClassification: &armsecurityinsights.ThreatIntelligenceIndicatorModel{ - // Name: to.Ptr("180105c7-a28d-b1a2-4a78-234f6ec80fd6"), - // Type: to.Ptr("Microsoft.SecurityInsights/ThreatIntelligence"), - // ID: to.Ptr("/subscriptions/bd794837-4d29-4647-9105-6339bfdb4e6a/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/ThreatIntelligence/180105c7-a28d-b1a2-4a78-234f6ec80fd6"), - // Etag: to.Ptr("\"0000322c-0000-0800-0000-5e976c960000\""), - // Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceInnerKindIndicator), - // Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ - // Description: to.Ptr("debugging indicators"), - // Confidence: to.Ptr[int32](78), - // Created: to.Ptr("2020-04-15T20:20:38.6160949Z"), - // CreatedByRef: to.Ptr("contoso@contoso.com"), - // DisplayName: to.Ptr("new schema"), - // ExternalID: to.Ptr("indicator--a2b6a95e-2108-4a38-bd49-ef95811bbcd7"), - // ExternalReferences: []*armsecurityinsights.ThreatIntelligenceExternalReference{ - // }, - // GranularMarkings: []*armsecurityinsights.ThreatIntelligenceGranularMarkingModel{ - // }, - // KillChainPhases: []*armsecurityinsights.ThreatIntelligenceKillChainPhase{ - // }, - // LastUpdatedTimeUTC: to.Ptr("2020-04-15T20:20:38.6161887Z"), - // Pattern: to.Ptr("[url:value = 'https://www.contoso.com']"), - // PatternType: to.Ptr("url"), - // Revoked: to.Ptr(false), - // Source: to.Ptr("Azure Sentinel"), - // ThreatIntelligenceTags: []*string{ - // to.Ptr("new schema")}, - // ThreatTypes: []*string{ - // to.Ptr("compromised")}, - // ValidFrom: to.Ptr("2020-04-15T17:44:00.114052Z"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/threatintelligence/GetThreatIntelligenceById.json -func ExampleThreatIntelligenceIndicatorClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewThreatIntelligenceIndicatorClient().Get(ctx, "myRg", "myWorkspace", "e16ef847-962e-d7b6-9c8b-a33e4bd30e47", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.ThreatIntelligenceIndicatorClientGetResponse{ - // ThreatIntelligenceInformationClassification: &armsecurityinsights.ThreatIntelligenceIndicatorModel{ - // Name: to.Ptr("e16ef847-962e-d7b6-9c8b-a33e4bd30e47"), - // Type: to.Ptr("Microsoft.SecurityInsights/ThreatIntelligence"), - // ID: to.Ptr("/subscriptions/bd794837-4d29-4647-9105-6339bfdb4e6a/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/ThreatIntelligence/e16ef847-962e-d7b6-9c8b-a33e4bd30e47"), - // Etag: to.Ptr("\"00002a2c-0000-0800-0000-5e97683b0000\""), - // Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceInnerKindIndicator), - // Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ - // Description: to.Ptr("debugging indicators"), - // Confidence: to.Ptr[int32](78), - // Created: to.Ptr("2020-04-15T19:51:17.1050923Z"), - // CreatedByRef: to.Ptr("aztestConnectors@dataconnector.ccsctp.net"), - // DisplayName: to.Ptr("updated indicator"), - // ExternalID: to.Ptr("indicator--73be1729-babb-4348-a6c4-94621cae2530"), - // ExternalReferences: []*armsecurityinsights.ThreatIntelligenceExternalReference{ - // }, - // GranularMarkings: []*armsecurityinsights.ThreatIntelligenceGranularMarkingModel{ - // }, - // KillChainPhases: []*armsecurityinsights.ThreatIntelligenceKillChainPhase{ - // }, - // LastUpdatedTimeUTC: to.Ptr("2020-04-15T20:18:49.2259902Z"), - // Pattern: to.Ptr("[url:value = 'https://abc.com']"), - // PatternType: to.Ptr("url"), - // Revoked: to.Ptr(false), - // Source: to.Ptr("Azure Sentinel"), - // ThreatIntelligenceTags: []*string{ - // to.Ptr("patching tags")}, - // ThreatTypes: []*string{ - // to.Ptr("compromised")}, - // ValidFrom: to.Ptr("2020-04-15T17:44:00.114052Z"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/threatintelligence/UpdateThreatIntelligence.json -func ExampleThreatIntelligenceIndicatorClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewThreatIntelligenceIndicatorClient().Create(ctx, "myRg", "myWorkspace", "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", armsecurityinsights.ThreatIntelligenceIndicatorModel{ - Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceInnerKindIndicator), - Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ - Description: to.Ptr("debugging indicators"), - Confidence: to.Ptr[int32](78), - CreatedByRef: to.Ptr("contoso@contoso.com"), - DisplayName: to.Ptr("new schema"), - ExternalReferences: []*armsecurityinsights.ThreatIntelligenceExternalReference{}, - GranularMarkings: []*armsecurityinsights.ThreatIntelligenceGranularMarkingModel{}, - KillChainPhases: []*armsecurityinsights.ThreatIntelligenceKillChainPhase{}, - Labels: []*string{}, - Modified: to.Ptr(""), - Pattern: to.Ptr("[url:value = 'https://www.contoso.com']"), - PatternType: to.Ptr("url"), - Revoked: to.Ptr(false), - Source: to.Ptr("Azure Sentinel"), - ThreatIntelligenceTags: []*string{ - to.Ptr("new schema")}, - ThreatTypes: []*string{ - to.Ptr("compromised")}, - ValidFrom: to.Ptr("2020-04-15T17:44:00.114052Z"), - ValidUntil: to.Ptr(""), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.ThreatIntelligenceIndicatorClientCreateResponse{ - // ThreatIntelligenceInformationClassification: &armsecurityinsights.ThreatIntelligenceIndicatorModel{ - // Name: to.Ptr("180105c7-a28d-b1a2-4a78-234f6ec80fd6"), - // Type: to.Ptr("Microsoft.SecurityInsights/ThreatIntelligence"), - // ID: to.Ptr("/subscriptions/bd794837-4d29-4647-9105-6339bfdb4e6a/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/ThreatIntelligence/180105c7-a28d-b1a2-4a78-234f6ec80fd6"), - // Etag: to.Ptr("\"0000322c-0000-0800-0000-5e976c960000\""), - // Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceInnerKindIndicator), - // Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ - // Description: to.Ptr("debugging indicators"), - // Confidence: to.Ptr[int32](78), - // Created: to.Ptr("2020-04-15T20:20:38.6160949Z"), - // CreatedByRef: to.Ptr("contoso@contoso.com"), - // DisplayName: to.Ptr("new schema"), - // ExternalID: to.Ptr("indicator--a2b6a95e-2108-4a38-bd49-ef95811bbcd7"), - // ExternalReferences: []*armsecurityinsights.ThreatIntelligenceExternalReference{ - // }, - // GranularMarkings: []*armsecurityinsights.ThreatIntelligenceGranularMarkingModel{ - // }, - // KillChainPhases: []*armsecurityinsights.ThreatIntelligenceKillChainPhase{ - // }, - // LastUpdatedTimeUTC: to.Ptr("2020-04-15T20:20:38.6161887Z"), - // Pattern: to.Ptr("[url:value = 'https://www.contoso.com']"), - // PatternType: to.Ptr("url"), - // Revoked: to.Ptr(false), - // Source: to.Ptr("Azure Sentinel"), - // ThreatIntelligenceTags: []*string{ - // to.Ptr("new schema")}, - // ThreatTypes: []*string{ - // to.Ptr("compromised")}, - // ValidFrom: to.Ptr("2020-04-15T17:44:00.114052Z"), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/threatintelligence/DeleteThreatIntelligence.json -func ExampleThreatIntelligenceIndicatorClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewThreatIntelligenceIndicatorClient().Delete(ctx, "myRg", "myWorkspace", "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/threatintelligence/QueryThreatIntelligence.json -func ExampleThreatIntelligenceIndicatorClient_NewQueryIndicatorsPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewThreatIntelligenceIndicatorClient().NewQueryIndicatorsPager("myRg", "myWorkspace", armsecurityinsights.ThreatIntelligenceFilteringCriteria{ - MaxConfidence: to.Ptr[int32](80), - MaxValidUntil: to.Ptr("2020-04-25T17:44:00.114052Z"), - MinConfidence: to.Ptr[int32](25), - MinValidUntil: to.Ptr("2020-04-05T17:44:00.114052Z"), - PageSize: to.Ptr[int32](100), - SortBy: []*armsecurityinsights.ThreatIntelligenceSortingCriteria{ - { - ItemKey: to.Ptr("lastUpdatedTimeUtc"), - SortOrder: to.Ptr(armsecurityinsights.ThreatIntelligenceSortingOrderDescending), - }}, - Sources: []*string{ - to.Ptr("Azure Sentinel")}, - }, nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ThreatIntelligenceInformationList = armsecurityinsights.ThreatIntelligenceInformationList{ - // Value: []armsecurityinsights.ThreatIntelligenceInformationClassification{ - // &armsecurityinsights.ThreatIntelligenceIndicatorModel{ - // Name: to.Ptr("27d963e6-e6e4-e0f9-e9d7-c53985b3bbe8"), - // Type: to.Ptr("Microsoft.SecurityInsights/ThreatIntelligence"), - // ID: to.Ptr("/subscriptions/bd794837-4d29-4647-9105-6339bfdb4e6a/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/ThreatIntelligence/27d963e6-e6e4-e0f9-e9d7-c53985b3bbe8"), - // Etag: to.Ptr("\"00002f2c-0000-0800-0000-5e976a8e0000\""), - // Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceInnerKindIndicator), - // Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ - // Description: to.Ptr("debugging indicators 2"), - // Confidence: to.Ptr[int32](90), - // Created: to.Ptr("2020-04-15T20:11:57.9666134Z"), - // CreatedByRef: to.Ptr("contoso@contoso.com"), - // DisplayName: to.Ptr("new schema 2"), - // ExternalID: to.Ptr("indicator--8516d567-0daa-4614-8745-e3591e1b48cf"), - // ExternalReferences: []*armsecurityinsights.ThreatIntelligenceExternalReference{ - // }, - // GranularMarkings: []*armsecurityinsights.ThreatIntelligenceGranularMarkingModel{ - // }, - // KillChainPhases: []*armsecurityinsights.ThreatIntelligenceKillChainPhase{ - // }, - // LastUpdatedTimeUTC: to.Ptr("2020-04-15T20:15:11.0746926Z"), - // ParsedPattern: []*armsecurityinsights.ThreatIntelligenceParsedPattern{ - // { - // PatternTypeKey: to.Ptr("network-traffic"), - // PatternTypeValues: []*armsecurityinsights.ThreatIntelligenceParsedPatternTypeValue{ - // { - // Value: to.Ptr("SSH-2.0-PuTTY_Release_0.64"), - // ValueType: to.Ptr("0"), - // }, - // { - // Value: to.Ptr("194.88.106.146"), - // ValueType: to.Ptr("1"), - // }}, - // }}, - // Pattern: to.Ptr("[url:value = 'https://www.contoso.com']"), - // PatternType: to.Ptr("url"), - // Revoked: to.Ptr(false), - // Source: to.Ptr("Azure Sentinel"), - // ThreatIntelligenceTags: []*string{ - // to.Ptr("new schema")}, - // ThreatTypes: []*string{ - // to.Ptr("compromised")}, - // ValidFrom: to.Ptr("2020-04-15T17:44:00.114052Z"), - // }, - // }, - // &armsecurityinsights.ThreatIntelligenceIndicatorModel{ - // Name: to.Ptr("e16ef847-962e-d7b6-9c8b-a33e4bd30e47"), - // Type: to.Ptr("Microsoft.SecurityInsights/ThreatIntelligence"), - // ID: to.Ptr("/subscriptions/bd794837-4d29-4647-9105-6339bfdb4e6a/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/ThreatIntelligence/e16ef847-962e-d7b6-9c8b-a33e4bd30e47"), - // Etag: to.Ptr("\"00002a2c-0000-0800-0000-5e97683b0000\""), - // Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceInnerKindIndicator), - // Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ - // Description: to.Ptr("debugging indicators"), - // Confidence: to.Ptr[int32](78), - // Created: to.Ptr("2020-04-15T19:51:17.1050923Z"), - // CreatedByRef: to.Ptr("contoso@contoso.com"), - // DisplayName: to.Ptr("updated indicator"), - // ExternalID: to.Ptr("indicator--73be1729-babb-4348-a6c4-94621cae2530"), - // ExternalReferences: []*armsecurityinsights.ThreatIntelligenceExternalReference{ - // }, - // GranularMarkings: []*armsecurityinsights.ThreatIntelligenceGranularMarkingModel{ - // }, - // KillChainPhases: []*armsecurityinsights.ThreatIntelligenceKillChainPhase{ - // }, - // LastUpdatedTimeUTC: to.Ptr("2020-04-15T20:15:11.074903Z"), - // Pattern: to.Ptr("[url:value = 'https://www.contoso.com']"), - // PatternType: to.Ptr("url"), - // Revoked: to.Ptr(false), - // Source: to.Ptr("Azure Sentinel"), - // ThreatIntelligenceTags: []*string{ - // to.Ptr("patching tags")}, - // ThreatTypes: []*string{ - // to.Ptr("compromised")}, - // ValidFrom: to.Ptr("2020-04-15T17:44:00.114052Z"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/threatintelligence/AppendTagsThreatIntelligence.json -func ExampleThreatIntelligenceIndicatorClient_AppendTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewThreatIntelligenceIndicatorClient().AppendTags(ctx, "myRg", "myWorkspace", "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", armsecurityinsights.ThreatIntelligenceAppendTags{ - ThreatIntelligenceTags: []*string{ - to.Ptr("tag1"), - to.Ptr("tag2")}, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/threatintelligence/ReplaceTagsThreatIntelligence.json -func ExampleThreatIntelligenceIndicatorClient_ReplaceTags() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewThreatIntelligenceIndicatorClient().ReplaceTags(ctx, "myRg", "myWorkspace", "d9cd6f0b-96b9-3984-17cd-a779d1e15a93", armsecurityinsights.ThreatIntelligenceIndicatorModel{ - Etag: to.Ptr("\"0000262c-0000-0800-0000-5e9767060000\""), - Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceInnerKindIndicator), - Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ - ThreatIntelligenceTags: []*string{ - to.Ptr("patching tags")}, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res = armsecurityinsights.ThreatIntelligenceIndicatorClientReplaceTagsResponse{ - // ThreatIntelligenceInformationClassification: &armsecurityinsights.ThreatIntelligenceIndicatorModel{ - // Name: to.Ptr("e16ef847-962e-d7b6-9c8b-a33e4bd30e47"), - // Type: to.Ptr("Microsoft.SecurityInsights/ThreatIntelligence"), - // ID: to.Ptr("/subscriptions/bd794837-4d29-4647-9105-6339bfdb4e6a/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/ThreatIntelligence/e16ef847-962e-d7b6-9c8b-a33e4bd30e47"), - // Etag: to.Ptr("\"00002a2c-0000-0800-0000-5e97683b0000\""), - // Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceInnerKindIndicator), - // Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ - // Description: to.Ptr("debugging indicators"), - // Confidence: to.Ptr[int32](78), - // Created: to.Ptr("2020-04-15T19:51:17.1050923Z"), - // CreatedByRef: to.Ptr("aztestConnectors@dataconnector.ccsctp.net"), - // DisplayName: to.Ptr("updated indicator"), - // ExternalID: to.Ptr("indicator--73be1729-babb-4348-a6c4-94621cae2530"), - // ExternalReferences: []*armsecurityinsights.ThreatIntelligenceExternalReference{ - // }, - // GranularMarkings: []*armsecurityinsights.ThreatIntelligenceGranularMarkingModel{ - // }, - // KillChainPhases: []*armsecurityinsights.ThreatIntelligenceKillChainPhase{ - // }, - // LastUpdatedTimeUTC: to.Ptr("2020-04-15T19:56:08.828946Z"), - // Pattern: to.Ptr("[url:value = 'https://abc.com']"), - // PatternType: to.Ptr("url"), - // Revoked: to.Ptr(false), - // Source: to.Ptr("Azure Sentinel"), - // ThreatIntelligenceTags: []*string{ - // to.Ptr("patching tags")}, - // ThreatTypes: []*string{ - // to.Ptr("compromised")}, - // ValidFrom: to.Ptr("2020-04-15T17:44:00.114052Z"), - // }, - // }, - // } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicatormetrics_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicatormetrics_client.go index 7e15d26ced3a..811f50bce326 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicatormetrics_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicatormetrics_client.go @@ -46,7 +46,7 @@ func NewThreatIntelligenceIndicatorMetricsClient(subscriptionID string, credenti // List - Get threat intelligence indicators metrics (Indicators counts by Type, Threat Type, Source). // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - options - ThreatIntelligenceIndicatorMetricsClientListOptions contains the optional parameters for the ThreatIntelligenceIndicatorMetricsClient.List @@ -93,7 +93,7 @@ func (client *ThreatIntelligenceIndicatorMetricsClient) listCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicatormetrics_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicatormetrics_client_example_test.go deleted file mode 100644 index 67c81c4435a9..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicatormetrics_client_example_test.go +++ /dev/null @@ -1,65 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/threatintelligence/CollectThreatIntelligenceMetrics.json -func ExampleThreatIntelligenceIndicatorMetricsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewThreatIntelligenceIndicatorMetricsClient().List(ctx, "myRg", "myWorkspace", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ThreatIntelligenceMetricsList = armsecurityinsights.ThreatIntelligenceMetricsList{ - // Value: []*armsecurityinsights.ThreatIntelligenceMetrics{ - // { - // Properties: &armsecurityinsights.ThreatIntelligenceMetric{ - // LastUpdatedTimeUTC: to.Ptr("2020-09-01T19:44:44.117403Z"), - // PatternTypeMetrics: []*armsecurityinsights.ThreatIntelligenceMetricEntity{ - // { - // MetricName: to.Ptr("url"), - // MetricValue: to.Ptr[int32](20), - // }}, - // SourceMetrics: []*armsecurityinsights.ThreatIntelligenceMetricEntity{ - // { - // MetricName: to.Ptr("Azure Sentinel"), - // MetricValue: to.Ptr[int32](10315), - // }, - // { - // MetricName: to.Ptr("zinga"), - // MetricValue: to.Ptr[int32](2), - // }}, - // ThreatTypeMetrics: []*armsecurityinsights.ThreatIntelligenceMetricEntity{ - // { - // MetricName: to.Ptr("compromised"), - // MetricValue: to.Ptr[int32](20), - // }}, - // }, - // }}, - // } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicators_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicators_client.go index 8fecdcebb0b1..814910b0a282 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicators_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicators_client.go @@ -46,7 +46,7 @@ func NewThreatIntelligenceIndicatorsClient(subscriptionID string, credential azc // NewListPager - Get all threat intelligence indicators. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - options - ThreatIntelligenceIndicatorsClientListOptions contains the optional parameters for the ThreatIntelligenceIndicatorsClient.NewListPager @@ -94,7 +94,7 @@ func (client *ThreatIntelligenceIndicatorsClient) listCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicators_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicators_client_example_test.go deleted file mode 100644 index dad987e73ae2..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/threatintelligenceindicators_client_example_test.go +++ /dev/null @@ -1,112 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/threatintelligence/GetThreatIntelligence.json -func ExampleThreatIntelligenceIndicatorsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewThreatIntelligenceIndicatorsClient().NewListPager("myRg", "myWorkspace", &armsecurityinsights.ThreatIntelligenceIndicatorsClientListOptions{Filter: nil, - Top: nil, - SkipToken: nil, - Orderby: nil, - }) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ThreatIntelligenceInformationList = armsecurityinsights.ThreatIntelligenceInformationList{ - // Value: []armsecurityinsights.ThreatIntelligenceInformationClassification{ - // &armsecurityinsights.ThreatIntelligenceIndicatorModel{ - // Name: to.Ptr("27d963e6-e6e4-e0f9-e9d7-c53985b3bbe8"), - // Type: to.Ptr("Microsoft.SecurityInsights/ThreatIntelligence"), - // ID: to.Ptr("/subscriptions/bd794837-4d29-4647-9105-6339bfdb4e6a/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/ThreatIntelligence/27d963e6-e6e4-e0f9-e9d7-c53985b3bbe8"), - // Etag: to.Ptr("\"00002f2c-0000-0800-0000-5e976a8e0000\""), - // Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceInnerKindIndicator), - // Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ - // Description: to.Ptr("debugging indicators"), - // Confidence: to.Ptr[int32](90), - // Created: to.Ptr("2020-04-15T20:11:57.9666134Z"), - // CreatedByRef: to.Ptr("contoso@contoso.com"), - // DisplayName: to.Ptr("new schema 2"), - // ExternalID: to.Ptr("indicator--8516d567-0daa-4614-8745-e3591e1b48cf"), - // ExternalReferences: []*armsecurityinsights.ThreatIntelligenceExternalReference{ - // }, - // GranularMarkings: []*armsecurityinsights.ThreatIntelligenceGranularMarkingModel{ - // }, - // KillChainPhases: []*armsecurityinsights.ThreatIntelligenceKillChainPhase{ - // }, - // LastUpdatedTimeUTC: to.Ptr("2020-04-15T20:15:11.0746926Z"), - // Pattern: to.Ptr("[url:value = 'https://www.contoso.com']"), - // PatternType: to.Ptr("url"), - // Revoked: to.Ptr(false), - // Source: to.Ptr("Azure Sentinel"), - // ThreatIntelligenceTags: []*string{ - // to.Ptr("new schema")}, - // ThreatTypes: []*string{ - // to.Ptr("compromised")}, - // ValidFrom: to.Ptr("2020-04-15T17:44:00.114052Z"), - // }, - // }, - // &armsecurityinsights.ThreatIntelligenceIndicatorModel{ - // Name: to.Ptr("e16ef847-962e-d7b6-9c8b-a33e4bd30e47"), - // Type: to.Ptr("Microsoft.SecurityInsights/ThreatIntelligence"), - // ID: to.Ptr("/subscriptions/bd794837-4d29-4647-9105-6339bfdb4e6a/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/ThreatIntelligence/e16ef847-962e-d7b6-9c8b-a33e4bd30e47"), - // Etag: to.Ptr("\"00002a2c-0000-0800-0000-5e97683b0000\""), - // Kind: to.Ptr(armsecurityinsights.ThreatIntelligenceResourceInnerKindIndicator), - // Properties: &armsecurityinsights.ThreatIntelligenceIndicatorProperties{ - // Description: to.Ptr("debugging indicators"), - // Confidence: to.Ptr[int32](78), - // Created: to.Ptr("2020-04-15T19:51:17.1050923Z"), - // CreatedByRef: to.Ptr("contoso@contoso.com"), - // DisplayName: to.Ptr("updated indicator"), - // ExternalID: to.Ptr("indicator--73be1729-babb-4348-a6c4-94621cae2530"), - // ExternalReferences: []*armsecurityinsights.ThreatIntelligenceExternalReference{ - // }, - // GranularMarkings: []*armsecurityinsights.ThreatIntelligenceGranularMarkingModel{ - // }, - // KillChainPhases: []*armsecurityinsights.ThreatIntelligenceKillChainPhase{ - // }, - // LastUpdatedTimeUTC: to.Ptr("2020-04-15T20:15:11.074903Z"), - // Pattern: to.Ptr("[url:value = 'https://www.contoso.com']"), - // PatternType: to.Ptr("url"), - // Revoked: to.Ptr(false), - // Source: to.Ptr("Azure Sentinel"), - // ThreatIntelligenceTags: []*string{ - // to.Ptr("patching tags")}, - // ThreatTypes: []*string{ - // to.Ptr("compromised")}, - // ValidFrom: to.Ptr("2020-04-15T17:44:00.114052Z"), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlistitems_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlistitems_client.go index ef295ace02fd..fd9bb59a148e 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlistitems_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlistitems_client.go @@ -46,7 +46,7 @@ func NewWatchlistItemsClient(subscriptionID string, credential azcore.TokenCrede // CreateOrUpdate - Create or update a watchlist item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - watchlistAlias - The watchlist alias @@ -104,7 +104,7 @@ func (client *WatchlistItemsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, watchlistItem); err != nil { @@ -125,7 +125,7 @@ func (client *WatchlistItemsClient) createOrUpdateHandleResponse(resp *http.Resp // Delete - Delete a watchlist item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - watchlistAlias - The watchlist alias @@ -180,7 +180,7 @@ func (client *WatchlistItemsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -189,7 +189,7 @@ func (client *WatchlistItemsClient) deleteCreateRequest(ctx context.Context, res // Get - Get a watchlist item. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - watchlistAlias - The watchlist alias @@ -245,7 +245,7 @@ func (client *WatchlistItemsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -262,7 +262,7 @@ func (client *WatchlistItemsClient) getHandleResponse(resp *http.Response) (Watc // NewListPager - Get all watchlist Items. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - watchlistAlias - The watchlist alias @@ -314,7 +314,7 @@ func (client *WatchlistItemsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlistitems_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlistitems_client_example_test.go deleted file mode 100644 index 8bfc645ec9af..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlistitems_client_example_test.go +++ /dev/null @@ -1,213 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/watchlists/GetWatchlistItems.json -func ExampleWatchlistItemsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWatchlistItemsClient().NewListPager("myRg", "myWorkspace", "highValueAsset", &armsecurityinsights.WatchlistItemsClientListOptions{SkipToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WatchlistItemList = armsecurityinsights.WatchlistItemList{ - // Value: []*armsecurityinsights.WatchlistItem{ - // { - // Name: to.Ptr("fd37d325-7090-47fe-851a-5b5a00c3f576"), - // Type: to.Ptr("Microsoft.SecurityInsights/Watchlists/WatchlistItems"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/Watchlists/highValueAsset/WatchlistItems/fd37d325-7090-47fe-851a-5b5a00c3f576"), - // Etag: to.Ptr("\"f2089bfa-0000-0d00-0000-601c58b42021\""), - // Properties: &armsecurityinsights.WatchlistItemProperties{ - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-04T20:27:32.378Z"); return t}()), - // CreatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // EntityMapping: map[string]any{ - // }, - // IsDeleted: to.Ptr(false), - // ItemsKeyValue: map[string]any{ - // "Header-1": "v1_1", - // "Header-2": "v1_2", - // "Header-3": "v1_3", - // "Header-4": "v1_4", - // "Header-5": "v1_5", - // }, - // TenantID: to.Ptr("3f8901fe-63d9-4875-9ad5-9fb3b8105797"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-04T20:27:32.378Z"); return t}()), - // UpdatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // WatchlistItemID: to.Ptr("fd37d325-7090-47fe-851a-5b5a00c3f576"), - // WatchlistItemType: to.Ptr("watchlist-item"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/watchlists/GetWatchlistItemById.json -func ExampleWatchlistItemsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWatchlistItemsClient().Get(ctx, "myRg", "myWorkspace", "highValueAsset", "3f8901fe-63d9-4875-9ad5-9fb3b8105797", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WatchlistItem = armsecurityinsights.WatchlistItem{ - // Name: to.Ptr("fd37d325-7090-47fe-851a-5b5a00c3f576"), - // Type: to.Ptr("Microsoft.SecurityInsights/Watchlists/WatchlistItems"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/Watchlists/highValueAsset/WatchlistItems/fd37d325-7090-47fe-851a-5b5a00c3f576"), - // Etag: to.Ptr("\"f2089bfa-0000-0d00-0000-601c58b42021\""), - // Properties: &armsecurityinsights.WatchlistItemProperties{ - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-04T20:27:32.378Z"); return t}()), - // CreatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // EntityMapping: map[string]any{ - // }, - // IsDeleted: to.Ptr(false), - // ItemsKeyValue: map[string]any{ - // "Header-1": "v1_1", - // "Header-2": "v1_2", - // "Header-3": "v1_3", - // "Header-4": "v1_4", - // "Header-5": "v1_5", - // }, - // TenantID: to.Ptr("3f8901fe-63d9-4875-9ad5-9fb3b8105797"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-02-04T20:27:32.378Z"); return t}()), - // UpdatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // WatchlistItemID: to.Ptr("fd37d325-7090-47fe-851a-5b5a00c3f576"), - // WatchlistItemType: to.Ptr("watchlist-item"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/watchlists/DeleteWatchlistItem.json -func ExampleWatchlistItemsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewWatchlistItemsClient().Delete(ctx, "myRg", "myWorkspace", "highValueAsset", "4008512e-1d30-48b2-9ee2-d3612ed9d3ea", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/watchlists/CreateWatchlistItem.json -func ExampleWatchlistItemsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWatchlistItemsClient().CreateOrUpdate(ctx, "myRg", "myWorkspace", "highValueAsset", "82ba292c-dc97-4dfc-969d-d4dd9e666842", armsecurityinsights.WatchlistItem{ - Etag: to.Ptr("0300bf09-0000-0000-0000-5c37296e0000"), - Properties: &armsecurityinsights.WatchlistItemProperties{ - ItemsKeyValue: map[string]any{ - "Business tier": "10.0.2.0/24", - "Data tier": "10.0.2.0/24", - "Gateway subnet": "10.0.255.224/27", - "Private DMZ in": "10.0.0.0/27", - "Public DMZ out": "10.0.0.96/27", - "Web Tier": "10.0.1.0/24", - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.WatchlistItem = armsecurityinsights.WatchlistItem{ - // Type: to.Ptr("Microsoft.SecurityInsights/Watchlists/WatchlistItems"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/Watchlists/highValueAsset/WatchlistItems/82ba292c-dc97-4dfc-969d-d4dd9e666842"), - // Etag: to.Ptr("0300bf09-0000-0000-0000-5c37296e0000"), - // Properties: &armsecurityinsights.WatchlistItemProperties{ - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-15T04:58:56.074Z"); return t}()), - // CreatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // IsDeleted: to.Ptr(false), - // ItemsKeyValue: map[string]any{ - // "Business tier": "10.0.2.0/24", - // "Data tier": "10.0.2.0/24", - // "Gateway subnet": "10.0.255.224/27", - // "Private DMZ in": "10.0.0.0/27", - // "Public DMZ out": "10.0.0.96/27", - // "Web Tier": "10.0.1.0/24", - // }, - // TenantID: to.Ptr("4008512e-1d30-48b2-9ee2-d3612ed9d3ea"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-11-16T16:05:20.000Z"); return t}()), - // UpdatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // WatchlistItemID: to.Ptr("82ba292c-dc97-4dfc-969d-d4dd9e666842"), - // WatchlistItemType: to.Ptr("watchlist-item"), - // }, - // } -} diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlists_client.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlists_client.go index 55f28756eaa3..3dfd5600140e 100644 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlists_client.go +++ b/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlists_client.go @@ -48,7 +48,7 @@ func NewWatchlistsClient(subscriptionID string, credential azcore.TokenCredentia // contentType properties. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - watchlistAlias - The watchlist alias @@ -101,7 +101,7 @@ func (client *WatchlistsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, watchlist); err != nil { @@ -122,7 +122,7 @@ func (client *WatchlistsClient) createOrUpdateHandleResponse(resp *http.Response // Delete - Delete a watchlist. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - watchlistAlias - The watchlist alias @@ -172,7 +172,7 @@ func (client *WatchlistsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -181,7 +181,7 @@ func (client *WatchlistsClient) deleteCreateRequest(ctx context.Context, resourc // Get - Get a watchlist, without its watchlist items. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - watchlistAlias - The watchlist alias @@ -232,7 +232,7 @@ func (client *WatchlistsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -249,7 +249,7 @@ func (client *WatchlistsClient) getHandleResponse(resp *http.Response) (Watchlis // NewListPager - Get all watchlists, without watchlist items. // -// Generated from API version 2021-10-01 +// Generated from API version 2023-11-01 // - resourceGroupName - The name of the resource group. The name is case insensitive. // - workspaceName - The name of the workspace. // - options - WatchlistsClientListOptions contains the optional parameters for the WatchlistsClient.NewListPager method. @@ -296,7 +296,7 @@ func (client *WatchlistsClient) listCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-10-01") + reqQP.Set("api-version", "2023-11-01") if options != nil && options.SkipToken != nil { reqQP.Set("$skipToken", *options.SkipToken) } diff --git a/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlists_client_example_test.go b/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlists_client_example_test.go deleted file mode 100644 index 365b2ba860b0..000000000000 --- a/sdk/resourcemanager/securityinsights/armsecurityinsights/watchlists_client_example_test.go +++ /dev/null @@ -1,273 +0,0 @@ -//go:build go1.18 -// +build go1.18 - -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DO NOT EDIT. - -package armsecurityinsights_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/securityinsights/armsecurityinsights" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/watchlists/GetWatchlists.json -func ExampleWatchlistsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewWatchlistsClient().NewListPager("myRg", "myWorkspace", &armsecurityinsights.WatchlistsClientListOptions{SkipToken: nil}) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.WatchlistList = armsecurityinsights.WatchlistList{ - // Value: []*armsecurityinsights.Watchlist{ - // { - // Name: to.Ptr("highValueAsset"), - // Type: to.Ptr("Microsoft.SecurityInsights/Watchlists"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/watchlists/highValueAsset"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Properties: &armsecurityinsights.WatchlistProperties{ - // Description: to.Ptr("Watchlist from CSV content"), - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-28T00:26:54.774Z"); return t}()), - // CreatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // DefaultDuration: to.Ptr("P1279DT12H30M5S"), - // DisplayName: to.Ptr("High Value Assets Watchlist"), - // IsDeleted: to.Ptr(false), - // ItemsSearchKey: to.Ptr("header1"), - // Labels: []*string{ - // to.Ptr("Tag1"), - // to.Ptr("Tag2")}, - // Provider: to.Ptr("Microsoft"), - // Source: to.Ptr(armsecurityinsights.SourceLocalFile), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-28T00:26:57.000Z"); return t}()), - // UpdatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // WatchlistAlias: to.Ptr("highValueAsset"), - // WatchlistID: to.Ptr("76d5a51f-ba1f-4038-9d22-59fda38dc017"), - // WatchlistType: to.Ptr("watchlist"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/watchlists/GetWatchlistByAlias.json -func ExampleWatchlistsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWatchlistsClient().Get(ctx, "myRg", "myWorkspace", "highValueAsset", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Watchlist = armsecurityinsights.Watchlist{ - // Name: to.Ptr("highValueAsset"), - // Type: to.Ptr("Microsoft.SecurityInsights/Watchlists"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/watchlists/highValueAsset"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Properties: &armsecurityinsights.WatchlistProperties{ - // Description: to.Ptr("Watchlist from CSV content"), - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-28T00:26:54.774Z"); return t}()), - // CreatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // DefaultDuration: to.Ptr("P1279DT12H30M5S"), - // DisplayName: to.Ptr("High Value Assets Watchlist"), - // IsDeleted: to.Ptr(false), - // ItemsSearchKey: to.Ptr("header1"), - // Labels: []*string{ - // to.Ptr("Tag1"), - // to.Ptr("Tag2")}, - // Provider: to.Ptr("Microsoft"), - // Source: to.Ptr(armsecurityinsights.SourceLocalFile), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-28T00:26:57.000Z"); return t}()), - // UpdatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // WatchlistAlias: to.Ptr("highValueAsset"), - // WatchlistID: to.Ptr("76d5a51f-ba1f-4038-9d22-59fda38dc017"), - // WatchlistType: to.Ptr("watchlist"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/watchlists/DeleteWatchlist.json -func ExampleWatchlistsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewWatchlistsClient().Delete(ctx, "myRg", "myWorkspace", "highValueAsset", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/watchlists/CreateWatchlistAndWatchlistItems.json -func ExampleWatchlistsClient_CreateOrUpdate_createOrUpdateAWatchlistAndBulkCreatesWatchlistItems() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWatchlistsClient().CreateOrUpdate(ctx, "myRg", "myWorkspace", "highValueAsset", armsecurityinsights.Watchlist{ - Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - Properties: &armsecurityinsights.WatchlistProperties{ - Description: to.Ptr("Watchlist from CSV content"), - ContentType: to.Ptr("text/csv"), - DisplayName: to.Ptr("High Value Assets Watchlist"), - ItemsSearchKey: to.Ptr("header1"), - NumberOfLinesToSkip: to.Ptr[int32](1), - Provider: to.Ptr("Microsoft"), - RawContent: to.Ptr("This line will be skipped\nheader1,header2\nvalue1,value2"), - Source: to.Ptr(armsecurityinsights.SourceLocalFile), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Watchlist = armsecurityinsights.Watchlist{ - // Name: to.Ptr("highValueAsset"), - // Type: to.Ptr("Microsoft.SecurityInsights/Watchlists"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/watchlists/highValueAsset"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Properties: &armsecurityinsights.WatchlistProperties{ - // Description: to.Ptr("Watchlist from CSV content"), - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-28T00:26:54.774Z"); return t}()), - // CreatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // DisplayName: to.Ptr("High Value Assets Watchlist"), - // IsDeleted: to.Ptr(false), - // ItemsSearchKey: to.Ptr("header1"), - // Provider: to.Ptr("Microsoft"), - // Source: to.Ptr(armsecurityinsights.SourceLocalFile), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-28T00:26:57.000Z"); return t}()), - // UpdatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // WatchlistAlias: to.Ptr("highValueAsset"), - // WatchlistID: to.Ptr("76d5a51f-ba1f-4038-9d22-59fda38dc017"), - // WatchlistType: to.Ptr("watchlist"), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/securityinsights/resource-manager/Microsoft.SecurityInsights/stable/2021-10-01/examples/watchlists/CreateWatchlist.json -func ExampleWatchlistsClient_CreateOrUpdate_createOrUpdateAWatchlist() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurityinsights.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewWatchlistsClient().CreateOrUpdate(ctx, "myRg", "myWorkspace", "highValueAsset", armsecurityinsights.Watchlist{ - Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - Properties: &armsecurityinsights.WatchlistProperties{ - Description: to.Ptr("Watchlist from CSV content"), - DisplayName: to.Ptr("High Value Assets Watchlist"), - ItemsSearchKey: to.Ptr("header1"), - Provider: to.Ptr("Microsoft"), - Source: to.Ptr(armsecurityinsights.SourceLocalFile), - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.Watchlist = armsecurityinsights.Watchlist{ - // Name: to.Ptr("highValueAsset"), - // Type: to.Ptr("Microsoft.SecurityInsights/Watchlists"), - // ID: to.Ptr("/subscriptions/d0cfe6b2-9ac0-4464-9919-dccaee2e48c0/resourceGroups/myRg/providers/Microsoft.OperationalIinsights/workspaces/myWorkspace/providers/Microsoft.SecurityInsights/watchlists/highValueAsset"), - // Etag: to.Ptr("\"0300bf09-0000-0000-0000-5c37296e0000\""), - // Properties: &armsecurityinsights.WatchlistProperties{ - // Description: to.Ptr("Watchlist from CSV content"), - // Created: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-28T00:26:54.774Z"); return t}()), - // CreatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // DisplayName: to.Ptr("High Value Assets Watchlist"), - // IsDeleted: to.Ptr(false), - // ItemsSearchKey: to.Ptr("header1"), - // Provider: to.Ptr("Microsoft"), - // Source: to.Ptr(armsecurityinsights.SourceLocalFile), - // TenantID: to.Ptr("f686d426-8d16-42db-81b7-ab578e110ccd"), - // Updated: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2020-09-28T00:26:57.000Z"); return t}()), - // UpdatedBy: &armsecurityinsights.UserInfo{ - // Name: to.Ptr("john doe"), - // Email: to.Ptr("john@contoso.com"), - // ObjectID: to.Ptr("2046feea-040d-4a46-9e2b-91c2941bfa70"), - // }, - // WatchlistAlias: to.Ptr("highValueAsset"), - // WatchlistID: to.Ptr("76d5a51f-ba1f-4038-9d22-59fda38dc017"), - // WatchlistType: to.Ptr("watchlist"), - // }, - // } -}