diff --git a/sdk/resourcemanager/security/armsecurity/CHANGELOG.md b/sdk/resourcemanager/security/armsecurity/CHANGELOG.md index 117d8965e921..e69b0f341994 100644 --- a/sdk/resourcemanager/security/armsecurity/CHANGELOG.md +++ b/sdk/resourcemanager/security/armsecurity/CHANGELOG.md @@ -1,5 +1,301 @@ # Release History +## 0.8.0 (2022-09-13) +### Breaking Changes + +- Type of `ContactProperties.AlertNotifications` has been changed from `*AlertNotifications` to `*ContactPropertiesAlertNotifications` +- Const `AlertNotificationsOff` has been removed +- Const `AlertNotificationsOn` has been removed +- Const `AlertsToAdminsOn` has been removed +- Const `AlertsToAdminsOff` has been removed +- Type alias `AlertsToAdmins` has been removed +- Type alias `AlertNotifications` has been removed +- Function `PossibleAlertsToAdminsValues` has been removed +- Function `*ContactsClient.Update` has been removed +- Function `PossibleAlertNotificationsValues` has been removed +- Function `*AlertsClient.Simulate` has been removed +- Struct `AlertsClientSimulateOptions` has been removed +- Struct `CloudError` has been removed +- Struct `CloudErrorBody` has been removed +- Struct `ConnectorPropertiesOrganizationalData` has been removed +- Struct `ContactsClientUpdateOptions` has been removed +- Struct `ContactsClientUpdateResponse` has been removed +- Field `OrganizationalData` of struct `ConnectorProperties` has been removed +- Field `CloudName` of struct `ConnectorProperties` has been removed +- Field `Email` of struct `ContactProperties` has been removed +- Field `AlertsToAdmins` of struct `ContactProperties` has been removed + +### Features Added + +- New const `OfferingTypeDefenderForContainersGcp` +- New const `CloudNameGithub` +- New const `GovernanceRuleOwnerSourceTypeByTag` +- New const `EnvironmentTypeGcpProject` +- New const `BundleTypeCosmosDbs` +- New const `OfferingTypeDefenderForServersGcp` +- New const `OfferingTypeCspmMonitorGithub` +- New const `MinimalSeverityMedium` +- New const `EnvironmentTypeAzureDevOpsScope` +- New const `SubPlanP1` +- New const `GovernanceRuleSourceResourceTypeAssessments` +- New const `EnvironmentTypeAwsAccount` +- New const `EnvironmentTypeGithubScope` +- New const `GovernanceRuleConditionOperatorIn` +- New const `OfferingTypeDefenderForDatabasesGcp` +- New const `ApplicationConditionOperatorIn` +- New const `RolesAccountAdmin` +- New const `OfferingTypeDefenderForDatabasesAws` +- New const `MinimalSeverityHigh` +- New const `OfferingTypeCspmMonitorAzureDevOps` +- New const `TypeTVM` +- New const `ApplicationSourceResourceTypeAssessments` +- New const `CloudNameAzureDevOps` +- New const `MinimalSeverityLow` +- New const `ScanningModeDefault` +- New const `GovernanceRuleOwnerSourceTypeManually` +- New const `OfferingTypeCspmMonitorGcp` +- New const `SubPlanP2` +- New const `GovernanceRuleTypeServiceNow` +- New const `SettingNameWDATPUNIFIEDSOLUTION` +- New const `RolesContributor` +- New const `RolesOwner` +- New const `RolesServiceAdmin` +- New const `GovernanceRuleConditionOperatorEquals` +- New const `ApplicationConditionOperatorContains` +- New const `TypeQualys` +- New const `GovernanceRuleTypeIntegrated` +- New const `AlertStatusInProgress` +- New type alias `ApplicationSourceResourceType` +- New type alias `ApplicationConditionOperator` +- New type alias `GovernanceRuleOwnerSourceType` +- New type alias `ScanningMode` +- New type alias `Type` +- New type alias `GovernanceRuleSourceResourceType` +- New type alias `Roles` +- New type alias `EnvironmentType` +- New type alias `SubPlan` +- New type alias `GovernanceRuleConditionOperator` +- New type alias `GovernanceRuleType` +- New type alias `MinimalSeverity` +- New function `*GovernanceRulesClient.Delete(context.Context, string, *GovernanceRulesClientDeleteOptions) (GovernanceRulesClientDeleteResponse, error)` +- New function `*GcpOrganizationalData.GetGcpOrganizationalData() *GcpOrganizationalData` +- New function `*AlertsClient.UpdateResourceGroupLevelStateToInProgress(context.Context, string, string, string, *AlertsClientUpdateResourceGroupLevelStateToInProgressOptions) (AlertsClientUpdateResourceGroupLevelStateToInProgressResponse, error)` +- New function `PossibleSubPlanValues() []SubPlan` +- New function `*AzureDevOpsScopeEnvironmentData.GetEnvironmentData() *EnvironmentData` +- New function `*GovernanceAssignmentsClient.CreateOrUpdate(context.Context, string, string, string, GovernanceAssignment, *GovernanceAssignmentsClientCreateOrUpdateOptions) (GovernanceAssignmentsClientCreateOrUpdateResponse, error)` +- New function `*GovernanceRulesClient.BeginRuleIDExecuteSingleSubscription(context.Context, string, *GovernanceRulesClientBeginRuleIDExecuteSingleSubscriptionOptions) (*runtime.Poller[GovernanceRulesClientRuleIDExecuteSingleSubscriptionResponse], error)` +- New function `*ConnectorApplicationClient.CreateOrUpdate(context.Context, string, string, string, Application, *ConnectorApplicationClientCreateOrUpdateOptions) (ConnectorApplicationClientCreateOrUpdateResponse, error)` +- New function `*GovernanceRulesClient.BeginRuleIDExecuteSingleSecurityConnector(context.Context, string, string, string, *GovernanceRulesClientBeginRuleIDExecuteSingleSecurityConnectorOptions) (*runtime.Poller[GovernanceRulesClientRuleIDExecuteSingleSecurityConnectorResponse], error)` +- New function `PossibleGovernanceRuleConditionOperatorValues() []GovernanceRuleConditionOperator` +- New function `*CspmMonitorGcpOffering.GetCloudOffering() *CloudOffering` +- New function `*DefenderForDatabasesGcpOffering.GetCloudOffering() *CloudOffering` +- New function `*ConnectorGovernanceRulesClient.CreateOrUpdate(context.Context, string, string, string, GovernanceRule, *ConnectorGovernanceRulesClientCreateOrUpdateOptions) (ConnectorGovernanceRulesClientCreateOrUpdateResponse, error)` +- New function `*GovernanceAssignmentsClient.Get(context.Context, string, string, string, *GovernanceAssignmentsClientGetOptions) (GovernanceAssignmentsClientGetResponse, error)` +- New function `*AwsOrganizationalDataMember.GetAwsOrganizationalData() *AwsOrganizationalData` +- New function `PossibleTypeValues() []Type` +- New function `NewConnectorApplicationsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ConnectorApplicationsClient, error)` +- New function `PossibleGovernanceRuleOwnerSourceTypeValues() []GovernanceRuleOwnerSourceType` +- New function `*ConnectorApplicationClient.Get(context.Context, string, string, string, *ConnectorApplicationClientGetOptions) (ConnectorApplicationClientGetResponse, error)` +- New function `PossibleApplicationConditionOperatorValues() []ApplicationConditionOperator` +- New function `PossibleScanningModeValues() []ScanningMode` +- New function `*AwsOrganizationalDataMaster.GetAwsOrganizationalData() *AwsOrganizationalData` +- New function `*ConnectorApplicationsClient.NewListPager(string, string, *ConnectorApplicationsClientListOptions) *runtime.Pager[ConnectorApplicationsClientListResponse]` +- New function `*GcpProjectEnvironmentData.GetEnvironmentData() *EnvironmentData` +- New function `PossibleGovernanceRuleSourceResourceTypeValues() []GovernanceRuleSourceResourceType` +- New function `*EnvironmentData.GetEnvironmentData() *EnvironmentData` +- New function `*SubscriptionGovernanceRulesExecuteStatusClient.BeginGet(context.Context, string, string, *SubscriptionGovernanceRulesExecuteStatusClientBeginGetOptions) (*runtime.Poller[SubscriptionGovernanceRulesExecuteStatusClientGetResponse], error)` +- New function `*ApplicationsClient.NewListPager(*ApplicationsClientListOptions) *runtime.Pager[ApplicationsClientListResponse]` +- New function `NewApplicationClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ApplicationClient, error)` +- New function `NewGovernanceAssignmentsClient(azcore.TokenCredential, *arm.ClientOptions) (*GovernanceAssignmentsClient, error)` +- New function `NewConnectorGovernanceRulesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ConnectorGovernanceRulesClient, error)` +- New function `*ConnectorGovernanceRulesExecuteStatusClient.BeginGet(context.Context, string, string, string, string, *ConnectorGovernanceRulesExecuteStatusClientBeginGetOptions) (*runtime.Poller[ConnectorGovernanceRulesExecuteStatusClientGetResponse], error)` +- New function `NewGovernanceRuleClient(string, azcore.TokenCredential, *arm.ClientOptions) (*GovernanceRuleClient, error)` +- New function `*GovernanceRulesClient.CreateOrUpdate(context.Context, string, GovernanceRule, *GovernanceRulesClientCreateOrUpdateOptions) (GovernanceRulesClientCreateOrUpdateResponse, error)` +- New function `*ConnectorApplicationClient.Delete(context.Context, string, string, string, *ConnectorApplicationClientDeleteOptions) (ConnectorApplicationClientDeleteResponse, error)` +- New function `*CspmMonitorGithubOffering.GetCloudOffering() *CloudOffering` +- New function `*DefenderForContainersGcpOffering.GetCloudOffering() *CloudOffering` +- New function `*AWSEnvironmentData.GetEnvironmentData() *EnvironmentData` +- New function `*ApplicationClient.CreateOrUpdate(context.Context, string, Application, *ApplicationClientCreateOrUpdateOptions) (ApplicationClientCreateOrUpdateResponse, error)` +- New function `*GovernanceRulesClient.Get(context.Context, string, *GovernanceRulesClientGetOptions) (GovernanceRulesClientGetResponse, error)` +- New function `*ConnectorGovernanceRulesClient.Delete(context.Context, string, string, string, *ConnectorGovernanceRulesClientDeleteOptions) (ConnectorGovernanceRulesClientDeleteResponse, error)` +- New function `*AlertsClient.UpdateSubscriptionLevelStateToInProgress(context.Context, string, string, *AlertsClientUpdateSubscriptionLevelStateToInProgressOptions) (AlertsClientUpdateSubscriptionLevelStateToInProgressResponse, error)` +- New function `*AwsOrganizationalData.GetAwsOrganizationalData() *AwsOrganizationalData` +- New function `PossibleGovernanceRuleTypeValues() []GovernanceRuleType` +- New function `PossibleEnvironmentTypeValues() []EnvironmentType` +- New function `*CspmMonitorAzureDevOpsOffering.GetCloudOffering() *CloudOffering` +- New function `PossibleRolesValues() []Roles` +- New function `PossibleMinimalSeverityValues() []MinimalSeverity` +- New function `*GcpOrganizationalDataOrganization.GetGcpOrganizationalData() *GcpOrganizationalData` +- New function `*DefenderFoDatabasesAwsOffering.GetCloudOffering() *CloudOffering` +- New function `*GovernanceAssignmentsClient.NewListPager(string, string, *GovernanceAssignmentsClientListOptions) *runtime.Pager[GovernanceAssignmentsClientListResponse]` +- New function `*ConnectorGovernanceRulesClient.Get(context.Context, string, string, string, *ConnectorGovernanceRulesClientGetOptions) (ConnectorGovernanceRulesClientGetResponse, error)` +- New function `NewConnectorGovernanceRuleClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ConnectorGovernanceRuleClient, error)` +- New function `*ApplicationClient.Delete(context.Context, string, *ApplicationClientDeleteOptions) (ApplicationClientDeleteResponse, error)` +- New function `NewGovernanceRulesClient(string, azcore.TokenCredential, *arm.ClientOptions) (*GovernanceRulesClient, error)` +- New function `*DefenderForServersGcpOffering.GetCloudOffering() *CloudOffering` +- New function `*GcpOrganizationalDataMember.GetGcpOrganizationalData() *GcpOrganizationalData` +- New function `*ConnectorGovernanceRuleClient.NewListPager(string, string, *ConnectorGovernanceRuleClientListOptions) *runtime.Pager[ConnectorGovernanceRuleClientListResponse]` +- New function `*AlertsClient.BeginSimulate(context.Context, string, AlertSimulatorRequestBody, *AlertsClientBeginSimulateOptions) (*runtime.Poller[AlertsClientSimulateResponse], error)` +- New function `PossibleApplicationSourceResourceTypeValues() []ApplicationSourceResourceType` +- New function `NewApplicationsClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ApplicationsClient, error)` +- New function `*GithubScopeEnvironmentData.GetEnvironmentData() *EnvironmentData` +- New function `*GovernanceRuleClient.NewListPager(*GovernanceRuleClientListOptions) *runtime.Pager[GovernanceRuleClientListResponse]` +- New function `*ApplicationClient.Get(context.Context, string, *ApplicationClientGetOptions) (ApplicationClientGetResponse, error)` +- New function `NewConnectorApplicationClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ConnectorApplicationClient, error)` +- New function `*GovernanceAssignmentsClient.Delete(context.Context, string, string, string, *GovernanceAssignmentsClientDeleteOptions) (GovernanceAssignmentsClientDeleteResponse, error)` +- New function `NewConnectorGovernanceRulesExecuteStatusClient(string, azcore.TokenCredential, *arm.ClientOptions) (*ConnectorGovernanceRulesExecuteStatusClient, error)` +- New function `NewSubscriptionGovernanceRulesExecuteStatusClient(string, azcore.TokenCredential, *arm.ClientOptions) (*SubscriptionGovernanceRulesExecuteStatusClient, error)` +- New struct `AWSEnvironmentData` +- New struct `AlertPropertiesSupportingEvidence` +- New struct `AlertsClientBeginSimulateOptions` +- New struct `AlertsClientUpdateResourceGroupLevelStateToInProgressOptions` +- New struct `AlertsClientUpdateResourceGroupLevelStateToInProgressResponse` +- New struct `AlertsClientUpdateSubscriptionLevelStateToInProgressOptions` +- New struct `AlertsClientUpdateSubscriptionLevelStateToInProgressResponse` +- New struct `Application` +- New struct `ApplicationClient` +- New struct `ApplicationClientCreateOrUpdateOptions` +- New struct `ApplicationClientCreateOrUpdateResponse` +- New struct `ApplicationClientDeleteOptions` +- New struct `ApplicationClientDeleteResponse` +- New struct `ApplicationClientGetOptions` +- New struct `ApplicationClientGetResponse` +- New struct `ApplicationCondition` +- New struct `ApplicationProperties` +- New struct `ApplicationsClient` +- New struct `ApplicationsClientListOptions` +- New struct `ApplicationsClientListResponse` +- New struct `ApplicationsList` +- New struct `AwsOrganizationalData` +- New struct `AwsOrganizationalDataMaster` +- New struct `AwsOrganizationalDataMember` +- New struct `AzureDevOpsScopeEnvironmentData` +- New struct `Condition` +- New struct `ConnectorApplicationClient` +- New struct `ConnectorApplicationClientCreateOrUpdateOptions` +- New struct `ConnectorApplicationClientCreateOrUpdateResponse` +- New struct `ConnectorApplicationClientDeleteOptions` +- New struct `ConnectorApplicationClientDeleteResponse` +- New struct `ConnectorApplicationClientGetOptions` +- New struct `ConnectorApplicationClientGetResponse` +- New struct `ConnectorApplicationsClient` +- New struct `ConnectorApplicationsClientListOptions` +- New struct `ConnectorApplicationsClientListResponse` +- New struct `ConnectorGovernanceRuleClient` +- New struct `ConnectorGovernanceRuleClientListOptions` +- New struct `ConnectorGovernanceRuleClientListResponse` +- New struct `ConnectorGovernanceRulesClient` +- New struct `ConnectorGovernanceRulesClientCreateOrUpdateOptions` +- New struct `ConnectorGovernanceRulesClientCreateOrUpdateResponse` +- New struct `ConnectorGovernanceRulesClientDeleteOptions` +- New struct `ConnectorGovernanceRulesClientDeleteResponse` +- New struct `ConnectorGovernanceRulesClientGetOptions` +- New struct `ConnectorGovernanceRulesClientGetResponse` +- New struct `ConnectorGovernanceRulesExecuteStatusClient` +- New struct `ConnectorGovernanceRulesExecuteStatusClientBeginGetOptions` +- New struct `ConnectorGovernanceRulesExecuteStatusClientGetResponse` +- New struct `ContactPropertiesAlertNotifications` +- New struct `ContactPropertiesNotificationsByRole` +- New struct `CspmMonitorAzureDevOpsOffering` +- New struct `CspmMonitorGcpOffering` +- New struct `CspmMonitorGcpOfferingNativeCloudConnection` +- New struct `CspmMonitorGithubOffering` +- New struct `DefenderFoDatabasesAwsOffering` +- New struct `DefenderFoDatabasesAwsOfferingArcAutoProvisioning` +- New struct `DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata` +- New struct `DefenderForContainersAwsOfferingContainerVulnerabilityAssessment` +- New struct `DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask` +- New struct `DefenderForContainersGcpOffering` +- New struct `DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection` +- New struct `DefenderForContainersGcpOfferingNativeCloudConnection` +- New struct `DefenderForDatabasesGcpOffering` +- New struct `DefenderForDatabasesGcpOfferingArcAutoProvisioning` +- New struct `DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration` +- New struct `DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning` +- New struct `DefenderForServersAwsOfferingMdeAutoProvisioning` +- New struct `DefenderForServersAwsOfferingSubPlan` +- New struct `DefenderForServersAwsOfferingVMScanners` +- New struct `DefenderForServersAwsOfferingVMScannersConfiguration` +- New struct `DefenderForServersAwsOfferingVaAutoProvisioning` +- New struct `DefenderForServersAwsOfferingVaAutoProvisioningConfiguration` +- New struct `DefenderForServersGcpOffering` +- New struct `DefenderForServersGcpOfferingArcAutoProvisioning` +- New struct `DefenderForServersGcpOfferingArcAutoProvisioningConfiguration` +- New struct `DefenderForServersGcpOfferingDefenderForServers` +- New struct `DefenderForServersGcpOfferingMdeAutoProvisioning` +- New struct `DefenderForServersGcpOfferingSubPlan` +- New struct `DefenderForServersGcpOfferingVaAutoProvisioning` +- New struct `DefenderForServersGcpOfferingVaAutoProvisioningConfiguration` +- New struct `EnvironmentData` +- New struct `ExecuteGovernanceRuleParams` +- New struct `ExecuteRuleStatus` +- New struct `GcpOrganizationalData` +- New struct `GcpOrganizationalDataMember` +- New struct `GcpOrganizationalDataOrganization` +- New struct `GcpProjectDetails` +- New struct `GcpProjectEnvironmentData` +- New struct `GithubScopeEnvironmentData` +- New struct `GovernanceAssignment` +- New struct `GovernanceAssignmentAdditionalData` +- New struct `GovernanceAssignmentProperties` +- New struct `GovernanceAssignmentsClient` +- New struct `GovernanceAssignmentsClientCreateOrUpdateOptions` +- New struct `GovernanceAssignmentsClientCreateOrUpdateResponse` +- New struct `GovernanceAssignmentsClientDeleteOptions` +- New struct `GovernanceAssignmentsClientDeleteResponse` +- New struct `GovernanceAssignmentsClientGetOptions` +- New struct `GovernanceAssignmentsClientGetResponse` +- New struct `GovernanceAssignmentsClientListOptions` +- New struct `GovernanceAssignmentsClientListResponse` +- New struct `GovernanceAssignmentsList` +- New struct `GovernanceEmailNotification` +- New struct `GovernanceRule` +- New struct `GovernanceRuleClient` +- New struct `GovernanceRuleClientListOptions` +- New struct `GovernanceRuleClientListResponse` +- New struct `GovernanceRuleEmailNotification` +- New struct `GovernanceRuleList` +- New struct `GovernanceRuleOwnerSource` +- New struct `GovernanceRuleProperties` +- New struct `GovernanceRulesClient` +- New struct `GovernanceRulesClientBeginRuleIDExecuteSingleSecurityConnectorOptions` +- New struct `GovernanceRulesClientBeginRuleIDExecuteSingleSubscriptionOptions` +- New struct `GovernanceRulesClientCreateOrUpdateOptions` +- New struct `GovernanceRulesClientCreateOrUpdateResponse` +- New struct `GovernanceRulesClientDeleteOptions` +- New struct `GovernanceRulesClientDeleteResponse` +- New struct `GovernanceRulesClientGetOptions` +- New struct `GovernanceRulesClientGetResponse` +- New struct `GovernanceRulesClientRuleIDExecuteSingleSecurityConnectorResponse` +- New struct `GovernanceRulesClientRuleIDExecuteSingleSubscriptionResponse` +- New struct `RemediationEta` +- New struct `SubscriptionGovernanceRulesExecuteStatusClient` +- New struct `SubscriptionGovernanceRulesExecuteStatusClientBeginGetOptions` +- New struct `SubscriptionGovernanceRulesExecuteStatusClientGetResponse` +- New field `SubPlan` in struct `DefenderForServersAwsOffering` +- New field `VMScanners` in struct `DefenderForServersAwsOffering` +- New field `VaAutoProvisioning` in struct `DefenderForServersAwsOffering` +- New field `MdeAutoProvisioning` in struct `DefenderForServersAwsOffering` +- New field `KubeAuditRetentionTime` in struct `DefenderForContainersAwsOffering` +- New field `ScubaExternalID` in struct `DefenderForContainersAwsOffering` +- New field `ContainerVulnerabilityAssessment` in struct `DefenderForContainersAwsOffering` +- New field `AutoProvisioning` in struct `DefenderForContainersAwsOffering` +- New field `ContainerVulnerabilityAssessmentTask` in struct `DefenderForContainersAwsOffering` +- New field `EnableContainerVulnerabilityAssessment` in struct `DefenderForContainersAwsOffering` +- New field `ReplacedBy` in struct `PricingProperties` +- New field `Deprecated` in struct `PricingProperties` +- New field `Version` in struct `AlertProperties` +- New field `Techniques` in struct `AlertProperties` +- New field `SupportingEvidence` in struct `AlertProperties` +- New field `SubTechniques` in struct `AlertProperties` +- New field `EnvironmentName` in struct `ConnectorProperties` +- New field `HierarchyIdentifierTrialEndDate` in struct `ConnectorProperties` +- New field `EnvironmentData` in struct `ConnectorProperties` +- New field `CloudRoleArn` in struct `DefenderForServersAwsOfferingArcAutoProvisioning` +- New field `Emails` in struct `ContactProperties` +- New field `NotificationsByRole` in struct `ContactProperties` + + ## 0.7.0 (2022-05-17) The package of `github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity` is using our [next generation design principles](https://azure.github.io/azure-sdk/general_introduction.html) since version 0.7.0, which contains breaking changes. diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_accountconnectors_client.go b/sdk/resourcemanager/security/armsecurity/accountconnectors_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_accountconnectors_client.go rename to sdk/resourcemanager/security/armsecurity/accountconnectors_client.go index 988e54682784..81cab85c1e61 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_accountconnectors_client.go +++ b/sdk/resourcemanager/security/armsecurity/accountconnectors_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -204,7 +205,6 @@ func (client *AccountConnectorsClient) getHandleResponse(resp *http.Response) (A } // NewListPager - Cloud accounts connectors of a subscription -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01-preview // options - AccountConnectorsClientListOptions contains the optional parameters for the AccountConnectorsClient.List method. func (client *AccountConnectorsClient) NewListPager(options *AccountConnectorsClientListOptions) *runtime.Pager[AccountConnectorsClientListResponse] { diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_adaptiveapplicationcontrols_client.go b/sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_adaptiveapplicationcontrols_client.go rename to sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client.go index be23f857d6e0..e52701429fd3 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_adaptiveapplicationcontrols_client.go +++ b/sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client.go @@ -5,6 +5,7 @@ // 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 armsecurity diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_adaptivenetworkhardenings_client.go b/sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_adaptivenetworkhardenings_client.go rename to sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client.go index 37f0ec99691a..93a654b5efdd 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_adaptivenetworkhardenings_client.go +++ b/sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -206,7 +207,6 @@ func (client *AdaptiveNetworkHardeningsClient) getHandleResponse(resp *http.Resp } // NewListByExtendedResourcePager - Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // resourceNamespace - The Namespace of the resource. diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_advancedthreatprotection_client.go b/sdk/resourcemanager/security/armsecurity/advancedthreatprotection_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_advancedthreatprotection_client.go rename to sdk/resourcemanager/security/armsecurity/advancedthreatprotection_client.go index 3f4cf935768c..6af769e44f1b 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_advancedthreatprotection_client.go +++ b/sdk/resourcemanager/security/armsecurity/advancedthreatprotection_client.go @@ -5,6 +5,7 @@ // 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 armsecurity diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_alerts_client.go b/sdk/resourcemanager/security/armsecurity/alerts_client.go similarity index 80% rename from sdk/resourcemanager/security/armsecurity/zz_generated_alerts_client.go rename to sdk/resourcemanager/security/armsecurity/alerts_client.go index ad6dd13f3b37..47c1652825ce 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_alerts_client.go +++ b/sdk/resourcemanager/security/armsecurity/alerts_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -56,14 +57,14 @@ func NewAlertsClient(subscriptionID string, credential azcore.TokenCredential, o // GetResourceGroupLevel - Get an alert that is associated a resource group or a resource in a resource group // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01 +// Generated from API version 2022-01-01 +// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // alertName - Name of the alert object -// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // options - AlertsClientGetResourceGroupLevelOptions contains the optional parameters for the AlertsClient.GetResourceGroupLevel // method. -func (client *AlertsClient) GetResourceGroupLevel(ctx context.Context, ascLocation string, alertName string, resourceGroupName string, options *AlertsClientGetResourceGroupLevelOptions) (AlertsClientGetResourceGroupLevelResponse, error) { - req, err := client.getResourceGroupLevelCreateRequest(ctx, ascLocation, alertName, resourceGroupName, options) +func (client *AlertsClient) GetResourceGroupLevel(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientGetResourceGroupLevelOptions) (AlertsClientGetResourceGroupLevelResponse, error) { + req, err := client.getResourceGroupLevelCreateRequest(ctx, resourceGroupName, ascLocation, alertName, options) if err != nil { return AlertsClientGetResourceGroupLevelResponse{}, err } @@ -78,12 +79,16 @@ func (client *AlertsClient) GetResourceGroupLevel(ctx context.Context, ascLocati } // getResourceGroupLevelCreateRequest creates the GetResourceGroupLevel request. -func (client *AlertsClient) getResourceGroupLevelCreateRequest(ctx context.Context, ascLocation string, alertName string, resourceGroupName string, options *AlertsClientGetResourceGroupLevelOptions) (*policy.Request, error) { +func (client *AlertsClient) getResourceGroupLevelCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientGetResourceGroupLevelOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" 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 ascLocation == "" { return nil, errors.New("parameter ascLocation cannot be empty") } @@ -92,16 +97,12 @@ func (client *AlertsClient) getResourceGroupLevelCreateRequest(ctx context.Conte return nil, errors.New("parameter alertName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01") + reqQP.Set("api-version", "2022-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -118,7 +119,7 @@ func (client *AlertsClient) getResourceGroupLevelHandleResponse(resp *http.Respo // GetSubscriptionLevel - Get an alert that is associated with a subscription // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01 +// Generated from API version 2022-01-01 // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // alertName - Name of the alert object // options - AlertsClientGetSubscriptionLevelOptions contains the optional parameters for the AlertsClient.GetSubscriptionLevel @@ -158,7 +159,7 @@ func (client *AlertsClient) getSubscriptionLevelCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01") + reqQP.Set("api-version", "2022-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -174,8 +175,7 @@ func (client *AlertsClient) getSubscriptionLevelHandleResponse(resp *http.Respon } // NewListPager - List all the alerts that are associated with the subscription -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01 +// Generated from API version 2022-01-01 // options - AlertsClientListOptions contains the optional parameters for the AlertsClient.List method. func (client *AlertsClient) NewListPager(options *AlertsClientListOptions) *runtime.Pager[AlertsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[AlertsClientListResponse]{ @@ -217,7 +217,7 @@ func (client *AlertsClient) listCreateRequest(ctx context.Context, options *Aler return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01") + reqQP.Set("api-version", "2022-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -233,8 +233,7 @@ func (client *AlertsClient) listHandleResponse(resp *http.Response) (AlertsClien } // NewListByResourceGroupPager - List all the alerts that are associated with the resource group -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01 +// Generated from API version 2022-01-01 // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // options - AlertsClientListByResourceGroupOptions contains the optional parameters for the AlertsClient.ListByResourceGroup // method. @@ -282,7 +281,7 @@ func (client *AlertsClient) listByResourceGroupCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01") + reqQP.Set("api-version", "2022-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -299,8 +298,7 @@ func (client *AlertsClient) listByResourceGroupHandleResponse(resp *http.Respons // NewListResourceGroupLevelByRegionPager - List all the alerts that are associated with the resource group that are stored // in a specific location -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01 +// Generated from API version 2022-01-01 // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // options - AlertsClientListResourceGroupLevelByRegionOptions contains the optional parameters for the AlertsClient.ListResourceGroupLevelByRegion @@ -353,7 +351,7 @@ func (client *AlertsClient) listResourceGroupLevelByRegionCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01") + reqQP.Set("api-version", "2022-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -370,8 +368,7 @@ func (client *AlertsClient) listResourceGroupLevelByRegionHandleResponse(resp *h // NewListSubscriptionLevelByRegionPager - List all the alerts that are associated with the subscription that are stored in // a specific location -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01 +// Generated from API version 2022-01-01 // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // options - AlertsClientListSubscriptionLevelByRegionOptions contains the optional parameters for the AlertsClient.ListSubscriptionLevelByRegion // method. @@ -419,7 +416,7 @@ func (client *AlertsClient) listSubscriptionLevelByRegionCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01") + reqQP.Set("api-version", "2022-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -434,29 +431,46 @@ func (client *AlertsClient) listSubscriptionLevelByRegionHandleResponse(resp *ht return result, nil } -// Simulate - Simulate security alerts +// BeginSimulate - Simulate security alerts // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01 +// Generated from API version 2022-01-01 // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // alertSimulatorRequestBody - Alert Simulator Request Properties -// options - AlertsClientSimulateOptions contains the optional parameters for the AlertsClient.Simulate method. -func (client *AlertsClient) Simulate(ctx context.Context, ascLocation string, alertSimulatorRequestBody AlertSimulatorRequestBody, options *AlertsClientSimulateOptions) (AlertsClientSimulateResponse, error) { +// options - AlertsClientBeginSimulateOptions contains the optional parameters for the AlertsClient.BeginSimulate method. +func (client *AlertsClient) BeginSimulate(ctx context.Context, ascLocation string, alertSimulatorRequestBody AlertSimulatorRequestBody, options *AlertsClientBeginSimulateOptions) (*runtime.Poller[AlertsClientSimulateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.simulate(ctx, ascLocation, alertSimulatorRequestBody, options) + if err != nil { + return nil, err + } + return runtime.NewPoller(resp, client.pl, &runtime.NewPollerOptions[AlertsClientSimulateResponse]{ + FinalStateVia: runtime.FinalStateViaOriginalURI, + }) + } else { + return runtime.NewPollerFromResumeToken[AlertsClientSimulateResponse](options.ResumeToken, client.pl, nil) + } +} + +// Simulate - Simulate security alerts +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01 +func (client *AlertsClient) simulate(ctx context.Context, ascLocation string, alertSimulatorRequestBody AlertSimulatorRequestBody, options *AlertsClientBeginSimulateOptions) (*http.Response, error) { req, err := client.simulateCreateRequest(ctx, ascLocation, alertSimulatorRequestBody, options) if err != nil { - return AlertsClientSimulateResponse{}, err + return nil, err } resp, err := client.pl.Do(req) if err != nil { - return AlertsClientSimulateResponse{}, err + return nil, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent) { - return AlertsClientSimulateResponse{}, runtime.NewResponseError(resp) + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) } - return AlertsClientSimulateResponse{}, nil + return resp, nil } // simulateCreateRequest creates the Simulate request. -func (client *AlertsClient) simulateCreateRequest(ctx context.Context, ascLocation string, alertSimulatorRequestBody AlertSimulatorRequestBody, options *AlertsClientSimulateOptions) (*policy.Request, error) { +func (client *AlertsClient) simulateCreateRequest(ctx context.Context, ascLocation string, alertSimulatorRequestBody AlertSimulatorRequestBody, options *AlertsClientBeginSimulateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/default/simulate" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -471,7 +485,7 @@ func (client *AlertsClient) simulateCreateRequest(ctx context.Context, ascLocati return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01") + reqQP.Set("api-version", "2022-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, alertSimulatorRequestBody) @@ -479,14 +493,14 @@ func (client *AlertsClient) simulateCreateRequest(ctx context.Context, ascLocati // UpdateResourceGroupLevelStateToActivate - Update the alert's state // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01 +// Generated from API version 2022-01-01 +// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // alertName - Name of the alert object -// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // options - AlertsClientUpdateResourceGroupLevelStateToActivateOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToActivate // method. -func (client *AlertsClient) UpdateResourceGroupLevelStateToActivate(ctx context.Context, ascLocation string, alertName string, resourceGroupName string, options *AlertsClientUpdateResourceGroupLevelStateToActivateOptions) (AlertsClientUpdateResourceGroupLevelStateToActivateResponse, error) { - req, err := client.updateResourceGroupLevelStateToActivateCreateRequest(ctx, ascLocation, alertName, resourceGroupName, options) +func (client *AlertsClient) UpdateResourceGroupLevelStateToActivate(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToActivateOptions) (AlertsClientUpdateResourceGroupLevelStateToActivateResponse, error) { + req, err := client.updateResourceGroupLevelStateToActivateCreateRequest(ctx, resourceGroupName, ascLocation, alertName, options) if err != nil { return AlertsClientUpdateResourceGroupLevelStateToActivateResponse{}, err } @@ -501,12 +515,16 @@ func (client *AlertsClient) UpdateResourceGroupLevelStateToActivate(ctx context. } // updateResourceGroupLevelStateToActivateCreateRequest creates the UpdateResourceGroupLevelStateToActivate request. -func (client *AlertsClient) updateResourceGroupLevelStateToActivateCreateRequest(ctx context.Context, ascLocation string, alertName string, resourceGroupName string, options *AlertsClientUpdateResourceGroupLevelStateToActivateOptions) (*policy.Request, error) { +func (client *AlertsClient) updateResourceGroupLevelStateToActivateCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToActivateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" 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 ascLocation == "" { return nil, errors.New("parameter ascLocation cannot be empty") } @@ -515,16 +533,12 @@ func (client *AlertsClient) updateResourceGroupLevelStateToActivateCreateRequest return nil, errors.New("parameter alertName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01") + reqQP.Set("api-version", "2022-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -532,14 +546,14 @@ func (client *AlertsClient) updateResourceGroupLevelStateToActivateCreateRequest // UpdateResourceGroupLevelStateToDismiss - Update the alert's state // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01 +// Generated from API version 2022-01-01 +// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // alertName - Name of the alert object -// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // options - AlertsClientUpdateResourceGroupLevelStateToDismissOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToDismiss // method. -func (client *AlertsClient) UpdateResourceGroupLevelStateToDismiss(ctx context.Context, ascLocation string, alertName string, resourceGroupName string, options *AlertsClientUpdateResourceGroupLevelStateToDismissOptions) (AlertsClientUpdateResourceGroupLevelStateToDismissResponse, error) { - req, err := client.updateResourceGroupLevelStateToDismissCreateRequest(ctx, ascLocation, alertName, resourceGroupName, options) +func (client *AlertsClient) UpdateResourceGroupLevelStateToDismiss(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToDismissOptions) (AlertsClientUpdateResourceGroupLevelStateToDismissResponse, error) { + req, err := client.updateResourceGroupLevelStateToDismissCreateRequest(ctx, resourceGroupName, ascLocation, alertName, options) if err != nil { return AlertsClientUpdateResourceGroupLevelStateToDismissResponse{}, err } @@ -554,12 +568,16 @@ func (client *AlertsClient) UpdateResourceGroupLevelStateToDismiss(ctx context.C } // updateResourceGroupLevelStateToDismissCreateRequest creates the UpdateResourceGroupLevelStateToDismiss request. -func (client *AlertsClient) updateResourceGroupLevelStateToDismissCreateRequest(ctx context.Context, ascLocation string, alertName string, resourceGroupName string, options *AlertsClientUpdateResourceGroupLevelStateToDismissOptions) (*policy.Request, error) { +func (client *AlertsClient) updateResourceGroupLevelStateToDismissCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToDismissOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" 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 ascLocation == "" { return nil, errors.New("parameter ascLocation cannot be empty") } @@ -568,16 +586,65 @@ func (client *AlertsClient) updateResourceGroupLevelStateToDismissCreateRequest( return nil, errors.New("parameter alertName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// UpdateResourceGroupLevelStateToInProgress - Update the alert's state +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01 +// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations +// alertName - Name of the alert object +// options - AlertsClientUpdateResourceGroupLevelStateToInProgressOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToInProgress +// method. +func (client *AlertsClient) UpdateResourceGroupLevelStateToInProgress(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToInProgressOptions) (AlertsClientUpdateResourceGroupLevelStateToInProgressResponse, error) { + req, err := client.updateResourceGroupLevelStateToInProgressCreateRequest(ctx, resourceGroupName, ascLocation, alertName, options) + if err != nil { + return AlertsClientUpdateResourceGroupLevelStateToInProgressResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AlertsClientUpdateResourceGroupLevelStateToInProgressResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AlertsClientUpdateResourceGroupLevelStateToInProgressResponse{}, runtime.NewResponseError(resp) + } + return AlertsClientUpdateResourceGroupLevelStateToInProgressResponse{}, nil +} + +// updateResourceGroupLevelStateToInProgressCreateRequest creates the UpdateResourceGroupLevelStateToInProgress request. +func (client *AlertsClient) updateResourceGroupLevelStateToInProgressCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToInProgressOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress" + 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 ascLocation == "" { + return nil, errors.New("parameter ascLocation cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) + if alertName == "" { + return nil, errors.New("parameter alertName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01") + reqQP.Set("api-version", "2022-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -585,14 +652,14 @@ func (client *AlertsClient) updateResourceGroupLevelStateToDismissCreateRequest( // UpdateResourceGroupLevelStateToResolve - Update the alert's state // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01 +// Generated from API version 2022-01-01 +// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // alertName - Name of the alert object -// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // options - AlertsClientUpdateResourceGroupLevelStateToResolveOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToResolve // method. -func (client *AlertsClient) UpdateResourceGroupLevelStateToResolve(ctx context.Context, ascLocation string, alertName string, resourceGroupName string, options *AlertsClientUpdateResourceGroupLevelStateToResolveOptions) (AlertsClientUpdateResourceGroupLevelStateToResolveResponse, error) { - req, err := client.updateResourceGroupLevelStateToResolveCreateRequest(ctx, ascLocation, alertName, resourceGroupName, options) +func (client *AlertsClient) UpdateResourceGroupLevelStateToResolve(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToResolveOptions) (AlertsClientUpdateResourceGroupLevelStateToResolveResponse, error) { + req, err := client.updateResourceGroupLevelStateToResolveCreateRequest(ctx, resourceGroupName, ascLocation, alertName, options) if err != nil { return AlertsClientUpdateResourceGroupLevelStateToResolveResponse{}, err } @@ -607,12 +674,16 @@ func (client *AlertsClient) UpdateResourceGroupLevelStateToResolve(ctx context.C } // updateResourceGroupLevelStateToResolveCreateRequest creates the UpdateResourceGroupLevelStateToResolve request. -func (client *AlertsClient) updateResourceGroupLevelStateToResolveCreateRequest(ctx context.Context, ascLocation string, alertName string, resourceGroupName string, options *AlertsClientUpdateResourceGroupLevelStateToResolveOptions) (*policy.Request, error) { +func (client *AlertsClient) updateResourceGroupLevelStateToResolveCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToResolveOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" 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 ascLocation == "" { return nil, errors.New("parameter ascLocation cannot be empty") } @@ -621,16 +692,12 @@ func (client *AlertsClient) updateResourceGroupLevelStateToResolveCreateRequest( return nil, errors.New("parameter alertName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01") + reqQP.Set("api-version", "2022-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -638,7 +705,7 @@ func (client *AlertsClient) updateResourceGroupLevelStateToResolveCreateRequest( // UpdateSubscriptionLevelStateToActivate - Update the alert's state // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01 +// Generated from API version 2022-01-01 // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // alertName - Name of the alert object // options - AlertsClientUpdateSubscriptionLevelStateToActivateOptions contains the optional parameters for the AlertsClient.UpdateSubscriptionLevelStateToActivate @@ -678,7 +745,7 @@ func (client *AlertsClient) updateSubscriptionLevelStateToActivateCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01") + reqQP.Set("api-version", "2022-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -686,7 +753,7 @@ func (client *AlertsClient) updateSubscriptionLevelStateToActivateCreateRequest( // UpdateSubscriptionLevelStateToDismiss - Update the alert's state // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01 +// Generated from API version 2022-01-01 // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // alertName - Name of the alert object // options - AlertsClientUpdateSubscriptionLevelStateToDismissOptions contains the optional parameters for the AlertsClient.UpdateSubscriptionLevelStateToDismiss @@ -726,7 +793,55 @@ func (client *AlertsClient) updateSubscriptionLevelStateToDismissCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01") + reqQP.Set("api-version", "2022-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// UpdateSubscriptionLevelStateToInProgress - Update the alert's state +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01 +// ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations +// alertName - Name of the alert object +// options - AlertsClientUpdateSubscriptionLevelStateToInProgressOptions contains the optional parameters for the AlertsClient.UpdateSubscriptionLevelStateToInProgress +// method. +func (client *AlertsClient) UpdateSubscriptionLevelStateToInProgress(ctx context.Context, ascLocation string, alertName string, options *AlertsClientUpdateSubscriptionLevelStateToInProgressOptions) (AlertsClientUpdateSubscriptionLevelStateToInProgressResponse, error) { + req, err := client.updateSubscriptionLevelStateToInProgressCreateRequest(ctx, ascLocation, alertName, options) + if err != nil { + return AlertsClientUpdateSubscriptionLevelStateToInProgressResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return AlertsClientUpdateSubscriptionLevelStateToInProgressResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusNoContent) { + return AlertsClientUpdateSubscriptionLevelStateToInProgressResponse{}, runtime.NewResponseError(resp) + } + return AlertsClientUpdateSubscriptionLevelStateToInProgressResponse{}, nil +} + +// updateSubscriptionLevelStateToInProgressCreateRequest creates the UpdateSubscriptionLevelStateToInProgress request. +func (client *AlertsClient) updateSubscriptionLevelStateToInProgressCreateRequest(ctx context.Context, ascLocation string, alertName string, options *AlertsClientUpdateSubscriptionLevelStateToInProgressOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/inProgress" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if ascLocation == "" { + return nil, errors.New("parameter ascLocation cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ascLocation}", url.PathEscape(ascLocation)) + if alertName == "" { + return nil, errors.New("parameter alertName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{alertName}", url.PathEscape(alertName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -734,7 +849,7 @@ func (client *AlertsClient) updateSubscriptionLevelStateToDismissCreateRequest(c // UpdateSubscriptionLevelStateToResolve - Update the alert's state // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-11-01 +// Generated from API version 2022-01-01 // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // alertName - Name of the alert object // options - AlertsClientUpdateSubscriptionLevelStateToResolveOptions contains the optional parameters for the AlertsClient.UpdateSubscriptionLevelStateToResolve @@ -774,7 +889,7 @@ func (client *AlertsClient) updateSubscriptionLevelStateToResolveCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-11-01") + reqQP.Set("api-version", "2022-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_alertssuppressionrules_client.go b/sdk/resourcemanager/security/armsecurity/alertssuppressionrules_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_alertssuppressionrules_client.go rename to sdk/resourcemanager/security/armsecurity/alertssuppressionrules_client.go index 220f5e6a9676..0752c68e821d 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_alertssuppressionrules_client.go +++ b/sdk/resourcemanager/security/armsecurity/alertssuppressionrules_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -150,7 +151,6 @@ func (client *AlertsSuppressionRulesClient) getHandleResponse(resp *http.Respons } // NewListPager - List of all the dismiss rules for the given subscription -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-01-01-preview // options - AlertsSuppressionRulesClientListOptions contains the optional parameters for the AlertsSuppressionRulesClient.List // method. diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_allowedconnections_client.go b/sdk/resourcemanager/security/armsecurity/allowedconnections_client.go similarity index 98% rename from sdk/resourcemanager/security/armsecurity/zz_generated_allowedconnections_client.go rename to sdk/resourcemanager/security/armsecurity/allowedconnections_client.go index 38868b209c95..3d1d2ed42cde 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_allowedconnections_client.go +++ b/sdk/resourcemanager/security/armsecurity/allowedconnections_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -116,7 +117,6 @@ func (client *AllowedConnectionsClient) getHandleResponse(resp *http.Response) ( } // NewListPager - Gets the list of all possible traffic between resources for the subscription -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // options - AllowedConnectionsClientListOptions contains the optional parameters for the AllowedConnectionsClient.List method. func (client *AllowedConnectionsClient) NewListPager(options *AllowedConnectionsClientListOptions) *runtime.Pager[AllowedConnectionsClientListResponse] { @@ -175,7 +175,6 @@ func (client *AllowedConnectionsClient) listHandleResponse(resp *http.Response) } // NewListByHomeRegionPager - Gets the list of all possible traffic between resources for the subscription and location. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // options - AllowedConnectionsClientListByHomeRegionOptions contains the optional parameters for the AllowedConnectionsClient.ListByHomeRegion diff --git a/sdk/resourcemanager/security/armsecurity/application_client.go b/sdk/resourcemanager/security/armsecurity/application_client.go new file mode 100644 index 000000000000..796f510b90ca --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/application_client.go @@ -0,0 +1,201 @@ +//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 armsecurity + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ApplicationClient contains the methods for the Application group. +// Don't use this type directly, use NewApplicationClient() instead. +type ApplicationClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewApplicationClient creates a new instance of ApplicationClient with the specified values. +// subscriptionID - Azure subscription ID +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewApplicationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplicationClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ApplicationClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or update a security application on the given subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// applicationID - The security Application key - unique key for the standard application +// application - Application over a subscription scope +// options - ApplicationClientCreateOrUpdateOptions contains the optional parameters for the ApplicationClient.CreateOrUpdate +// method. +func (client *ApplicationClient) CreateOrUpdate(ctx context.Context, applicationID string, application Application, options *ApplicationClientCreateOrUpdateOptions) (ApplicationClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, applicationID, application, options) + if err != nil { + return ApplicationClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ApplicationClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ApplicationClient) createOrUpdateCreateRequest(ctx context.Context, applicationID string, application Application, options *ApplicationClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if applicationID == "" { + return nil, errors.New("parameter applicationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationId}", url.PathEscape(applicationID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, application) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ApplicationClient) createOrUpdateHandleResponse(resp *http.Response) (ApplicationClientCreateOrUpdateResponse, error) { + result := ApplicationClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Application); err != nil { + return ApplicationClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete an Application over a given scope +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// applicationID - The security Application key - unique key for the standard application +// options - ApplicationClientDeleteOptions contains the optional parameters for the ApplicationClient.Delete method. +func (client *ApplicationClient) Delete(ctx context.Context, applicationID string, options *ApplicationClientDeleteOptions) (ApplicationClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, applicationID, options) + if err != nil { + return ApplicationClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ApplicationClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ApplicationClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ApplicationClient) deleteCreateRequest(ctx context.Context, applicationID string, options *ApplicationClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if applicationID == "" { + return nil, errors.New("parameter applicationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationId}", url.PathEscape(applicationID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Get a specific application for the requested scope by applicationId +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// applicationID - The security Application key - unique key for the standard application +// options - ApplicationClientGetOptions contains the optional parameters for the ApplicationClient.Get method. +func (client *ApplicationClient) Get(ctx context.Context, applicationID string, options *ApplicationClientGetOptions) (ApplicationClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, applicationID, options) + if err != nil { + return ApplicationClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ApplicationClient) getCreateRequest(ctx context.Context, applicationID string, options *ApplicationClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications/{applicationId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if applicationID == "" { + return nil, errors.New("parameter applicationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationId}", url.PathEscape(applicationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ApplicationClient) getHandleResponse(resp *http.Response) (ApplicationClientGetResponse, error) { + result := ApplicationClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Application); err != nil { + return ApplicationClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/applications_client.go b/sdk/resourcemanager/security/armsecurity/applications_client.go new file mode 100644 index 000000000000..656a08325ebb --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/applications_client.go @@ -0,0 +1,114 @@ +//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 armsecurity + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ApplicationsClient contains the methods for the Applications group. +// Don't use this type directly, use NewApplicationsClient() instead. +type ApplicationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewApplicationsClient creates a new instance of ApplicationsClient with the specified values. +// subscriptionID - Azure subscription ID +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewApplicationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplicationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ApplicationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Get a list of all relevant applications over a subscription level scope +// Generated from API version 2022-07-01-preview +// options - ApplicationsClientListOptions contains the optional parameters for the ApplicationsClient.List method. +func (client *ApplicationsClient) NewListPager(options *ApplicationsClientListOptions) *runtime.Pager[ApplicationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ApplicationsClientListResponse]{ + More: func(page ApplicationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ApplicationsClientListResponse) (ApplicationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ApplicationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ApplicationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ApplicationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ApplicationsClient) listCreateRequest(ctx context.Context, options *ApplicationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ApplicationsClient) listHandleResponse(resp *http.Response) (ApplicationsClientListResponse, error) { + result := ApplicationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationsList); err != nil { + return ApplicationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_assessments_client.go b/sdk/resourcemanager/security/armsecurity/assessments_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_assessments_client.go rename to sdk/resourcemanager/security/armsecurity/assessments_client.go index 1d17d0905a1b..76a2f6f3ccc7 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_assessments_client.go +++ b/sdk/resourcemanager/security/armsecurity/assessments_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -197,7 +198,6 @@ func (client *AssessmentsClient) getHandleResponse(resp *http.Response) (Assessm } // NewListPager - Get security assessments on all your scanned resources inside a scope -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2021-06-01 // scope - Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group // (/providers/Microsoft.Management/managementGroups/mgName). diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_assessmentsmetadata_client.go b/sdk/resourcemanager/security/armsecurity/assessmentsmetadata_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_assessmentsmetadata_client.go rename to sdk/resourcemanager/security/armsecurity/assessmentsmetadata_client.go index d0db67323992..20db186eeaf3 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_assessmentsmetadata_client.go +++ b/sdk/resourcemanager/security/armsecurity/assessmentsmetadata_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -251,7 +252,6 @@ func (client *AssessmentsMetadataClient) getInSubscriptionHandleResponse(resp *h } // NewListPager - Get metadata information on all assessment types -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2021-06-01 // options - AssessmentsMetadataClientListOptions contains the optional parameters for the AssessmentsMetadataClient.List // method. @@ -307,7 +307,6 @@ func (client *AssessmentsMetadataClient) listHandleResponse(resp *http.Response) } // NewListBySubscriptionPager - Get metadata information on all assessment types in a specific subscription -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2021-06-01 // options - AssessmentsMetadataClientListBySubscriptionOptions contains the optional parameters for the AssessmentsMetadataClient.ListBySubscription // method. diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_automations_client.go b/sdk/resourcemanager/security/armsecurity/automations_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_automations_client.go rename to sdk/resourcemanager/security/armsecurity/automations_client.go index b1cd4036a004..6db4c1c63d5d 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_automations_client.go +++ b/sdk/resourcemanager/security/armsecurity/automations_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -218,7 +219,6 @@ func (client *AutomationsClient) getHandleResponse(resp *http.Response) (Automat // NewListPager - Lists all the security automations in the specified subscription. Use the 'nextLink' property in the response // to get the next page of security automations for the specified subscription. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-01-01-preview // options - AutomationsClientListOptions contains the optional parameters for the AutomationsClient.List method. func (client *AutomationsClient) NewListPager(options *AutomationsClientListOptions) *runtime.Pager[AutomationsClientListResponse] { @@ -278,7 +278,6 @@ func (client *AutomationsClient) listHandleResponse(resp *http.Response) (Automa // NewListByResourceGroupPager - Lists all the security automations in the specified resource group. Use the 'nextLink' property // in the response to get the next page of security automations for the specified resource group. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-01-01-preview // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // options - AutomationsClientListByResourceGroupOptions contains the optional parameters for the AutomationsClient.ListByResourceGroup diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_autoprovisioningsettings_client.go b/sdk/resourcemanager/security/armsecurity/autoprovisioningsettings_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_autoprovisioningsettings_client.go rename to sdk/resourcemanager/security/armsecurity/autoprovisioningsettings_client.go index 84a21b46795c..67f530d9204f 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_autoprovisioningsettings_client.go +++ b/sdk/resourcemanager/security/armsecurity/autoprovisioningsettings_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -160,7 +161,6 @@ func (client *AutoProvisioningSettingsClient) getHandleResponse(resp *http.Respo } // NewListPager - Exposes the auto provisioning settings of the subscriptions -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2017-08-01-preview // options - AutoProvisioningSettingsClientListOptions contains the optional parameters for the AutoProvisioningSettingsClient.List // method. diff --git a/sdk/resourcemanager/security/armsecurity/autorest.md b/sdk/resourcemanager/security/armsecurity/autorest.md index 2e6a285b00f1..05eab25b5452 100644 --- a/sdk/resourcemanager/security/armsecurity/autorest.md +++ b/sdk/resourcemanager/security/armsecurity/autorest.md @@ -4,12 +4,11 @@ ``` yaml azure-arm: true -tag: package-composite-v3 require: -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/security/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7a2ac91de424f271cf91cc8009f3fe9ee8249086/specification/security/resource-manager/readme.go.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/security/resource-manager/readme.md +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/security/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.7.0 +module-version: 0.8.0 modelerfour: lenient-model-deduplication: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_complianceresults_client.go b/sdk/resourcemanager/security/armsecurity/complianceresults_client.go similarity index 98% rename from sdk/resourcemanager/security/armsecurity/zz_generated_complianceresults_client.go rename to sdk/resourcemanager/security/armsecurity/complianceresults_client.go index 931bdb2aab2a..ce13a606e7c6 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_complianceresults_client.go +++ b/sdk/resourcemanager/security/armsecurity/complianceresults_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -101,7 +102,6 @@ func (client *ComplianceResultsClient) getHandleResponse(resp *http.Response) (C } // NewListPager - Security compliance results in the subscription -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2017-08-01 // scope - Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group // (/providers/Microsoft.Management/managementGroups/mgName). diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_compliances_client.go b/sdk/resourcemanager/security/armsecurity/compliances_client.go similarity index 98% rename from sdk/resourcemanager/security/armsecurity/zz_generated_compliances_client.go rename to sdk/resourcemanager/security/armsecurity/compliances_client.go index e2667478b69b..0a4e34f3ebd8 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_compliances_client.go +++ b/sdk/resourcemanager/security/armsecurity/compliances_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -102,7 +103,6 @@ func (client *CompliancesClient) getHandleResponse(resp *http.Response) (Complia } // NewListPager - The Compliance scores of the specific management group. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2017-08-01-preview // scope - Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group // (/providers/Microsoft.Management/managementGroups/mgName). diff --git a/sdk/resourcemanager/security/armsecurity/connectorapplication_client.go b/sdk/resourcemanager/security/armsecurity/connectorapplication_client.go new file mode 100644 index 000000000000..f31036330d1d --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/connectorapplication_client.go @@ -0,0 +1,233 @@ +//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 armsecurity + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ConnectorApplicationClient contains the methods for the SecurityConnectorApplication group. +// Don't use this type directly, use NewConnectorApplicationClient() instead. +type ConnectorApplicationClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewConnectorApplicationClient creates a new instance of ConnectorApplicationClient with the specified values. +// subscriptionID - Azure subscription ID +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewConnectorApplicationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectorApplicationClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ConnectorApplicationClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or update a security Application on the given security connector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// securityConnectorName - The security connector name. +// applicationID - The security Application key - unique key for the standard application +// application - Application over a subscription scope +// options - ConnectorApplicationClientCreateOrUpdateOptions contains the optional parameters for the ConnectorApplicationClient.CreateOrUpdate +// method. +func (client *ConnectorApplicationClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, application Application, options *ConnectorApplicationClientCreateOrUpdateOptions) (ConnectorApplicationClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, securityConnectorName, applicationID, application, options) + if err != nil { + return ConnectorApplicationClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectorApplicationClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ConnectorApplicationClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ConnectorApplicationClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, application Application, options *ConnectorApplicationClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" + 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 securityConnectorName == "" { + return nil, errors.New("parameter securityConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) + if applicationID == "" { + return nil, errors.New("parameter applicationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationId}", url.PathEscape(applicationID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, application) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ConnectorApplicationClient) createOrUpdateHandleResponse(resp *http.Response) (ConnectorApplicationClientCreateOrUpdateResponse, error) { + result := ConnectorApplicationClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Application); err != nil { + return ConnectorApplicationClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete an Application over a given scope +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// securityConnectorName - The security connector name. +// applicationID - The security Application key - unique key for the standard application +// options - ConnectorApplicationClientDeleteOptions contains the optional parameters for the ConnectorApplicationClient.Delete +// method. +func (client *ConnectorApplicationClient) Delete(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, options *ConnectorApplicationClientDeleteOptions) (ConnectorApplicationClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, securityConnectorName, applicationID, options) + if err != nil { + return ConnectorApplicationClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectorApplicationClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ConnectorApplicationClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ConnectorApplicationClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ConnectorApplicationClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, options *ConnectorApplicationClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" + 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 securityConnectorName == "" { + return nil, errors.New("parameter securityConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) + if applicationID == "" { + return nil, errors.New("parameter applicationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationId}", url.PathEscape(applicationID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Get a specific application for the requested scope by applicationId +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-07-01-preview +// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// securityConnectorName - The security connector name. +// applicationID - The security Application key - unique key for the standard application +// options - ConnectorApplicationClientGetOptions contains the optional parameters for the ConnectorApplicationClient.Get +// method. +func (client *ConnectorApplicationClient) Get(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, options *ConnectorApplicationClientGetOptions) (ConnectorApplicationClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, securityConnectorName, applicationID, options) + if err != nil { + return ConnectorApplicationClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectorApplicationClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectorApplicationClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ConnectorApplicationClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, options *ConnectorApplicationClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications/{applicationId}" + 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 securityConnectorName == "" { + return nil, errors.New("parameter securityConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) + if applicationID == "" { + return nil, errors.New("parameter applicationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{applicationId}", url.PathEscape(applicationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ConnectorApplicationClient) getHandleResponse(resp *http.Response) (ConnectorApplicationClientGetResponse, error) { + result := ConnectorApplicationClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Application); err != nil { + return ConnectorApplicationClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/connectorapplications_client.go b/sdk/resourcemanager/security/armsecurity/connectorapplications_client.go new file mode 100644 index 000000000000..91eb858bd1ba --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/connectorapplications_client.go @@ -0,0 +1,125 @@ +//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 armsecurity + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ConnectorApplicationsClient contains the methods for the SecurityConnectorApplications group. +// Don't use this type directly, use NewConnectorApplicationsClient() instead. +type ConnectorApplicationsClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewConnectorApplicationsClient creates a new instance of ConnectorApplicationsClient with the specified values. +// subscriptionID - Azure subscription ID +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewConnectorApplicationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectorApplicationsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ConnectorApplicationsClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Get a list of all relevant applications over a security connector level scope +// Generated from API version 2022-07-01-preview +// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// securityConnectorName - The security connector name. +// options - ConnectorApplicationsClientListOptions contains the optional parameters for the ConnectorApplicationsClient.List +// method. +func (client *ConnectorApplicationsClient) NewListPager(resourceGroupName string, securityConnectorName string, options *ConnectorApplicationsClientListOptions) *runtime.Pager[ConnectorApplicationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ConnectorApplicationsClientListResponse]{ + More: func(page ConnectorApplicationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConnectorApplicationsClientListResponse) (ConnectorApplicationsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, securityConnectorName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConnectorApplicationsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectorApplicationsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectorApplicationsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ConnectorApplicationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *ConnectorApplicationsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/applications" + 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 securityConnectorName == "" { + return nil, errors.New("parameter securityConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ConnectorApplicationsClient) listHandleResponse(resp *http.Response) (ConnectorApplicationsClientListResponse, error) { + result := ConnectorApplicationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationsList); err != nil { + return ConnectorApplicationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/connectorgovernancerule_client.go b/sdk/resourcemanager/security/armsecurity/connectorgovernancerule_client.go new file mode 100644 index 000000000000..c0fb53be63e9 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/connectorgovernancerule_client.go @@ -0,0 +1,125 @@ +//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 armsecurity + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ConnectorGovernanceRuleClient contains the methods for the SecurityConnectorGovernanceRule group. +// Don't use this type directly, use NewConnectorGovernanceRuleClient() instead. +type ConnectorGovernanceRuleClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewConnectorGovernanceRuleClient creates a new instance of ConnectorGovernanceRuleClient with the specified values. +// subscriptionID - Azure subscription ID +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewConnectorGovernanceRuleClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectorGovernanceRuleClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ConnectorGovernanceRuleClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Get a list of all relevant governanceRules over a security connector level scope +// Generated from API version 2022-01-01-preview +// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// securityConnectorName - The security connector name. +// options - ConnectorGovernanceRuleClientListOptions contains the optional parameters for the ConnectorGovernanceRuleClient.List +// method. +func (client *ConnectorGovernanceRuleClient) NewListPager(resourceGroupName string, securityConnectorName string, options *ConnectorGovernanceRuleClientListOptions) *runtime.Pager[ConnectorGovernanceRuleClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ConnectorGovernanceRuleClientListResponse]{ + More: func(page ConnectorGovernanceRuleClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ConnectorGovernanceRuleClientListResponse) (ConnectorGovernanceRuleClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, resourceGroupName, securityConnectorName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return ConnectorGovernanceRuleClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectorGovernanceRuleClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectorGovernanceRuleClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *ConnectorGovernanceRuleClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *ConnectorGovernanceRuleClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules" + 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 securityConnectorName == "" { + return nil, errors.New("parameter securityConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ConnectorGovernanceRuleClient) listHandleResponse(resp *http.Response) (ConnectorGovernanceRuleClientListResponse, error) { + result := ConnectorGovernanceRuleClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GovernanceRuleList); err != nil { + return ConnectorGovernanceRuleClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/connectorgovernancerules_client.go b/sdk/resourcemanager/security/armsecurity/connectorgovernancerules_client.go new file mode 100644 index 000000000000..142381cac5e5 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/connectorgovernancerules_client.go @@ -0,0 +1,233 @@ +//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 armsecurity + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ConnectorGovernanceRulesClient contains the methods for the SecurityConnectorGovernanceRules group. +// Don't use this type directly, use NewConnectorGovernanceRulesClient() instead. +type ConnectorGovernanceRulesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewConnectorGovernanceRulesClient creates a new instance of ConnectorGovernanceRulesClient with the specified values. +// subscriptionID - Azure subscription ID +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewConnectorGovernanceRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectorGovernanceRulesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ConnectorGovernanceRulesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or update a security GovernanceRule on the given security connector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// securityConnectorName - The security connector name. +// ruleID - The security GovernanceRule key - unique key for the standard GovernanceRule +// governanceRule - GovernanceRule over a subscription scope +// options - ConnectorGovernanceRulesClientCreateOrUpdateOptions contains the optional parameters for the ConnectorGovernanceRulesClient.CreateOrUpdate +// method. +func (client *ConnectorGovernanceRulesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, ruleID string, governanceRule GovernanceRule, options *ConnectorGovernanceRulesClientCreateOrUpdateOptions) (ConnectorGovernanceRulesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, securityConnectorName, ruleID, governanceRule, options) + if err != nil { + return ConnectorGovernanceRulesClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectorGovernanceRulesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return ConnectorGovernanceRulesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ConnectorGovernanceRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, ruleID string, governanceRule GovernanceRule, options *ConnectorGovernanceRulesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}" + 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 securityConnectorName == "" { + return nil, errors.New("parameter securityConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) + if ruleID == "" { + return nil, errors.New("parameter ruleID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, governanceRule) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ConnectorGovernanceRulesClient) createOrUpdateHandleResponse(resp *http.Response) (ConnectorGovernanceRulesClientCreateOrUpdateResponse, error) { + result := ConnectorGovernanceRulesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GovernanceRule); err != nil { + return ConnectorGovernanceRulesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a GovernanceRule over a given scope +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// securityConnectorName - The security connector name. +// ruleID - The security GovernanceRule key - unique key for the standard GovernanceRule +// options - ConnectorGovernanceRulesClientDeleteOptions contains the optional parameters for the ConnectorGovernanceRulesClient.Delete +// method. +func (client *ConnectorGovernanceRulesClient) Delete(ctx context.Context, resourceGroupName string, securityConnectorName string, ruleID string, options *ConnectorGovernanceRulesClientDeleteOptions) (ConnectorGovernanceRulesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, securityConnectorName, ruleID, options) + if err != nil { + return ConnectorGovernanceRulesClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectorGovernanceRulesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return ConnectorGovernanceRulesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return ConnectorGovernanceRulesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ConnectorGovernanceRulesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, ruleID string, options *ConnectorGovernanceRulesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}" + 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 securityConnectorName == "" { + return nil, errors.New("parameter securityConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) + if ruleID == "" { + return nil, errors.New("parameter ruleID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Get a specific governanceRule for the requested scope by ruleId +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// securityConnectorName - The security connector name. +// ruleID - The security GovernanceRule key - unique key for the standard GovernanceRule +// options - ConnectorGovernanceRulesClientGetOptions contains the optional parameters for the ConnectorGovernanceRulesClient.Get +// method. +func (client *ConnectorGovernanceRulesClient) Get(ctx context.Context, resourceGroupName string, securityConnectorName string, ruleID string, options *ConnectorGovernanceRulesClientGetOptions) (ConnectorGovernanceRulesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, securityConnectorName, ruleID, options) + if err != nil { + return ConnectorGovernanceRulesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return ConnectorGovernanceRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return ConnectorGovernanceRulesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *ConnectorGovernanceRulesClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, ruleID string, options *ConnectorGovernanceRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}" + 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 securityConnectorName == "" { + return nil, errors.New("parameter securityConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) + if ruleID == "" { + return nil, errors.New("parameter ruleID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ConnectorGovernanceRulesClient) getHandleResponse(resp *http.Response) (ConnectorGovernanceRulesClientGetResponse, error) { + result := ConnectorGovernanceRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GovernanceRule); err != nil { + return ConnectorGovernanceRulesClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/connectorgovernancerulesexecutestatus_client.go b/sdk/resourcemanager/security/armsecurity/connectorgovernancerulesexecutestatus_client.go new file mode 100644 index 000000000000..1183625ebaef --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/connectorgovernancerulesexecutestatus_client.go @@ -0,0 +1,129 @@ +//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 armsecurity + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// ConnectorGovernanceRulesExecuteStatusClient contains the methods for the SecurityConnectorGovernanceRulesExecuteStatus group. +// Don't use this type directly, use NewConnectorGovernanceRulesExecuteStatusClient() instead. +type ConnectorGovernanceRulesExecuteStatusClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewConnectorGovernanceRulesExecuteStatusClient creates a new instance of ConnectorGovernanceRulesExecuteStatusClient with the specified values. +// subscriptionID - Azure subscription ID +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewConnectorGovernanceRulesExecuteStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectorGovernanceRulesExecuteStatusClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &ConnectorGovernanceRulesExecuteStatusClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginGet - Get a specific governanceRule execution status for the requested scope by ruleId and operationId +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// securityConnectorName - The security connector name. +// ruleID - The security GovernanceRule key - unique key for the standard GovernanceRule +// operationID - The security GovernanceRule execution key - unique key for the execution of GovernanceRule +// options - ConnectorGovernanceRulesExecuteStatusClientBeginGetOptions contains the optional parameters for the ConnectorGovernanceRulesExecuteStatusClient.BeginGet +// method. +func (client *ConnectorGovernanceRulesExecuteStatusClient) BeginGet(ctx context.Context, resourceGroupName string, securityConnectorName string, ruleID string, operationID string, options *ConnectorGovernanceRulesExecuteStatusClientBeginGetOptions) (*runtime.Poller[ConnectorGovernanceRulesExecuteStatusClientGetResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.get(ctx, resourceGroupName, securityConnectorName, ruleID, operationID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[ConnectorGovernanceRulesExecuteStatusClientGetResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[ConnectorGovernanceRulesExecuteStatusClientGetResponse](options.ResumeToken, client.pl, nil) + } +} + +// Get - Get a specific governanceRule execution status for the requested scope by ruleId and operationId +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +func (client *ConnectorGovernanceRulesExecuteStatusClient) get(ctx context.Context, resourceGroupName string, securityConnectorName string, ruleID string, operationID string, options *ConnectorGovernanceRulesExecuteStatusClientBeginGetOptions) (*http.Response, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, securityConnectorName, ruleID, operationID, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getCreateRequest creates the Get request. +func (client *ConnectorGovernanceRulesExecuteStatusClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, ruleID string, operationID string, options *ConnectorGovernanceRulesExecuteStatusClientBeginGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}" + 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 securityConnectorName == "" { + return nil, errors.New("parameter securityConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) + if ruleID == "" { + return nil, errors.New("parameter ruleID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_connectors_client.go b/sdk/resourcemanager/security/armsecurity/connectors_client.go similarity index 96% rename from sdk/resourcemanager/security/armsecurity/zz_generated_connectors_client.go rename to sdk/resourcemanager/security/armsecurity/connectors_client.go index 395f1e62ea39..07ff74cabaff 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_connectors_client.go +++ b/sdk/resourcemanager/security/armsecurity/connectors_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -57,7 +58,7 @@ func NewConnectorsClient(subscriptionID string, credential azcore.TokenCredentia // CreateOrUpdate - Creates or updates a security connector. If a security connector is already created and a subsequent request // is issued for the same security connector id, then it will be updated. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-01-preview +// Generated from API version 2022-05-01-preview // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // securityConnectorName - The security connector name. // securityConnector - The security connector resource @@ -98,7 +99,7 @@ func (client *ConnectorsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2022-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, securityConnector) @@ -115,7 +116,7 @@ func (client *ConnectorsClient) createOrUpdateHandleResponse(resp *http.Response // Delete - Deletes a security connector. // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-01-preview +// Generated from API version 2022-05-01-preview // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // securityConnectorName - The security connector name. // options - ConnectorsClientDeleteOptions contains the optional parameters for the ConnectorsClient.Delete method. @@ -154,7 +155,7 @@ func (client *ConnectorsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2022-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -162,7 +163,7 @@ func (client *ConnectorsClient) deleteCreateRequest(ctx context.Context, resourc // Get - Retrieves details of a specific security connector // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-01-preview +// Generated from API version 2022-05-01-preview // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // securityConnectorName - The security connector name. // options - ConnectorsClientGetOptions contains the optional parameters for the ConnectorsClient.Get method. @@ -201,7 +202,7 @@ func (client *ConnectorsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2022-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -218,8 +219,7 @@ func (client *ConnectorsClient) getHandleResponse(resp *http.Response) (Connecto // NewListPager - Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response // to get the next page of security connectors for the specified subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-01-preview +// Generated from API version 2022-05-01-preview // options - ConnectorsClientListOptions contains the optional parameters for the ConnectorsClient.List method. func (client *ConnectorsClient) NewListPager(options *ConnectorsClientListOptions) *runtime.Pager[ConnectorsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ConnectorsClientListResponse]{ @@ -261,7 +261,7 @@ func (client *ConnectorsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2022-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -278,8 +278,7 @@ func (client *ConnectorsClient) listHandleResponse(resp *http.Response) (Connect // NewListByResourceGroupPager - Lists all the security connectors in the specified resource group. Use the 'nextLink' property // in the response to get the next page of security connectors for the specified resource group. -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-01-preview +// Generated from API version 2022-05-01-preview // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // options - ConnectorsClientListByResourceGroupOptions contains the optional parameters for the ConnectorsClient.ListByResourceGroup // method. @@ -327,7 +326,7 @@ func (client *ConnectorsClient) listByResourceGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2022-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -344,7 +343,7 @@ func (client *ConnectorsClient) listByResourceGroupHandleResponse(resp *http.Res // Update - Updates a security connector // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-01-preview +// Generated from API version 2022-05-01-preview // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // securityConnectorName - The security connector name. // securityConnector - The security connector resource @@ -384,7 +383,7 @@ func (client *ConnectorsClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2022-05-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, securityConnector) diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_constants.go b/sdk/resourcemanager/security/armsecurity/constants.go similarity index 89% rename from sdk/resourcemanager/security/armsecurity/zz_generated_constants.go rename to sdk/resourcemanager/security/armsecurity/constants.go index d682c1bdaa82..4933379e95fb 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_constants.go +++ b/sdk/resourcemanager/security/armsecurity/constants.go @@ -5,12 +5,13 @@ // 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 armsecurity const ( moduleName = "armsecurity" - moduleVersion = "v0.7.0" + moduleVersion = "v0.8.0" ) // AADConnectivityState - The connectivity state of the external AAD solution @@ -103,24 +104,6 @@ func PossibleAdditionalWorkspaceTypeValues() []AdditionalWorkspaceType { } } -// AlertNotifications - Whether to send security alerts notifications to the security contact -type AlertNotifications string - -const ( - // AlertNotificationsOff - Don't get notifications on new alerts - AlertNotificationsOff AlertNotifications = "Off" - // AlertNotificationsOn - Get notifications on new alerts - AlertNotificationsOn AlertNotifications = "On" -) - -// PossibleAlertNotificationsValues returns the possible values for the AlertNotifications const type. -func PossibleAlertNotificationsValues() []AlertNotifications { - return []AlertNotifications{ - AlertNotificationsOff, - AlertNotificationsOn, - } -} - // AlertSeverity - The risk level of the threat that was detected. Learn more: https://docs.microsoft.com/en-us/azure/security-center/security-center-alerts-overview#how-are-alerts-classified. type AlertSeverity string @@ -153,6 +136,8 @@ const ( AlertStatusActive AlertStatus = "Active" // AlertStatusDismissed - Alert dismissed as false positive AlertStatusDismissed AlertStatus = "Dismissed" + // AlertStatusInProgress - An alert which is in handling state + AlertStatusInProgress AlertStatus = "InProgress" // AlertStatusResolved - Alert closed after handling AlertStatusResolved AlertStatus = "Resolved" ) @@ -162,25 +147,44 @@ func PossibleAlertStatusValues() []AlertStatus { return []AlertStatus{ AlertStatusActive, AlertStatusDismissed, + AlertStatusInProgress, AlertStatusResolved, } } -// AlertsToAdmins - Whether to send security alerts notifications to subscription admins -type AlertsToAdmins string +// ApplicationConditionOperator - The application Condition's Operator, for example Contains for id or In for list of possible +// IDs, see examples +type ApplicationConditionOperator string const ( - // AlertsToAdminsOff - Don't send notification on new alerts to the subscription's admins - AlertsToAdminsOff AlertsToAdmins = "Off" - // AlertsToAdminsOn - Send notification on new alerts to the subscription's admins - AlertsToAdminsOn AlertsToAdmins = "On" + // ApplicationConditionOperatorContains - Checks that the string value of the data defined in Property contains the given + // value + ApplicationConditionOperatorContains ApplicationConditionOperator = "Contains" + // ApplicationConditionOperatorIn - Checks that the string value of the data defined in Property equals any of the given values + // (exact fit) + ApplicationConditionOperatorIn ApplicationConditionOperator = "In" ) -// PossibleAlertsToAdminsValues returns the possible values for the AlertsToAdmins const type. -func PossibleAlertsToAdminsValues() []AlertsToAdmins { - return []AlertsToAdmins{ - AlertsToAdminsOff, - AlertsToAdminsOn, +// PossibleApplicationConditionOperatorValues returns the possible values for the ApplicationConditionOperator const type. +func PossibleApplicationConditionOperatorValues() []ApplicationConditionOperator { + return []ApplicationConditionOperator{ + ApplicationConditionOperatorContains, + ApplicationConditionOperatorIn, + } +} + +// ApplicationSourceResourceType - The application source, what it affects, e.g. Assessments +type ApplicationSourceResourceType string + +const ( + // ApplicationSourceResourceTypeAssessments - The source of the application is assessments + ApplicationSourceResourceTypeAssessments ApplicationSourceResourceType = "Assessments" +) + +// PossibleApplicationSourceResourceTypeValues returns the possible values for the ApplicationSourceResourceType const type. +func PossibleApplicationSourceResourceTypeValues() []ApplicationSourceResourceType { + return []ApplicationSourceResourceType{ + ApplicationSourceResourceTypeAssessments, } } @@ -319,6 +323,7 @@ type BundleType string const ( BundleTypeAppServices BundleType = "AppServices" + BundleTypeCosmosDbs BundleType = "CosmosDbs" BundleTypeDNS BundleType = "DNS" BundleTypeKeyVaults BundleType = "KeyVaults" BundleTypeKubernetesService BundleType = "KubernetesService" @@ -332,6 +337,7 @@ const ( func PossibleBundleTypeValues() []BundleType { return []BundleType{ BundleTypeAppServices, + BundleTypeCosmosDbs, BundleTypeDNS, BundleTypeKeyVaults, BundleTypeKubernetesService, @@ -368,9 +374,11 @@ func PossibleCategoriesValues() []Categories { type CloudName string const ( - CloudNameAWS CloudName = "AWS" - CloudNameAzure CloudName = "Azure" - CloudNameGCP CloudName = "GCP" + CloudNameAWS CloudName = "AWS" + CloudNameAzure CloudName = "Azure" + CloudNameAzureDevOps CloudName = "AzureDevOps" + CloudNameGCP CloudName = "GCP" + CloudNameGithub CloudName = "Github" ) // PossibleCloudNameValues returns the possible values for the CloudName const type. @@ -378,7 +386,9 @@ func PossibleCloudNameValues() []CloudName { return []CloudName{ CloudNameAWS, CloudNameAzure, + CloudNameAzureDevOps, CloudNameGCP, + CloudNameGithub, } } @@ -545,6 +555,26 @@ func PossibleEnforcementSupportValues() []EnforcementSupport { } } +// EnvironmentType - The type of the environment data. +type EnvironmentType string + +const ( + EnvironmentTypeAwsAccount EnvironmentType = "AwsAccount" + EnvironmentTypeAzureDevOpsScope EnvironmentType = "AzureDevOpsScope" + EnvironmentTypeGcpProject EnvironmentType = "GcpProject" + EnvironmentTypeGithubScope EnvironmentType = "GithubScope" +) + +// PossibleEnvironmentTypeValues returns the possible values for the EnvironmentType const type. +func PossibleEnvironmentTypeValues() []EnvironmentType { + return []EnvironmentType{ + EnvironmentTypeAwsAccount, + EnvironmentTypeAzureDevOpsScope, + EnvironmentTypeGcpProject, + EnvironmentTypeGithubScope, + } +} + // EventSource - A valid event source type. type EventSource string @@ -666,6 +696,78 @@ func PossibleFileTypeValues() []FileType { } } +// GovernanceRuleConditionOperator - The governance rule Condition's Operator, for example Equals for severity or In for list +// of assessments, see examples +type GovernanceRuleConditionOperator string + +const ( + // GovernanceRuleConditionOperatorEquals - Checks that the string value of the data defined in Property equals the given value + // - exact fit + GovernanceRuleConditionOperatorEquals GovernanceRuleConditionOperator = "Equals" + // GovernanceRuleConditionOperatorIn - Checks that the string value of the data defined in Property equals any of the given + // values (exact fit) + GovernanceRuleConditionOperatorIn GovernanceRuleConditionOperator = "In" +) + +// PossibleGovernanceRuleConditionOperatorValues returns the possible values for the GovernanceRuleConditionOperator const type. +func PossibleGovernanceRuleConditionOperatorValues() []GovernanceRuleConditionOperator { + return []GovernanceRuleConditionOperator{ + GovernanceRuleConditionOperatorEquals, + GovernanceRuleConditionOperatorIn, + } +} + +// GovernanceRuleOwnerSourceType - The owner type for the governance rule owner source +type GovernanceRuleOwnerSourceType string + +const ( + // GovernanceRuleOwnerSourceTypeByTag - The rule source type defined using resource tag + GovernanceRuleOwnerSourceTypeByTag GovernanceRuleOwnerSourceType = "ByTag" + // GovernanceRuleOwnerSourceTypeManually - The rule source type defined manually + GovernanceRuleOwnerSourceTypeManually GovernanceRuleOwnerSourceType = "Manually" +) + +// PossibleGovernanceRuleOwnerSourceTypeValues returns the possible values for the GovernanceRuleOwnerSourceType const type. +func PossibleGovernanceRuleOwnerSourceTypeValues() []GovernanceRuleOwnerSourceType { + return []GovernanceRuleOwnerSourceType{ + GovernanceRuleOwnerSourceTypeByTag, + GovernanceRuleOwnerSourceTypeManually, + } +} + +// GovernanceRuleSourceResourceType - The governance rule source, what the rule affects, e.g. Assessments +type GovernanceRuleSourceResourceType string + +const ( + // GovernanceRuleSourceResourceTypeAssessments - The source of the governance rule is assessments + GovernanceRuleSourceResourceTypeAssessments GovernanceRuleSourceResourceType = "Assessments" +) + +// PossibleGovernanceRuleSourceResourceTypeValues returns the possible values for the GovernanceRuleSourceResourceType const type. +func PossibleGovernanceRuleSourceResourceTypeValues() []GovernanceRuleSourceResourceType { + return []GovernanceRuleSourceResourceType{ + GovernanceRuleSourceResourceTypeAssessments, + } +} + +// GovernanceRuleType - The rule type of the governance rule, defines the source of the rule e.g. Integrated +type GovernanceRuleType string + +const ( + // GovernanceRuleTypeIntegrated - The source of the rule type definition is integrated + GovernanceRuleTypeIntegrated GovernanceRuleType = "Integrated" + // GovernanceRuleTypeServiceNow - The source of the rule type definition is ServiceNow + GovernanceRuleTypeServiceNow GovernanceRuleType = "ServiceNow" +) + +// PossibleGovernanceRuleTypeValues returns the possible values for the GovernanceRuleType const type. +func PossibleGovernanceRuleTypeValues() []GovernanceRuleType { + return []GovernanceRuleType{ + GovernanceRuleTypeIntegrated, + GovernanceRuleTypeServiceNow, + } +} + // HybridComputeProvisioningState - State of the service principal and its secret type HybridComputeProvisioningState string @@ -811,13 +913,41 @@ func PossibleKindValues() []Kind { } } +// MinimalSeverity - Defines the minimal alert severity which will be sent as email notifications +type MinimalSeverity string + +const ( + // MinimalSeverityHigh - Get notifications on new alerts with High severity + MinimalSeverityHigh MinimalSeverity = "High" + // MinimalSeverityLow - Don't get notifications on new alerts with low, medium or high severity + MinimalSeverityLow MinimalSeverity = "Low" + // MinimalSeverityMedium - Get notifications on new alerts with medium or high severity + MinimalSeverityMedium MinimalSeverity = "Medium" +) + +// PossibleMinimalSeverityValues returns the possible values for the MinimalSeverity const type. +func PossibleMinimalSeverityValues() []MinimalSeverity { + return []MinimalSeverity{ + MinimalSeverityHigh, + MinimalSeverityLow, + MinimalSeverityMedium, + } +} + // OfferingType - The type of the security offering. type OfferingType string const ( OfferingTypeCspmMonitorAws OfferingType = "CspmMonitorAws" + OfferingTypeCspmMonitorAzureDevOps OfferingType = "CspmMonitorAzureDevOps" + OfferingTypeCspmMonitorGcp OfferingType = "CspmMonitorGcp" + OfferingTypeCspmMonitorGithub OfferingType = "CspmMonitorGithub" OfferingTypeDefenderForContainersAws OfferingType = "DefenderForContainersAws" + OfferingTypeDefenderForContainersGcp OfferingType = "DefenderForContainersGcp" + OfferingTypeDefenderForDatabasesAws OfferingType = "DefenderForDatabasesAws" + OfferingTypeDefenderForDatabasesGcp OfferingType = "DefenderForDatabasesGcp" OfferingTypeDefenderForServersAws OfferingType = "DefenderForServersAws" + OfferingTypeDefenderForServersGcp OfferingType = "DefenderForServersGcp" OfferingTypeInformationProtectionAws OfferingType = "InformationProtectionAws" ) @@ -825,8 +955,15 @@ const ( func PossibleOfferingTypeValues() []OfferingType { return []OfferingType{ OfferingTypeCspmMonitorAws, + OfferingTypeCspmMonitorAzureDevOps, + OfferingTypeCspmMonitorGcp, + OfferingTypeCspmMonitorGithub, OfferingTypeDefenderForContainersAws, + OfferingTypeDefenderForContainersGcp, + OfferingTypeDefenderForDatabasesAws, + OfferingTypeDefenderForDatabasesGcp, OfferingTypeDefenderForServersAws, + OfferingTypeDefenderForServersGcp, OfferingTypeInformationProtectionAws, } } @@ -1196,6 +1333,30 @@ func PossibleResourceStatusValues() []ResourceStatus { } } +// Roles - A possible role to configure sending security notification alerts to +type Roles string + +const ( + // RolesAccountAdmin - If enabled, send notification on new alerts to the account admins + RolesAccountAdmin Roles = "AccountAdmin" + // RolesContributor - If enabled, send notification on new alerts to the subscription contributors + RolesContributor Roles = "Contributor" + // RolesOwner - If enabled, send notification on new alerts to the subscription owners + RolesOwner Roles = "Owner" + // RolesServiceAdmin - If enabled, send notification on new alerts to the service admins + RolesServiceAdmin Roles = "ServiceAdmin" +) + +// PossibleRolesValues returns the possible values for the Roles const type. +func PossibleRolesValues() []Roles { + return []Roles{ + RolesAccountAdmin, + RolesContributor, + RolesOwner, + RolesServiceAdmin, + } +} + // RuleSeverity - The rule severity. type RuleSeverity string @@ -1328,6 +1489,20 @@ func PossibleScanTriggerTypeValues() []ScanTriggerType { } } +// ScanningMode - The scanning mode for the vm scan. +type ScanningMode string + +const ( + ScanningModeDefault ScanningMode = "Default" +) + +// PossibleScanningModeValues returns the possible values for the ScanningMode const type. +func PossibleScanningModeValues() []ScanningMode { + return []ScanningMode{ + ScanningModeDefault, + } +} + // SecurityFamily - The security family of the discovered solution type SecurityFamily string @@ -1412,6 +1587,7 @@ const ( SettingNameSentinel SettingName = "Sentinel" SettingNameWDATP SettingName = "WDATP" SettingNameWDATPEXCLUDELINUXPUBLICPREVIEW SettingName = "WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW" + SettingNameWDATPUNIFIEDSOLUTION SettingName = "WDATP_UNIFIED_SOLUTION" ) // PossibleSettingNameValues returns the possible values for the SettingName const type. @@ -1421,6 +1597,7 @@ func PossibleSettingNameValues() []SettingName { SettingNameSentinel, SettingNameWDATP, SettingNameWDATPEXCLUDELINUXPUBLICPREVIEW, + SettingNameWDATPUNIFIEDSOLUTION, } } @@ -1582,6 +1759,22 @@ func PossibleSubAssessmentStatusCodeValues() []SubAssessmentStatusCode { } } +// SubPlan - The available sub plans +type SubPlan string + +const ( + SubPlanP1 SubPlan = "P1" + SubPlanP2 SubPlan = "P2" +) + +// PossibleSubPlanValues returns the possible values for the SubPlan const type. +func PossibleSubPlanValues() []SubPlan { + return []SubPlan{ + SubPlanP1, + SubPlanP2, + } +} + // SupportedCloudEnum - Relevant cloud for the custom assessment automation. type SupportedCloudEnum string @@ -1922,6 +2115,22 @@ func PossibleTransportProtocolValues() []TransportProtocol { } } +// Type - The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' +type Type string + +const ( + TypeQualys Type = "Qualys" + TypeTVM Type = "TVM" +) + +// PossibleTypeValues returns the possible values for the Type const type. +func PossibleTypeValues() []Type { + return []Type{ + TypeQualys, + TypeTVM, + } +} + // UnmaskedIPLoggingStatus - Unmasked IP address logging status type UnmaskedIPLoggingStatus string diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_contacts_client.go b/sdk/resourcemanager/security/armsecurity/contacts_client.go similarity index 75% rename from sdk/resourcemanager/security/armsecurity/zz_generated_contacts_client.go rename to sdk/resourcemanager/security/armsecurity/contacts_client.go index cf5def1507c8..c5a1de914b3f 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_contacts_client.go +++ b/sdk/resourcemanager/security/armsecurity/contacts_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -54,9 +55,9 @@ func NewContactsClient(subscriptionID string, credential azcore.TokenCredential, return client, nil } -// Create - Security contact configurations for the subscription +// Create - Create security contact configurations for the subscription // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2017-08-01-preview +// Generated from API version 2020-01-01-preview // securityContactName - Name of the security contact object // securityContact - Security contact object // options - ContactsClientCreateOptions contains the optional parameters for the ContactsClient.Create method. @@ -69,7 +70,7 @@ func (client *ContactsClient) Create(ctx context.Context, securityContactName st if err != nil { return ContactsClientCreateResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { return ContactsClientCreateResponse{}, runtime.NewResponseError(resp) } return client.createHandleResponse(resp) @@ -91,7 +92,7 @@ func (client *ContactsClient) createCreateRequest(ctx context.Context, securityC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2017-08-01-preview") + reqQP.Set("api-version", "2020-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, securityContact) @@ -106,9 +107,9 @@ func (client *ContactsClient) createHandleResponse(resp *http.Response) (Contact return result, nil } -// Delete - Security contact configurations for the subscription +// Delete - Delete security contact configurations for the subscription // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2017-08-01-preview +// Generated from API version 2020-01-01-preview // securityContactName - Name of the security contact object // options - ContactsClientDeleteOptions contains the optional parameters for the ContactsClient.Delete method. func (client *ContactsClient) Delete(ctx context.Context, securityContactName string, options *ContactsClientDeleteOptions) (ContactsClientDeleteResponse, error) { @@ -120,7 +121,7 @@ func (client *ContactsClient) Delete(ctx context.Context, securityContactName st if err != nil { return ContactsClientDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusNoContent) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return ContactsClientDeleteResponse{}, runtime.NewResponseError(resp) } return ContactsClientDeleteResponse{}, nil @@ -142,15 +143,15 @@ func (client *ContactsClient) deleteCreateRequest(ctx context.Context, securityC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2017-08-01-preview") + reqQP.Set("api-version", "2020-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// Get - Security contact configurations for the subscription +// Get - Get Default Security contact configurations for the subscription // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2017-08-01-preview +// Generated from API version 2020-01-01-preview // securityContactName - Name of the security contact object // options - ContactsClientGetOptions contains the optional parameters for the ContactsClient.Get method. func (client *ContactsClient) Get(ctx context.Context, securityContactName string, options *ContactsClientGetOptions) (ContactsClientGetResponse, error) { @@ -184,7 +185,7 @@ func (client *ContactsClient) getCreateRequest(ctx context.Context, securityCont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2017-08-01-preview") + reqQP.Set("api-version", "2020-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -199,9 +200,8 @@ func (client *ContactsClient) getHandleResponse(resp *http.Response) (ContactsCl return result, nil } -// NewListPager - Security contact configurations for the subscription -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2017-08-01-preview +// NewListPager - List all security contact configurations for the subscription +// Generated from API version 2020-01-01-preview // options - ContactsClientListOptions contains the optional parameters for the ContactsClient.List method. func (client *ContactsClient) NewListPager(options *ContactsClientListOptions) *runtime.Pager[ContactsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ContactsClientListResponse]{ @@ -243,7 +243,7 @@ func (client *ContactsClient) listCreateRequest(ctx context.Context, options *Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2017-08-01-preview") + reqQP.Set("api-version", "2020-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -257,55 +257,3 @@ func (client *ContactsClient) listHandleResponse(resp *http.Response) (ContactsC } return result, nil } - -// Update - Security contact configurations for the subscription -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2017-08-01-preview -// securityContactName - Name of the security contact object -// securityContact - Security contact object -// options - ContactsClientUpdateOptions contains the optional parameters for the ContactsClient.Update method. -func (client *ContactsClient) Update(ctx context.Context, securityContactName string, securityContact Contact, options *ContactsClientUpdateOptions) (ContactsClientUpdateResponse, error) { - req, err := client.updateCreateRequest(ctx, securityContactName, securityContact, options) - if err != nil { - return ContactsClientUpdateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ContactsClientUpdateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ContactsClientUpdateResponse{}, runtime.NewResponseError(resp) - } - return client.updateHandleResponse(resp) -} - -// updateCreateRequest creates the Update request. -func (client *ContactsClient) updateCreateRequest(ctx context.Context, securityContactName string, securityContact Contact, options *ContactsClientUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if securityContactName == "" { - return nil, errors.New("parameter securityContactName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{securityContactName}", url.PathEscape(securityContactName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.host, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2017-08-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, runtime.MarshalAsJSON(req, securityContact) -} - -// updateHandleResponse handles the Update response. -func (client *ContactsClient) updateHandleResponse(resp *http.Response) (ContactsClientUpdateResponse, error) { - result := ContactsClientUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Contact); err != nil { - return ContactsClientUpdateResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_customassessmentautomations_client.go b/sdk/resourcemanager/security/armsecurity/customassessmentautomations_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_customassessmentautomations_client.go rename to sdk/resourcemanager/security/armsecurity/customassessmentautomations_client.go index b04d5a67ea1a..4118f564ad4e 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_customassessmentautomations_client.go +++ b/sdk/resourcemanager/security/armsecurity/customassessmentautomations_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -219,7 +220,6 @@ func (client *CustomAssessmentAutomationsClient) getHandleResponse(resp *http.Re } // NewListByResourceGroupPager - List custom assessment automations by provided subscription and resource group -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2021-07-01-preview // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // options - CustomAssessmentAutomationsClientListByResourceGroupOptions contains the optional parameters for the CustomAssessmentAutomationsClient.ListByResourceGroup @@ -284,7 +284,6 @@ func (client *CustomAssessmentAutomationsClient) listByResourceGroupHandleRespon } // NewListBySubscriptionPager - List custom assessment automations by provided subscription -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2021-07-01-preview // options - CustomAssessmentAutomationsClientListBySubscriptionOptions contains the optional parameters for the CustomAssessmentAutomationsClient.ListBySubscription // method. diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_customentitystoreassignments_client.go b/sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_customentitystoreassignments_client.go rename to sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client.go index 682c2bfcbac5..f70eb6f9945b 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_customentitystoreassignments_client.go +++ b/sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -218,7 +219,6 @@ func (client *CustomEntityStoreAssignmentsClient) getHandleResponse(resp *http.R } // NewListByResourceGroupPager - List custom entity store assignments by a provided subscription and resource group -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2021-07-01-preview // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // options - CustomEntityStoreAssignmentsClientListByResourceGroupOptions contains the optional parameters for the CustomEntityStoreAssignmentsClient.ListByResourceGroup @@ -283,7 +283,6 @@ func (client *CustomEntityStoreAssignmentsClient) listByResourceGroupHandleRespo } // NewListBySubscriptionPager - List custom entity store assignments by provided subscription -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2021-07-01-preview // options - CustomEntityStoreAssignmentsClientListBySubscriptionOptions contains the optional parameters for the CustomEntityStoreAssignmentsClient.ListBySubscription // method. diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_date_type.go b/sdk/resourcemanager/security/armsecurity/date_type.go similarity index 98% rename from sdk/resourcemanager/security/armsecurity/zz_generated_date_type.go rename to sdk/resourcemanager/security/armsecurity/date_type.go index 45694fb811d8..9a4998edc1db 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_date_type.go +++ b/sdk/resourcemanager/security/armsecurity/date_type.go @@ -5,6 +5,7 @@ // 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 armsecurity diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_devicesecuritygroups_client.go b/sdk/resourcemanager/security/armsecurity/devicesecuritygroups_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_devicesecuritygroups_client.go rename to sdk/resourcemanager/security/armsecurity/devicesecuritygroups_client.go index 3a1af4c20cf9..07201bebd162 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_devicesecuritygroups_client.go +++ b/sdk/resourcemanager/security/armsecurity/devicesecuritygroups_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -197,7 +198,6 @@ func (client *DeviceSecurityGroupsClient) getHandleResponse(resp *http.Response) } // NewListPager - Use this method get the list of device security groups for the specified IoT Hub resource. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-08-01 // resourceID - The identifier of the resource. // options - DeviceSecurityGroupsClientListOptions contains the optional parameters for the DeviceSecurityGroupsClient.List diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_discoveredsecuritysolutions_client.go b/sdk/resourcemanager/security/armsecurity/discoveredsecuritysolutions_client.go similarity index 98% rename from sdk/resourcemanager/security/armsecurity/zz_generated_discoveredsecuritysolutions_client.go rename to sdk/resourcemanager/security/armsecurity/discoveredsecuritysolutions_client.go index ebf61f35acdf..37900587ad97 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_discoveredsecuritysolutions_client.go +++ b/sdk/resourcemanager/security/armsecurity/discoveredsecuritysolutions_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -117,7 +118,6 @@ func (client *DiscoveredSecuritySolutionsClient) getHandleResponse(resp *http.Re } // NewListPager - Gets a list of discovered Security Solutions for the subscription. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // options - DiscoveredSecuritySolutionsClientListOptions contains the optional parameters for the DiscoveredSecuritySolutionsClient.List // method. @@ -177,7 +177,6 @@ func (client *DiscoveredSecuritySolutionsClient) listHandleResponse(resp *http.R } // NewListByHomeRegionPager - Gets a list of discovered Security Solutions for the subscription and location. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // options - DiscoveredSecuritySolutionsClientListByHomeRegionOptions contains the optional parameters for the DiscoveredSecuritySolutionsClient.ListByHomeRegion diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_externalsecuritysolutions_client.go b/sdk/resourcemanager/security/armsecurity/externalsecuritysolutions_client.go similarity index 98% rename from sdk/resourcemanager/security/armsecurity/zz_generated_externalsecuritysolutions_client.go rename to sdk/resourcemanager/security/armsecurity/externalsecuritysolutions_client.go index dd6bc4f77db8..a710174214bd 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_externalsecuritysolutions_client.go +++ b/sdk/resourcemanager/security/armsecurity/externalsecuritysolutions_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -117,7 +118,6 @@ func (client *ExternalSecuritySolutionsClient) getHandleResponse(resp *http.Resp } // NewListPager - Gets a list of external security solutions for the subscription. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // options - ExternalSecuritySolutionsClientListOptions contains the optional parameters for the ExternalSecuritySolutionsClient.List // method. @@ -177,7 +177,6 @@ func (client *ExternalSecuritySolutionsClient) listHandleResponse(resp *http.Res } // NewListByHomeRegionPager - Gets a list of external Security Solutions for the subscription and location. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // options - ExternalSecuritySolutionsClientListByHomeRegionOptions contains the optional parameters for the ExternalSecuritySolutionsClient.ListByHomeRegion diff --git a/sdk/resourcemanager/security/armsecurity/go.mod b/sdk/resourcemanager/security/armsecurity/go.mod index f5825195831b..84a93b93dce3 100644 --- a/sdk/resourcemanager/security/armsecurity/go.mod +++ b/sdk/resourcemanager/security/armsecurity/go.mod @@ -2,20 +2,12 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurit go 1.18 -require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 - github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 -) +require github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 require ( github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 // indirect - github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 // indirect - github.com/golang-jwt/jwt v3.2.1+incompatible // indirect - github.com/google/uuid v1.1.1 // indirect - github.com/kylelemons/godebug v1.1.0 // indirect - github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 // indirect - golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 // indirect - golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect golang.org/x/text v0.3.7 // indirect + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect ) diff --git a/sdk/resourcemanager/security/armsecurity/go.sum b/sdk/resourcemanager/security/armsecurity/go.sum index ed5b814680ee..3afb578030a5 100644 --- a/sdk/resourcemanager/security/armsecurity/go.sum +++ b/sdk/resourcemanager/security/armsecurity/go.sum @@ -1,33 +1,15 @@ github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0 h1:sVPhtT2qjO86rTUaWMr4WoES4TkjGnzcioXcnHV9s5k= github.com/Azure/azure-sdk-for-go/sdk/azcore v1.0.0/go.mod h1:uGG2W01BaETf0Ozp+QxxKJdMBNRWPdstHG0Fmdwn1/U= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0 h1:Yoicul8bnVdQrhDMTHxdEckRGX01XvwXDHUT9zYZ3k0= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.0.0/go.mod h1:+6sju8gk8FRmSajX3Oz4G5Gm7P+mbqE9FVaXXFYTkCM= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0 h1:jp0dGvZ7ZK0mgqnTSClMxa5xuRL7NZgHameVYF6BurY= github.com/Azure/azure-sdk-for-go/sdk/internal v1.0.0/go.mod h1:eWRD7oawr1Mu1sLCawqVc0CUiF43ia3qQMxLscsKQ9w= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0 h1:WVsrXCnHlDDX8ls+tootqRE87/hL9S/g4ewig9RsD/c= -github.com/AzureAD/microsoft-authentication-library-for-go v0.4.0/go.mod h1:Vt9sXTKwMyGcOxSmLDMnGPgqsUg7m8pe215qMLrDXw4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/dnaeon/go-vcr v1.1.0 h1:ReYa/UBrRyQdant9B4fNHGoCNKw6qh6P0fsdGmZpR7c= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= -github.com/golang-jwt/jwt/v4 v4.2.0 h1:besgBTC8w8HjP6NzQdxwKH9Z5oQMZ24ThTrHp3cZ8eU= -github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= -github.com/google/uuid v1.1.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/montanaflynn/stats v0.6.6/go.mod h1:etXPPgVO6n31NxCd9KQUMvCM+ve0ruNzt6R8Bnaayow= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4 h1:Qj1ukM4GlMWXNdMBuXcXfz/Kw9s1qm0CLY32QxuSImI= -github.com/pkg/browser v0.0.0-20210115035449-ce105d075bb4/go.mod h1:N6UoU20jOqggOuDwUaBQpluzLNDqif3kq9z2wpdYEfQ= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88 h1:Tgea0cVUD0ivh5ADBX4WwuI12DUd2to3nCYe2eayMIw= -golang.org/x/crypto v0.0.0-20220511200225-c6db032c6c88/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4 h1:HVyaeDAYux4pnY+D/SiwmLOR36ewZ4iGQIIrtnuCjFA= golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM= -golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/security/armsecurity/governanceassignments_client.go b/sdk/resourcemanager/security/armsecurity/governanceassignments_client.go new file mode 100644 index 000000000000..09945ef5d0b5 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/governanceassignments_client.go @@ -0,0 +1,275 @@ +//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 armsecurity + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// GovernanceAssignmentsClient contains the methods for the GovernanceAssignments group. +// Don't use this type directly, use NewGovernanceAssignmentsClient() instead. +type GovernanceAssignmentsClient struct { + host string + pl runtime.Pipeline +} + +// NewGovernanceAssignmentsClient creates a new instance of GovernanceAssignmentsClient with the specified values. +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewGovernanceAssignmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GovernanceAssignmentsClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &GovernanceAssignmentsClient{ + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or update a security GovernanceAssignment on the given subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +// scope - Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group +// (/providers/Microsoft.Management/managementGroups/mgName). +// assessmentName - The Assessment Key - Unique key for the assessment type +// assignmentKey - The security governance assignment key - the assessment key of the required governance assignment +// governanceAssignment - GovernanceAssignment over a subscription scope +// options - GovernanceAssignmentsClientCreateOrUpdateOptions contains the optional parameters for the GovernanceAssignmentsClient.CreateOrUpdate +// method. +func (client *GovernanceAssignmentsClient) CreateOrUpdate(ctx context.Context, scope string, assessmentName string, assignmentKey string, governanceAssignment GovernanceAssignment, options *GovernanceAssignmentsClientCreateOrUpdateOptions) (GovernanceAssignmentsClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, scope, assessmentName, assignmentKey, governanceAssignment, options) + if err != nil { + return GovernanceAssignmentsClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GovernanceAssignmentsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return GovernanceAssignmentsClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *GovernanceAssignmentsClient) createOrUpdateCreateRequest(ctx context.Context, scope string, assessmentName string, assignmentKey string, governanceAssignment GovernanceAssignment, options *GovernanceAssignmentsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + if assignmentKey == "" { + return nil, errors.New("parameter assignmentKey cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assignmentKey}", url.PathEscape(assignmentKey)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, governanceAssignment) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *GovernanceAssignmentsClient) createOrUpdateHandleResponse(resp *http.Response) (GovernanceAssignmentsClientCreateOrUpdateResponse, error) { + result := GovernanceAssignmentsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GovernanceAssignment); err != nil { + return GovernanceAssignmentsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a GovernanceAssignment over a given scope +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +// scope - Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group +// (/providers/Microsoft.Management/managementGroups/mgName). +// assessmentName - The Assessment Key - Unique key for the assessment type +// assignmentKey - The security governance assignment key - the assessment key of the required governance assignment +// options - GovernanceAssignmentsClientDeleteOptions contains the optional parameters for the GovernanceAssignmentsClient.Delete +// method. +func (client *GovernanceAssignmentsClient) Delete(ctx context.Context, scope string, assessmentName string, assignmentKey string, options *GovernanceAssignmentsClientDeleteOptions) (GovernanceAssignmentsClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, scope, assessmentName, assignmentKey, options) + if err != nil { + return GovernanceAssignmentsClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GovernanceAssignmentsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return GovernanceAssignmentsClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return GovernanceAssignmentsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *GovernanceAssignmentsClient) deleteCreateRequest(ctx context.Context, scope string, assessmentName string, assignmentKey string, options *GovernanceAssignmentsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + if assignmentKey == "" { + return nil, errors.New("parameter assignmentKey cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assignmentKey}", url.PathEscape(assignmentKey)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Get a specific governanceAssignment for the requested scope by AssignmentKey +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +// scope - Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group +// (/providers/Microsoft.Management/managementGroups/mgName). +// assessmentName - The Assessment Key - Unique key for the assessment type +// assignmentKey - The security governance assignment key - the assessment key of the required governance assignment +// options - GovernanceAssignmentsClientGetOptions contains the optional parameters for the GovernanceAssignmentsClient.Get +// method. +func (client *GovernanceAssignmentsClient) Get(ctx context.Context, scope string, assessmentName string, assignmentKey string, options *GovernanceAssignmentsClientGetOptions) (GovernanceAssignmentsClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, scope, assessmentName, assignmentKey, options) + if err != nil { + return GovernanceAssignmentsClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GovernanceAssignmentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GovernanceAssignmentsClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *GovernanceAssignmentsClient) getCreateRequest(ctx context.Context, scope string, assessmentName string, assignmentKey string, options *GovernanceAssignmentsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + if assignmentKey == "" { + return nil, errors.New("parameter assignmentKey cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assignmentKey}", url.PathEscape(assignmentKey)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GovernanceAssignmentsClient) getHandleResponse(resp *http.Response) (GovernanceAssignmentsClientGetResponse, error) { + result := GovernanceAssignmentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GovernanceAssignment); err != nil { + return GovernanceAssignmentsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get security governanceAssignments on all your resources inside a scope +// Generated from API version 2022-01-01-preview +// scope - Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group +// (/providers/Microsoft.Management/managementGroups/mgName). +// assessmentName - The Assessment Key - Unique key for the assessment type +// options - GovernanceAssignmentsClientListOptions contains the optional parameters for the GovernanceAssignmentsClient.List +// method. +func (client *GovernanceAssignmentsClient) NewListPager(scope string, assessmentName string, options *GovernanceAssignmentsClientListOptions) *runtime.Pager[GovernanceAssignmentsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[GovernanceAssignmentsClientListResponse]{ + More: func(page GovernanceAssignmentsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GovernanceAssignmentsClientListResponse) (GovernanceAssignmentsClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, scope, assessmentName, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return GovernanceAssignmentsClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GovernanceAssignmentsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GovernanceAssignmentsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *GovernanceAssignmentsClient) listCreateRequest(ctx context.Context, scope string, assessmentName string, options *GovernanceAssignmentsClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments" + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if assessmentName == "" { + return nil, errors.New("parameter assessmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentName}", url.PathEscape(assessmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *GovernanceAssignmentsClient) listHandleResponse(resp *http.Response) (GovernanceAssignmentsClientListResponse, error) { + result := GovernanceAssignmentsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GovernanceAssignmentsList); err != nil { + return GovernanceAssignmentsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/governancerule_client.go b/sdk/resourcemanager/security/armsecurity/governancerule_client.go new file mode 100644 index 000000000000..7db7da579719 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/governancerule_client.go @@ -0,0 +1,114 @@ +//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 armsecurity + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// GovernanceRuleClient contains the methods for the GovernanceRule group. +// Don't use this type directly, use NewGovernanceRuleClient() instead. +type GovernanceRuleClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewGovernanceRuleClient creates a new instance of GovernanceRuleClient with the specified values. +// subscriptionID - Azure subscription ID +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewGovernanceRuleClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GovernanceRuleClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &GovernanceRuleClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// NewListPager - Get a list of all relevant governanceRules over a subscription level scope +// Generated from API version 2022-01-01-preview +// options - GovernanceRuleClientListOptions contains the optional parameters for the GovernanceRuleClient.List method. +func (client *GovernanceRuleClient) NewListPager(options *GovernanceRuleClientListOptions) *runtime.Pager[GovernanceRuleClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[GovernanceRuleClientListResponse]{ + More: func(page GovernanceRuleClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *GovernanceRuleClientListResponse) (GovernanceRuleClientListResponse, error) { + var req *policy.Request + var err error + if page == nil { + req, err = client.listCreateRequest(ctx, options) + } else { + req, err = runtime.NewRequest(ctx, http.MethodGet, *page.NextLink) + } + if err != nil { + return GovernanceRuleClientListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GovernanceRuleClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GovernanceRuleClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + }) +} + +// listCreateRequest creates the List request. +func (client *GovernanceRuleClient) listCreateRequest(ctx context.Context, options *GovernanceRuleClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *GovernanceRuleClient) listHandleResponse(resp *http.Response) (GovernanceRuleClientListResponse, error) { + result := GovernanceRuleClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GovernanceRuleList); err != nil { + return GovernanceRuleClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/governancerules_client.go b/sdk/resourcemanager/security/armsecurity/governancerules_client.go new file mode 100644 index 000000000000..b8f65daca535 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/governancerules_client.go @@ -0,0 +1,333 @@ +//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 armsecurity + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// GovernanceRulesClient contains the methods for the GovernanceRules group. +// Don't use this type directly, use NewGovernanceRulesClient() instead. +type GovernanceRulesClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewGovernanceRulesClient creates a new instance of GovernanceRulesClient with the specified values. +// subscriptionID - Azure subscription ID +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewGovernanceRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GovernanceRulesClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &GovernanceRulesClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// CreateOrUpdate - Creates or update a security GovernanceRule on the given subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +// ruleID - The security GovernanceRule key - unique key for the standard GovernanceRule +// governanceRule - GovernanceRule over a subscription scope +// options - GovernanceRulesClientCreateOrUpdateOptions contains the optional parameters for the GovernanceRulesClient.CreateOrUpdate +// method. +func (client *GovernanceRulesClient) CreateOrUpdate(ctx context.Context, ruleID string, governanceRule GovernanceRule, options *GovernanceRulesClientCreateOrUpdateOptions) (GovernanceRulesClientCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, ruleID, governanceRule, options) + if err != nil { + return GovernanceRulesClientCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GovernanceRulesClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return GovernanceRulesClientCreateOrUpdateResponse{}, runtime.NewResponseError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *GovernanceRulesClient) createOrUpdateCreateRequest(ctx context.Context, ruleID string, governanceRule GovernanceRule, options *GovernanceRulesClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if ruleID == "" { + return nil, errors.New("parameter ruleID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, runtime.MarshalAsJSON(req, governanceRule) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *GovernanceRulesClient) createOrUpdateHandleResponse(resp *http.Response) (GovernanceRulesClientCreateOrUpdateResponse, error) { + result := GovernanceRulesClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GovernanceRule); err != nil { + return GovernanceRulesClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a GovernanceRule over a given scope +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +// ruleID - The security GovernanceRule key - unique key for the standard GovernanceRule +// options - GovernanceRulesClientDeleteOptions contains the optional parameters for the GovernanceRulesClient.Delete method. +func (client *GovernanceRulesClient) Delete(ctx context.Context, ruleID string, options *GovernanceRulesClientDeleteOptions) (GovernanceRulesClientDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, ruleID, options) + if err != nil { + return GovernanceRulesClientDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GovernanceRulesClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return GovernanceRulesClientDeleteResponse{}, runtime.NewResponseError(resp) + } + return GovernanceRulesClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *GovernanceRulesClient) deleteCreateRequest(ctx context.Context, ruleID string, options *GovernanceRulesClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if ruleID == "" { + return nil, errors.New("parameter ruleID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Get a specific governanceRule for the requested scope by ruleId +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +// ruleID - The security GovernanceRule key - unique key for the standard GovernanceRule +// options - GovernanceRulesClientGetOptions contains the optional parameters for the GovernanceRulesClient.Get method. +func (client *GovernanceRulesClient) Get(ctx context.Context, ruleID string, options *GovernanceRulesClientGetOptions) (GovernanceRulesClientGetResponse, error) { + req, err := client.getCreateRequest(ctx, ruleID, options) + if err != nil { + return GovernanceRulesClientGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return GovernanceRulesClientGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return GovernanceRulesClientGetResponse{}, runtime.NewResponseError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *GovernanceRulesClient) getCreateRequest(ctx context.Context, ruleID string, options *GovernanceRulesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if ruleID == "" { + return nil, errors.New("parameter ruleID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *GovernanceRulesClient) getHandleResponse(resp *http.Response) (GovernanceRulesClientGetResponse, error) { + result := GovernanceRulesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.GovernanceRule); err != nil { + return GovernanceRulesClientGetResponse{}, err + } + return result, nil +} + +// BeginRuleIDExecuteSingleSecurityConnector - Execute a security GovernanceRule on the given security connector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +// resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// securityConnectorName - The security connector name. +// ruleID - The security GovernanceRule key - unique key for the standard GovernanceRule +// options - GovernanceRulesClientBeginRuleIDExecuteSingleSecurityConnectorOptions contains the optional parameters for the +// GovernanceRulesClient.BeginRuleIDExecuteSingleSecurityConnector method. +func (client *GovernanceRulesClient) BeginRuleIDExecuteSingleSecurityConnector(ctx context.Context, resourceGroupName string, securityConnectorName string, ruleID string, options *GovernanceRulesClientBeginRuleIDExecuteSingleSecurityConnectorOptions) (*runtime.Poller[GovernanceRulesClientRuleIDExecuteSingleSecurityConnectorResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.ruleIDExecuteSingleSecurityConnector(ctx, resourceGroupName, securityConnectorName, ruleID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GovernanceRulesClientRuleIDExecuteSingleSecurityConnectorResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GovernanceRulesClientRuleIDExecuteSingleSecurityConnectorResponse](options.ResumeToken, client.pl, nil) + } +} + +// RuleIDExecuteSingleSecurityConnector - Execute a security GovernanceRule on the given security connector. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +func (client *GovernanceRulesClient) ruleIDExecuteSingleSecurityConnector(ctx context.Context, resourceGroupName string, securityConnectorName string, ruleID string, options *GovernanceRulesClientBeginRuleIDExecuteSingleSecurityConnectorOptions) (*http.Response, error) { + req, err := client.ruleIDExecuteSingleSecurityConnectorCreateRequest(ctx, resourceGroupName, securityConnectorName, ruleID, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// ruleIDExecuteSingleSecurityConnectorCreateRequest creates the RuleIDExecuteSingleSecurityConnector request. +func (client *GovernanceRulesClient) ruleIDExecuteSingleSecurityConnectorCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, ruleID string, options *GovernanceRulesClientBeginRuleIDExecuteSingleSecurityConnectorOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/providers/Microsoft.Security/governanceRules/{ruleId}/execute" + 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 securityConnectorName == "" { + return nil, errors.New("parameter securityConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) + if ruleID == "" { + return nil, errors.New("parameter ruleID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.ExecuteGovernanceRuleParams != nil { + return req, runtime.MarshalAsJSON(req, *options.ExecuteGovernanceRuleParams) + } + return req, nil +} + +// BeginRuleIDExecuteSingleSubscription - Execute a security GovernanceRule on the given subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +// ruleID - The security GovernanceRule key - unique key for the standard GovernanceRule +// options - GovernanceRulesClientBeginRuleIDExecuteSingleSubscriptionOptions contains the optional parameters for the GovernanceRulesClient.BeginRuleIDExecuteSingleSubscription +// method. +func (client *GovernanceRulesClient) BeginRuleIDExecuteSingleSubscription(ctx context.Context, ruleID string, options *GovernanceRulesClientBeginRuleIDExecuteSingleSubscriptionOptions) (*runtime.Poller[GovernanceRulesClientRuleIDExecuteSingleSubscriptionResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.ruleIDExecuteSingleSubscription(ctx, ruleID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[GovernanceRulesClientRuleIDExecuteSingleSubscriptionResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[GovernanceRulesClientRuleIDExecuteSingleSubscriptionResponse](options.ResumeToken, client.pl, nil) + } +} + +// RuleIDExecuteSingleSubscription - Execute a security GovernanceRule on the given subscription. +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +func (client *GovernanceRulesClient) ruleIDExecuteSingleSubscription(ctx context.Context, ruleID string, options *GovernanceRulesClientBeginRuleIDExecuteSingleSubscriptionOptions) (*http.Response, error) { + req, err := client.ruleIDExecuteSingleSubscriptionCreateRequest(ctx, ruleID, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// ruleIDExecuteSingleSubscriptionCreateRequest creates the RuleIDExecuteSingleSubscription request. +func (client *GovernanceRulesClient) ruleIDExecuteSingleSubscriptionCreateRequest(ctx context.Context, ruleID string, options *GovernanceRulesClientBeginRuleIDExecuteSingleSubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/execute" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if ruleID == "" { + return nil, errors.New("parameter ruleID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if options != nil && options.ExecuteGovernanceRuleParams != nil { + return req, runtime.MarshalAsJSON(req, *options.ExecuteGovernanceRuleParams) + } + return req, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_informationprotectionpolicies_client.go b/sdk/resourcemanager/security/armsecurity/informationprotectionpolicies_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_informationprotectionpolicies_client.go rename to sdk/resourcemanager/security/armsecurity/informationprotectionpolicies_client.go index e27af6849352..599e9491c74b 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_informationprotectionpolicies_client.go +++ b/sdk/resourcemanager/security/armsecurity/informationprotectionpolicies_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -155,7 +156,6 @@ func (client *InformationProtectionPoliciesClient) getHandleResponse(resp *http. } // NewListPager - Information protection policies of a specific management group. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2017-08-01-preview // scope - Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group // (/providers/Microsoft.Management/managementGroups/mgName). diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_ingestionsettings_client.go b/sdk/resourcemanager/security/armsecurity/ingestionsettings_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_ingestionsettings_client.go rename to sdk/resourcemanager/security/armsecurity/ingestionsettings_client.go index 96239cd477c8..c3e0e2349fec 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_ingestionsettings_client.go +++ b/sdk/resourcemanager/security/armsecurity/ingestionsettings_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -202,7 +203,6 @@ func (client *IngestionSettingsClient) getHandleResponse(resp *http.Response) (I } // NewListPager - Settings for ingesting security data and logs to correlate with resources associated with the subscription. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2021-01-15-preview // options - IngestionSettingsClientListOptions contains the optional parameters for the IngestionSettingsClient.List method. func (client *IngestionSettingsClient) NewListPager(options *IngestionSettingsClientListOptions) *runtime.Pager[IngestionSettingsClientListResponse] { diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolution_client.go b/sdk/resourcemanager/security/armsecurity/iotsecuritysolution_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolution_client.go rename to sdk/resourcemanager/security/armsecurity/iotsecuritysolution_client.go index de9cb63e0647..40bfaaddc4de 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolution_client.go +++ b/sdk/resourcemanager/security/armsecurity/iotsecuritysolution_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -217,7 +218,6 @@ func (client *IotSecuritySolutionClient) getHandleResponse(resp *http.Response) } // NewListByResourceGroupPager - Use this method to get the list IoT Security solutions organized by resource group. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-08-01 // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // options - IotSecuritySolutionClientListByResourceGroupOptions contains the optional parameters for the IotSecuritySolutionClient.ListByResourceGroup @@ -285,7 +285,6 @@ func (client *IotSecuritySolutionClient) listByResourceGroupHandleResponse(resp } // NewListBySubscriptionPager - Use this method to get the list of IoT Security solutions by subscription. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-08-01 // options - IotSecuritySolutionClientListBySubscriptionOptions contains the optional parameters for the IotSecuritySolutionClient.ListBySubscription // method. diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionanalytics_client.go b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionanalytics_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionanalytics_client.go rename to sdk/resourcemanager/security/armsecurity/iotsecuritysolutionanalytics_client.go index 1fad351451b3..22dd8c0fe893 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionanalytics_client.go +++ b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionanalytics_client.go @@ -5,6 +5,7 @@ // 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 armsecurity diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionsanalyticsaggregatedalert_client.go b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsaggregatedalert_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionsanalyticsaggregatedalert_client.go rename to sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsaggregatedalert_client.go index fd65557ea54a..3816afa853b3 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionsanalyticsaggregatedalert_client.go +++ b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsaggregatedalert_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -172,7 +173,6 @@ func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) getHandleRespo } // NewListPager - Use this method to get the aggregated alert list of yours IoT Security solution. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-08-01 // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // solutionName - The name of the IoT Security solution. diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionsanalyticsrecommendation_client.go b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsrecommendation_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionsanalyticsrecommendation_client.go rename to sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsrecommendation_client.go index 83a4ae00be6d..5be04969ed8e 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionsanalyticsrecommendation_client.go +++ b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsrecommendation_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -119,7 +120,6 @@ func (client *IotSecuritySolutionsAnalyticsRecommendationClient) getHandleRespon } // NewListPager - Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-08-01 // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // solutionName - The name of the IoT Security solution. diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_jitnetworkaccesspolicies_client.go b/sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_jitnetworkaccesspolicies_client.go rename to sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client.go index eba670bf5f81..a123d3a7f6bc 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_jitnetworkaccesspolicies_client.go +++ b/sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -295,7 +296,6 @@ func (client *JitNetworkAccessPoliciesClient) initiateHandleResponse(resp *http. } // NewListPager - Policies for protecting resources using Just-in-Time access control. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // options - JitNetworkAccessPoliciesClientListOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.List // method. @@ -355,7 +355,6 @@ func (client *JitNetworkAccessPoliciesClient) listHandleResponse(resp *http.Resp } // NewListByRegionPager - Policies for protecting resources using Just-in-Time access control for the subscription, location -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // options - JitNetworkAccessPoliciesClientListByRegionOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.ListByRegion @@ -421,7 +420,6 @@ func (client *JitNetworkAccessPoliciesClient) listByRegionHandleResponse(resp *h // NewListByResourceGroupPager - Policies for protecting resources using Just-in-Time access control for the subscription, // location -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // options - JitNetworkAccessPoliciesClientListByResourceGroupOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.ListByResourceGroup @@ -487,7 +485,6 @@ func (client *JitNetworkAccessPoliciesClient) listByResourceGroupHandleResponse( // NewListByResourceGroupAndRegionPager - Policies for protecting resources using Just-in-Time access control for the subscription, // location -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_locations_client.go b/sdk/resourcemanager/security/armsecurity/locations_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_locations_client.go rename to sdk/resourcemanager/security/armsecurity/locations_client.go index 0331b4130804..0dadb6cab586 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_locations_client.go +++ b/sdk/resourcemanager/security/armsecurity/locations_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -108,7 +109,6 @@ func (client *LocationsClient) getHandleResponse(resp *http.Response) (Locations // NewListPager - The location of the responsible ASC of the specific subscription (home region). For each subscription there // is only one responsible location. The location in the response should be used to read or // write other resources in ASC according to their ID. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2015-06-01-preview // options - LocationsClientListOptions contains the optional parameters for the LocationsClient.List method. func (client *LocationsClient) NewListPager(options *LocationsClientListOptions) *runtime.Pager[LocationsClientListResponse] { diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_mdeonboardings_client.go b/sdk/resourcemanager/security/armsecurity/mdeonboardings_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_mdeonboardings_client.go rename to sdk/resourcemanager/security/armsecurity/mdeonboardings_client.go index 3489afaf1bec..97c056136dd7 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_mdeonboardings_client.go +++ b/sdk/resourcemanager/security/armsecurity/mdeonboardings_client.go @@ -5,6 +5,7 @@ // 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 armsecurity diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_models.go b/sdk/resourcemanager/security/armsecurity/models.go similarity index 84% rename from sdk/resourcemanager/security/armsecurity/zz_generated_models.go rename to sdk/resourcemanager/security/armsecurity/models.go index cb0d7403ddfc..7f384f52685d 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_models.go +++ b/sdk/resourcemanager/security/armsecurity/models.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -51,6 +52,22 @@ type AADSolutionProperties struct { Workspace *ConnectedWorkspace `json:"workspace,omitempty"` } +// AWSEnvironmentData - The aws connector environment data +type AWSEnvironmentData struct { + // REQUIRED; The type of the environment data. + EnvironmentType *EnvironmentType `json:"environmentType,omitempty"` + + // The AWS account's organizational data + OrganizationalData AwsOrganizationalDataClassification `json:"organizationalData,omitempty"` +} + +// GetEnvironmentData implements the EnvironmentDataClassification interface for type AWSEnvironmentData. +func (a *AWSEnvironmentData) GetEnvironmentData() *EnvironmentData { + return &EnvironmentData{ + EnvironmentType: a.EnvironmentType, + } +} + // AccountConnectorsClientCreateOrUpdateOptions contains the optional parameters for the AccountConnectorsClient.CreateOrUpdate // method. type AccountConnectorsClientCreateOrUpdateOptions struct { @@ -171,8 +188,8 @@ type AdaptiveApplicationControlGroupData struct { SourceSystem *SourceSystem `json:"sourceSystem,omitempty" azure:"ro"` } -// AdaptiveApplicationControlGroups - Represents a list of machine groups and set of rules that are recommended by Azure Security -// Center to be allowed +// AdaptiveApplicationControlGroups - Represents a list of VM/server groups and set of rules that are Recommended by Microsoft +// Defender for Cloud to be allowed type AdaptiveApplicationControlGroups struct { Value []*AdaptiveApplicationControlGroup `json:"value,omitempty"` } @@ -378,6 +395,9 @@ type AlertProperties struct { // Custom properties for the alert. ExtendedProperties map[string]*string `json:"extendedProperties,omitempty"` + // Changing set of properties depending on the supportingEvidence type. + SupportingEvidence *AlertPropertiesSupportingEvidence `json:"supportingEvidence,omitempty"` + // READ-ONLY; The display name of the alert. AlertDisplayName *string `json:"alertDisplayName,omitempty" azure:"ro"` @@ -439,14 +459,32 @@ type AlertProperties struct { // READ-ONLY; The life cycle status of the alert. Status *AlertStatus `json:"status,omitempty" azure:"ro"` + // READ-ONLY; Kill chain related sub-techniques behind the alert. + SubTechniques []*string `json:"subTechniques,omitempty" azure:"ro"` + // READ-ONLY; Unique identifier for the alert. SystemAlertID *string `json:"systemAlertId,omitempty" azure:"ro"` + // READ-ONLY; kill chain related techniques behind the alert. + Techniques []*string `json:"techniques,omitempty" azure:"ro"` + // READ-ONLY; The UTC time the alert was generated in ISO8601 format. TimeGeneratedUTC *time.Time `json:"timeGeneratedUtc,omitempty" azure:"ro"` // READ-ONLY; The name of the vendor that raises the alert. VendorName *string `json:"vendorName,omitempty" azure:"ro"` + + // READ-ONLY; Schema version. + Version *string `json:"version,omitempty" azure:"ro"` +} + +// AlertPropertiesSupportingEvidence - Changing set of properties depending on the supportingEvidence type. +type AlertPropertiesSupportingEvidence struct { + // OPTIONAL; Contains additional key/value pairs not defined in the schema. + AdditionalProperties map[string]interface{} + + // READ-ONLY; Type of the supportingEvidence + Type *string `json:"type,omitempty" azure:"ro"` } // AlertSimulatorBundlesRequestProperties - Simulate alerts according to this bundles. @@ -532,6 +570,12 @@ func (a *AlertSyncSettings) GetSetting() *Setting { } } +// AlertsClientBeginSimulateOptions contains the optional parameters for the AlertsClient.BeginSimulate method. +type AlertsClientBeginSimulateOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // AlertsClientGetResourceGroupLevelOptions contains the optional parameters for the AlertsClient.GetResourceGroupLevel method. type AlertsClientGetResourceGroupLevelOptions struct { // placeholder for future optional parameters @@ -564,11 +608,6 @@ type AlertsClientListSubscriptionLevelByRegionOptions struct { // placeholder for future optional parameters } -// AlertsClientSimulateOptions contains the optional parameters for the AlertsClient.Simulate method. -type AlertsClientSimulateOptions struct { - // placeholder for future optional parameters -} - // AlertsClientUpdateResourceGroupLevelStateToActivateOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToActivate // method. type AlertsClientUpdateResourceGroupLevelStateToActivateOptions struct { @@ -581,6 +620,12 @@ type AlertsClientUpdateResourceGroupLevelStateToDismissOptions struct { // placeholder for future optional parameters } +// AlertsClientUpdateResourceGroupLevelStateToInProgressOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToInProgress +// method. +type AlertsClientUpdateResourceGroupLevelStateToInProgressOptions struct { + // placeholder for future optional parameters +} + // AlertsClientUpdateResourceGroupLevelStateToResolveOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToResolve // method. type AlertsClientUpdateResourceGroupLevelStateToResolveOptions struct { @@ -599,6 +644,12 @@ type AlertsClientUpdateSubscriptionLevelStateToDismissOptions struct { // placeholder for future optional parameters } +// AlertsClientUpdateSubscriptionLevelStateToInProgressOptions contains the optional parameters for the AlertsClient.UpdateSubscriptionLevelStateToInProgress +// method. +type AlertsClientUpdateSubscriptionLevelStateToInProgressOptions struct { + // placeholder for future optional parameters +} + // AlertsClientUpdateSubscriptionLevelStateToResolveOptions contains the optional parameters for the AlertsClient.UpdateSubscriptionLevelStateToResolve // method. type AlertsClientUpdateSubscriptionLevelStateToResolveOptions struct { @@ -962,6 +1013,77 @@ func (a *AmqpD2CMessagesNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeW } } +// Application - Security Application over a given scope +type Application struct { + // Properties of a security application + Properties *ApplicationProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ApplicationClientCreateOrUpdateOptions contains the optional parameters for the ApplicationClient.CreateOrUpdate method. +type ApplicationClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ApplicationClientDeleteOptions contains the optional parameters for the ApplicationClient.Delete method. +type ApplicationClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ApplicationClientGetOptions contains the optional parameters for the ApplicationClient.Get method. +type ApplicationClientGetOptions struct { + // placeholder for future optional parameters +} + +// ApplicationCondition - Application's condition +type ApplicationCondition struct { + // The application Condition's Operator, for example Contains for id or In for list of possible IDs, see examples + Operator *ApplicationConditionOperator `json:"operator,omitempty"` + + // The application Condition's Property, e.g. ID, see examples + Property *string `json:"property,omitempty"` + + // The application Condition's Value like IDs that contain some string, see examples + Value *string `json:"value,omitempty"` +} + +// ApplicationProperties - Describes properties of an application +type ApplicationProperties struct { + // REQUIRED; The application conditionSets - see examples + ConditionSets []interface{} `json:"conditionSets,omitempty"` + + // REQUIRED; The application source, what it affects, e.g. Assessments + SourceResourceType *ApplicationSourceResourceType `json:"sourceResourceType,omitempty"` + + // description of the application + Description *string `json:"description,omitempty"` + + // display name of the application + DisplayName *string `json:"displayName,omitempty"` +} + +// ApplicationsClientListOptions contains the optional parameters for the ApplicationsClient.List method. +type ApplicationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ApplicationsList - Page of a security applications list +type ApplicationsList struct { + // READ-ONLY; The URI to fetch the next page + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; Collection of applications in this page + Value []*Application `json:"value,omitempty" azure:"ro"` +} + // AscLocation - The ASC location of the subscription is in the "name" field type AscLocation struct { // An empty set of properties @@ -1726,6 +1848,72 @@ func (a *AwsCredsAuthenticationDetailsProperties) GetAuthenticationDetailsProper } } +// AwsOrganizationalDataClassification provides polymorphic access to related types. +// Call the interface's GetAwsOrganizationalData() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AwsOrganizationalData, *AwsOrganizationalDataMaster, *AwsOrganizationalDataMember +type AwsOrganizationalDataClassification interface { + // GetAwsOrganizationalData returns the AwsOrganizationalData content of the underlying type. + GetAwsOrganizationalData() *AwsOrganizationalData +} + +// AwsOrganizationalData - The awsOrganization data +type AwsOrganizationalData struct { + // REQUIRED; The multi cloud account's membership type in the organization + OrganizationMembershipType *OrganizationMembershipType `json:"organizationMembershipType,omitempty"` +} + +// GetAwsOrganizationalData implements the AwsOrganizationalDataClassification interface for type AwsOrganizationalData. +func (a *AwsOrganizationalData) GetAwsOrganizationalData() *AwsOrganizationalData { return a } + +// AwsOrganizationalDataMaster - The awsOrganization data for the master account +type AwsOrganizationalDataMaster struct { + // REQUIRED; The multi cloud account's membership type in the organization + OrganizationMembershipType *OrganizationMembershipType `json:"organizationMembershipType,omitempty"` + + // If the multi cloud account is of membership type organization, list of accounts excluded from offering + ExcludedAccountIDs []*string `json:"excludedAccountIds,omitempty"` + + // If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset + StacksetName *string `json:"stacksetName,omitempty"` +} + +// GetAwsOrganizationalData implements the AwsOrganizationalDataClassification interface for type AwsOrganizationalDataMaster. +func (a *AwsOrganizationalDataMaster) GetAwsOrganizationalData() *AwsOrganizationalData { + return &AwsOrganizationalData{ + OrganizationMembershipType: a.OrganizationMembershipType, + } +} + +// AwsOrganizationalDataMember - The awsOrganization data for the member account +type AwsOrganizationalDataMember struct { + // REQUIRED; The multi cloud account's membership type in the organization + OrganizationMembershipType *OrganizationMembershipType `json:"organizationMembershipType,omitempty"` + + // If the multi cloud account is not of membership type organization, this will be the ID of the account's parent + ParentHierarchyID *string `json:"parentHierarchyId,omitempty"` +} + +// GetAwsOrganizationalData implements the AwsOrganizationalDataClassification interface for type AwsOrganizationalDataMember. +func (a *AwsOrganizationalDataMember) GetAwsOrganizationalData() *AwsOrganizationalData { + return &AwsOrganizationalData{ + OrganizationMembershipType: a.OrganizationMembershipType, + } +} + +// AzureDevOpsScopeEnvironmentData - The AzureDevOps scope connector's environment data +type AzureDevOpsScopeEnvironmentData struct { + // REQUIRED; The type of the environment data. + EnvironmentType *EnvironmentType `json:"environmentType,omitempty"` +} + +// GetEnvironmentData implements the EnvironmentDataClassification interface for type AzureDevOpsScopeEnvironmentData. +func (a *AzureDevOpsScopeEnvironmentData) GetEnvironmentData() *EnvironmentData { + return &EnvironmentData{ + EnvironmentType: a.EnvironmentType, + } +} + // AzureResourceDetails - Details of the Azure resource that was assessed type AzureResourceDetails struct { // REQUIRED; The platform where the assessed resource resides @@ -1853,35 +2041,12 @@ type CefSolutionProperties struct { Workspace *ConnectedWorkspace `json:"workspace,omitempty"` } -// CloudError - Common error response for all Azure Resource Manager APIs to return error details for failed operations. (This -// also follows the OData error response format.). -type CloudError struct { - // The error object. - Error *CloudErrorBody `json:"error,omitempty"` -} - -// CloudErrorBody - The error detail. -type CloudErrorBody struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` - - // READ-ONLY; The error code. - Code *string `json:"code,omitempty" azure:"ro"` - - // READ-ONLY; The error details. - Details []*CloudErrorBody `json:"details,omitempty" azure:"ro"` - - // READ-ONLY; The error message. - Message *string `json:"message,omitempty" azure:"ro"` - - // READ-ONLY; The error target. - Target *string `json:"target,omitempty" azure:"ro"` -} - // CloudOfferingClassification provides polymorphic access to related types. // Call the interface's GetCloudOffering() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *CloudOffering, *CspmMonitorAwsOffering, *DefenderForContainersAwsOffering, *DefenderForServersAwsOffering, *InformationProtectionAwsOffering +// - *CloudOffering, *CspmMonitorAwsOffering, *CspmMonitorAzureDevOpsOffering, *CspmMonitorGcpOffering, *CspmMonitorGithubOffering, +// - *DefenderFoDatabasesAwsOffering, *DefenderForContainersAwsOffering, *DefenderForContainersGcpOffering, *DefenderForDatabasesGcpOffering, +// - *DefenderForServersAwsOffering, *DefenderForServersGcpOffering, *InformationProtectionAwsOffering type CloudOfferingClassification interface { // GetCloudOffering returns the CloudOffering content of the underlying type. GetCloudOffering() *CloudOffering @@ -1997,6 +2162,18 @@ type CompliancesClientListOptions struct { // placeholder for future optional parameters } +// Condition - Governance rule's condition +type Condition struct { + // The governance rule Condition's Operator, for example Equals for severity or In for list of assessments, see examples + Operator *GovernanceRuleConditionOperator `json:"operator,omitempty"` + + // The governance rule Condition's Property, e.g. Severity or AssessmentKey, see examples + Property *string `json:"property,omitempty"` + + // The governance rule Condition's Value like severity Low, High or assessments keys, see examples + Value *string `json:"value,omitempty"` +} + // ConnectableResource - Describes the allowed inbound and outbound traffic of an Azure resource type ConnectableResource struct { // READ-ONLY; The Azure resource id @@ -2173,34 +2350,73 @@ type Connector struct { Type *string `json:"type,omitempty" azure:"ro"` } +// ConnectorApplicationClientCreateOrUpdateOptions contains the optional parameters for the ConnectorApplicationClient.CreateOrUpdate +// method. +type ConnectorApplicationClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ConnectorApplicationClientDeleteOptions contains the optional parameters for the ConnectorApplicationClient.Delete method. +type ConnectorApplicationClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ConnectorApplicationClientGetOptions contains the optional parameters for the ConnectorApplicationClient.Get method. +type ConnectorApplicationClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConnectorApplicationsClientListOptions contains the optional parameters for the ConnectorApplicationsClient.List method. +type ConnectorApplicationsClientListOptions struct { + // placeholder for future optional parameters +} + +// ConnectorGovernanceRuleClientListOptions contains the optional parameters for the ConnectorGovernanceRuleClient.List method. +type ConnectorGovernanceRuleClientListOptions struct { + // placeholder for future optional parameters +} + +// ConnectorGovernanceRulesClientCreateOrUpdateOptions contains the optional parameters for the ConnectorGovernanceRulesClient.CreateOrUpdate +// method. +type ConnectorGovernanceRulesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ConnectorGovernanceRulesClientDeleteOptions contains the optional parameters for the ConnectorGovernanceRulesClient.Delete +// method. +type ConnectorGovernanceRulesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ConnectorGovernanceRulesClientGetOptions contains the optional parameters for the ConnectorGovernanceRulesClient.Get method. +type ConnectorGovernanceRulesClientGetOptions struct { + // placeholder for future optional parameters +} + +// ConnectorGovernanceRulesExecuteStatusClientBeginGetOptions contains the optional parameters for the ConnectorGovernanceRulesExecuteStatusClient.BeginGet +// method. +type ConnectorGovernanceRulesExecuteStatusClientBeginGetOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + // ConnectorProperties - A set of properties that defines the security connector configuration. type ConnectorProperties struct { + // The security connector environment data. + EnvironmentData EnvironmentDataClassification `json:"environmentData,omitempty"` + // The multi cloud resource's cloud name. - CloudName *CloudName `json:"cloudName,omitempty"` + EnvironmentName *CloudName `json:"environmentName,omitempty"` - // The multi cloud resource identifier (account id in case of AWS connector). + // The multi cloud resource identifier (account id in case of AWS connector, project number in case of GCP connector). HierarchyIdentifier *string `json:"hierarchyIdentifier,omitempty"` // A collection of offerings for the security connector. Offerings []CloudOfferingClassification `json:"offerings,omitempty"` - // The multi cloud account's organizational data - OrganizationalData *ConnectorPropertiesOrganizationalData `json:"organizationalData,omitempty"` -} - -// ConnectorPropertiesOrganizationalData - The multi cloud account's organizational data -type ConnectorPropertiesOrganizationalData struct { - // If the multi cloud account is of membership type organization, list of accounts excluded from offering - ExcludedAccountIDs []*string `json:"excludedAccountIds,omitempty"` - - // The multi cloud account's membership type in the organization - OrganizationMembershipType *OrganizationMembershipType `json:"organizationMembershipType,omitempty"` - - // If the multi cloud account is not of membership type organization, this will be the ID of the account's parent - ParentHierarchyID *string `json:"parentHierarchyId,omitempty"` - - // If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset - StacksetName *string `json:"stacksetName,omitempty"` + // READ-ONLY; The date on which the trial period will end, if applicable. Trial period exists for 30 days after upgrading + // to payed offerings. + HierarchyIdentifierTrialEndDate *time.Time `json:"hierarchyIdentifierTrialEndDate,omitempty" azure:"ro"` } // ConnectorSetting - The connector setting @@ -2276,7 +2492,7 @@ type ConnectorsList struct { NextLink *string `json:"nextLink,omitempty" azure:"ro"` } -// Contact details for security issues +// Contact details and configurations for notifications coming from Microsoft Defender for Cloud. type Contact struct { // Security contact data Properties *ContactProperties `json:"properties,omitempty"` @@ -2300,21 +2516,43 @@ type ContactList struct { Value []*Contact `json:"value,omitempty" azure:"ro"` } -// ContactProperties - describes security contact properties +// ContactProperties - Describes security contact properties type ContactProperties struct { - // REQUIRED; Whether to send security alerts notifications to the security contact - AlertNotifications *AlertNotifications `json:"alertNotifications,omitempty"` + // Defines whether to send email notifications about new security alerts + AlertNotifications *ContactPropertiesAlertNotifications `json:"alertNotifications,omitempty"` - // REQUIRED; Whether to send security alerts notifications to subscription admins - AlertsToAdmins *AlertsToAdmins `json:"alertsToAdmins,omitempty"` + // List of email addresses which will get notifications from Microsoft Defender for Cloud by the configurations defined in + // this security contact. + Emails *string `json:"emails,omitempty"` - // REQUIRED; The email of this security contact - Email *string `json:"email,omitempty"` + // Defines whether to send email notifications from Microsoft Defender for Cloud to persons with specific RBAC roles on the + // subscription. + NotificationsByRole *ContactPropertiesNotificationsByRole `json:"notificationsByRole,omitempty"` - // The phone number of this security contact + // The security contact's phone number Phone *string `json:"phone,omitempty"` } +// ContactPropertiesAlertNotifications - Defines whether to send email notifications about new security alerts +type ContactPropertiesAlertNotifications struct { + // Defines the minimal alert severity which will be sent as email notifications + MinimalSeverity *MinimalSeverity `json:"minimalSeverity,omitempty"` + + // Defines if email notifications will be sent about new security alerts + State *State `json:"state,omitempty"` +} + +// ContactPropertiesNotificationsByRole - Defines whether to send email notifications from Microsoft Defender for Cloud to +// persons with specific RBAC roles on the subscription. +type ContactPropertiesNotificationsByRole struct { + // Defines which RBAC roles will get email notifications from Microsoft Defender for Cloud. List of allowed RBAC roles: + Roles []*Roles `json:"roles,omitempty"` + + // Defines whether to send email notifications from AMicrosoft Defender for Cloud to persons with specific RBAC roles on the + // subscription. + State *State `json:"state,omitempty"` +} + // ContactsClientCreateOptions contains the optional parameters for the ContactsClient.Create method. type ContactsClientCreateOptions struct { // placeholder for future optional parameters @@ -2335,11 +2573,6 @@ type ContactsClientListOptions struct { // placeholder for future optional parameters } -// ContactsClientUpdateOptions contains the optional parameters for the ContactsClient.Update method. -type ContactsClientUpdateOptions struct { - // placeholder for future optional parameters -} - // ContainerRegistryVulnerabilityProperties - Additional context fields for container registry Vulnerability assessment type ContainerRegistryVulnerabilityProperties struct { // REQUIRED; Sub-assessment resource type @@ -2377,7 +2610,7 @@ func (c *ContainerRegistryVulnerabilityProperties) GetAdditionalData() *Addition } } -// CspmMonitorAwsOffering - The CSPM monitoring for AWS offering configurations +// CspmMonitorAwsOffering - The CSPM monitoring for AWS offering type CspmMonitorAwsOffering struct { // REQUIRED; The type of the security offering. OfferingType *OfferingType `json:"offeringType,omitempty"` @@ -2403,6 +2636,69 @@ type CspmMonitorAwsOfferingNativeCloudConnection struct { CloudRoleArn *string `json:"cloudRoleArn,omitempty"` } +// CspmMonitorAzureDevOpsOffering - The CSPM monitoring for AzureDevOps offering +type CspmMonitorAzureDevOpsOffering struct { + // REQUIRED; The type of the security offering. + OfferingType *OfferingType `json:"offeringType,omitempty"` + + // READ-ONLY; The offering description. + Description *string `json:"description,omitempty" azure:"ro"` +} + +// GetCloudOffering implements the CloudOfferingClassification interface for type CspmMonitorAzureDevOpsOffering. +func (c *CspmMonitorAzureDevOpsOffering) GetCloudOffering() *CloudOffering { + return &CloudOffering{ + OfferingType: c.OfferingType, + Description: c.Description, + } +} + +// CspmMonitorGcpOffering - The CSPM monitoring for GCP offering +type CspmMonitorGcpOffering struct { + // REQUIRED; The type of the security offering. + OfferingType *OfferingType `json:"offeringType,omitempty"` + + // The native cloud connection configuration + NativeCloudConnection *CspmMonitorGcpOfferingNativeCloudConnection `json:"nativeCloudConnection,omitempty"` + + // READ-ONLY; The offering description. + Description *string `json:"description,omitempty" azure:"ro"` +} + +// GetCloudOffering implements the CloudOfferingClassification interface for type CspmMonitorGcpOffering. +func (c *CspmMonitorGcpOffering) GetCloudOffering() *CloudOffering { + return &CloudOffering{ + OfferingType: c.OfferingType, + Description: c.Description, + } +} + +// CspmMonitorGcpOfferingNativeCloudConnection - The native cloud connection configuration +type CspmMonitorGcpOfferingNativeCloudConnection struct { + // The service account email address in GCP for this offering + ServiceAccountEmailAddress *string `json:"serviceAccountEmailAddress,omitempty"` + + // The GCP workload identity provider id for the offering + WorkloadIdentityProviderID *string `json:"workloadIdentityProviderId,omitempty"` +} + +// CspmMonitorGithubOffering - The CSPM monitoring for github offering +type CspmMonitorGithubOffering struct { + // REQUIRED; The type of the security offering. + OfferingType *OfferingType `json:"offeringType,omitempty"` + + // READ-ONLY; The offering description. + Description *string `json:"description,omitempty" azure:"ro"` +} + +// GetCloudOffering implements the CloudOfferingClassification interface for type CspmMonitorGithubOffering. +func (c *CspmMonitorGithubOffering) GetCloudOffering() *CloudOffering { + return &CloudOffering{ + OfferingType: c.OfferingType, + Description: c.Description, + } +} + // CustomAlertRuleClassification provides polymorphic access to related types. // Call the interface's GetCustomAlertRule() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -2665,23 +2961,86 @@ func (d *DataExportSettings) GetSetting() *Setting { } } -// DefenderForContainersAwsOffering - The Defender for Containers AWS offering configurations +// DefenderFoDatabasesAwsOffering - The Defender for Databases AWS offering +type DefenderFoDatabasesAwsOffering struct { + // REQUIRED; The type of the security offering. + OfferingType *OfferingType `json:"offeringType,omitempty"` + + // The ARC autoprovisioning configuration + ArcAutoProvisioning *DefenderFoDatabasesAwsOfferingArcAutoProvisioning `json:"arcAutoProvisioning,omitempty"` + + // READ-ONLY; The offering description. + Description *string `json:"description,omitempty" azure:"ro"` +} + +// GetCloudOffering implements the CloudOfferingClassification interface for type DefenderFoDatabasesAwsOffering. +func (d *DefenderFoDatabasesAwsOffering) GetCloudOffering() *CloudOffering { + return &CloudOffering{ + OfferingType: d.OfferingType, + Description: d.Description, + } +} + +// DefenderFoDatabasesAwsOfferingArcAutoProvisioning - The ARC autoprovisioning configuration +type DefenderFoDatabasesAwsOfferingArcAutoProvisioning struct { + // The cloud role ARN in AWS for this feature + CloudRoleArn *string `json:"cloudRoleArn,omitempty"` + + // Is arc auto provisioning enabled + Enabled *bool `json:"enabled,omitempty"` + + // Metadata of Service Principal secret for autoprovisioning + ServicePrincipalSecretMetadata *DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata `json:"servicePrincipalSecretMetadata,omitempty"` +} + +// DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata - Metadata of Service Principal secret +// for autoprovisioning +type DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata struct { + // expiration date of service principal secret + ExpiryDate *time.Time `json:"expiryDate,omitempty"` + + // name of secret resource in parameter store + ParameterNameInStore *string `json:"parameterNameInStore,omitempty"` + + // region of parameter store where secret is kept + ParameterStoreRegion *string `json:"parameterStoreRegion,omitempty"` +} + +// DefenderForContainersAwsOffering - The Defender for Containers AWS offering type DefenderForContainersAwsOffering struct { // REQUIRED; The type of the security offering. OfferingType *OfferingType `json:"offeringType,omitempty"` + // Is audit logs pipeline auto provisioning enabled + AutoProvisioning *bool `json:"autoProvisioning,omitempty"` + // The cloudwatch to kinesis connection configuration CloudWatchToKinesis *DefenderForContainersAwsOfferingCloudWatchToKinesis `json:"cloudWatchToKinesis,omitempty"` + // The container vulnerability assessment configuration + ContainerVulnerabilityAssessment *DefenderForContainersAwsOfferingContainerVulnerabilityAssessment `json:"containerVulnerabilityAssessment,omitempty"` + + // The container vulnerability assessment task configuration + ContainerVulnerabilityAssessmentTask *DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask `json:"containerVulnerabilityAssessmentTask,omitempty"` + + // Enable container vulnerability assessment feature + EnableContainerVulnerabilityAssessment *bool `json:"enableContainerVulnerabilityAssessment,omitempty"` + // The kinesis to s3 connection configuration KinesisToS3 *DefenderForContainersAwsOfferingKinesisToS3 `json:"kinesisToS3,omitempty"` + // The retention time in days of kube audit logs set on the CloudWatch log group + KubeAuditRetentionTime *int64 `json:"kubeAuditRetentionTime,omitempty"` + // The kubernetes to scuba connection configuration KubernetesScubaReader *DefenderForContainersAwsOfferingKubernetesScubaReader `json:"kubernetesScubaReader,omitempty"` // The kubernetes service connection configuration KubernetesService *DefenderForContainersAwsOfferingKubernetesService `json:"kubernetesService,omitempty"` + // The externalId used by the data reader to prevent the confused deputy attack + ScubaExternalID *string `json:"scubaExternalId,omitempty"` + // READ-ONLY; The offering description. Description *string `json:"description,omitempty" azure:"ro"` } @@ -2696,29 +3055,141 @@ func (d *DefenderForContainersAwsOffering) GetCloudOffering() *CloudOffering { // DefenderForContainersAwsOfferingCloudWatchToKinesis - The cloudwatch to kinesis connection configuration type DefenderForContainersAwsOfferingCloudWatchToKinesis struct { + // The cloud role ARN in AWS used by CloudWatch to transfer data into Kinesis + CloudRoleArn *string `json:"cloudRoleArn,omitempty"` +} + +// DefenderForContainersAwsOfferingContainerVulnerabilityAssessment - The container vulnerability assessment configuration +type DefenderForContainersAwsOfferingContainerVulnerabilityAssessment struct { + // The cloud role ARN in AWS for this feature + CloudRoleArn *string `json:"cloudRoleArn,omitempty"` +} + +// DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask - The container vulnerability assessment task configuration +type DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask struct { // The cloud role ARN in AWS for this feature CloudRoleArn *string `json:"cloudRoleArn,omitempty"` } -// DefenderForContainersAwsOfferingKinesisToS3 - The kinesis to s3 connection configuration -type DefenderForContainersAwsOfferingKinesisToS3 struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string `json:"cloudRoleArn,omitempty"` +// DefenderForContainersAwsOfferingKinesisToS3 - The kinesis to s3 connection configuration +type DefenderForContainersAwsOfferingKinesisToS3 struct { + // The cloud role ARN in AWS used by Kinesis to transfer data into S3 + CloudRoleArn *string `json:"cloudRoleArn,omitempty"` +} + +// DefenderForContainersAwsOfferingKubernetesScubaReader - The kubernetes to scuba connection configuration +type DefenderForContainersAwsOfferingKubernetesScubaReader struct { + // The cloud role ARN in AWS for this feature used for reading data + CloudRoleArn *string `json:"cloudRoleArn,omitempty"` +} + +// DefenderForContainersAwsOfferingKubernetesService - The kubernetes service connection configuration +type DefenderForContainersAwsOfferingKubernetesService struct { + // The cloud role ARN in AWS for this feature used for provisioning resources + CloudRoleArn *string `json:"cloudRoleArn,omitempty"` +} + +// DefenderForContainersGcpOffering - The containers GCP offering +type DefenderForContainersGcpOffering struct { + // REQUIRED; The type of the security offering. + OfferingType *OfferingType `json:"offeringType,omitempty"` + + // Is audit logs data collection enabled + AuditLogsAutoProvisioningFlag *bool `json:"auditLogsAutoProvisioningFlag,omitempty"` + + // The native cloud connection configuration + DataPipelineNativeCloudConnection *DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection `json:"dataPipelineNativeCloudConnection,omitempty"` + + // Is Microsoft Defender for Cloud Kubernetes agent auto provisioning enabled + DefenderAgentAutoProvisioningFlag *bool `json:"defenderAgentAutoProvisioningFlag,omitempty"` + + // The native cloud connection configuration + NativeCloudConnection *DefenderForContainersGcpOfferingNativeCloudConnection `json:"nativeCloudConnection,omitempty"` + + // Is Policy Kubernetes agent auto provisioning enabled + PolicyAgentAutoProvisioningFlag *bool `json:"policyAgentAutoProvisioningFlag,omitempty"` + + // READ-ONLY; The offering description. + Description *string `json:"description,omitempty" azure:"ro"` +} + +// GetCloudOffering implements the CloudOfferingClassification interface for type DefenderForContainersGcpOffering. +func (d *DefenderForContainersGcpOffering) GetCloudOffering() *CloudOffering { + return &CloudOffering{ + OfferingType: d.OfferingType, + Description: d.Description, + } +} + +// DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection - The native cloud connection configuration +type DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection struct { + // The data collection service account email address in GCP for this offering + ServiceAccountEmailAddress *string `json:"serviceAccountEmailAddress,omitempty"` + + // The data collection GCP workload identity provider id for this offering + WorkloadIdentityProviderID *string `json:"workloadIdentityProviderId,omitempty"` +} + +// DefenderForContainersGcpOfferingNativeCloudConnection - The native cloud connection configuration +type DefenderForContainersGcpOfferingNativeCloudConnection struct { + // The service account email address in GCP for this offering + ServiceAccountEmailAddress *string `json:"serviceAccountEmailAddress,omitempty"` + + // The GCP workload identity provider id for this offering + WorkloadIdentityProviderID *string `json:"workloadIdentityProviderId,omitempty"` +} + +// DefenderForDatabasesGcpOffering - The Defender for Databases GCP offering configurations +type DefenderForDatabasesGcpOffering struct { + // REQUIRED; The type of the security offering. + OfferingType *OfferingType `json:"offeringType,omitempty"` + + // The ARC autoprovisioning configuration + ArcAutoProvisioning *DefenderForDatabasesGcpOfferingArcAutoProvisioning `json:"arcAutoProvisioning,omitempty"` + + // The native cloud connection configuration + DefenderForDatabasesArcAutoProvisioning *DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning `json:"defenderForDatabasesArcAutoProvisioning,omitempty"` + + // READ-ONLY; The offering description. + Description *string `json:"description,omitempty" azure:"ro"` +} + +// GetCloudOffering implements the CloudOfferingClassification interface for type DefenderForDatabasesGcpOffering. +func (d *DefenderForDatabasesGcpOffering) GetCloudOffering() *CloudOffering { + return &CloudOffering{ + OfferingType: d.OfferingType, + Description: d.Description, + } +} + +// DefenderForDatabasesGcpOfferingArcAutoProvisioning - The ARC autoprovisioning configuration +type DefenderForDatabasesGcpOfferingArcAutoProvisioning struct { + // Configuration for ARC autoprovisioning + Configuration *DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration `json:"configuration,omitempty"` + + // Is arc auto provisioning enabled + Enabled *bool `json:"enabled,omitempty"` } -// DefenderForContainersAwsOfferingKubernetesScubaReader - The kubernetes to scuba connection configuration -type DefenderForContainersAwsOfferingKubernetesScubaReader struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string `json:"cloudRoleArn,omitempty"` +// DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration - Configuration for ARC autoprovisioning +type DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration struct { + // The agent onboarding service account numeric id + AgentOnboardingServiceAccountNumericID *string `json:"agentOnboardingServiceAccountNumericId,omitempty"` + + // The Azure service principal client id for agent onboarding + ClientID *string `json:"clientId,omitempty"` } -// DefenderForContainersAwsOfferingKubernetesService - The kubernetes service connection configuration -type DefenderForContainersAwsOfferingKubernetesService struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string `json:"cloudRoleArn,omitempty"` +// DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning - The native cloud connection configuration +type DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning struct { + // The service account email address in GCP for this offering + ServiceAccountEmailAddress *string `json:"serviceAccountEmailAddress,omitempty"` + + // The GCP workload identity provider id for this offering + WorkloadIdentityProviderID *string `json:"workloadIdentityProviderId,omitempty"` } -// DefenderForServersAwsOffering - The Defender for Servers AWS offering configurations +// DefenderForServersAwsOffering - The Defender for Servers AWS offering type DefenderForServersAwsOffering struct { // REQUIRED; The type of the security offering. OfferingType *OfferingType `json:"offeringType,omitempty"` @@ -2729,6 +3200,18 @@ type DefenderForServersAwsOffering struct { // The Defender for servers connection configuration DefenderForServers *DefenderForServersAwsOfferingDefenderForServers `json:"defenderForServers,omitempty"` + // The Microsoft Defender for Endpoint autoprovisioning configuration + MdeAutoProvisioning *DefenderForServersAwsOfferingMdeAutoProvisioning `json:"mdeAutoProvisioning,omitempty"` + + // configuration for the servers offering subPlan + SubPlan *DefenderForServersAwsOfferingSubPlan `json:"subPlan,omitempty"` + + // The Microsoft Defender for Server VM scanning configuration + VMScanners *DefenderForServersAwsOfferingVMScanners `json:"vmScanners,omitempty"` + + // The Vulnerability Assessment autoprovisioning configuration + VaAutoProvisioning *DefenderForServersAwsOfferingVaAutoProvisioning `json:"vaAutoProvisioning,omitempty"` + // READ-ONLY; The offering description. Description *string `json:"description,omitempty" azure:"ro"` } @@ -2743,6 +3226,9 @@ func (d *DefenderForServersAwsOffering) GetCloudOffering() *CloudOffering { // DefenderForServersAwsOfferingArcAutoProvisioning - The ARC autoprovisioning configuration type DefenderForServersAwsOfferingArcAutoProvisioning struct { + // The cloud role ARN in AWS for this feature + CloudRoleArn *string `json:"cloudRoleArn,omitempty"` + // Is arc auto provisioning enabled Enabled *bool `json:"enabled,omitempty"` @@ -2769,6 +3255,146 @@ type DefenderForServersAwsOfferingDefenderForServers struct { CloudRoleArn *string `json:"cloudRoleArn,omitempty"` } +// DefenderForServersAwsOfferingMdeAutoProvisioning - The Microsoft Defender for Endpoint autoprovisioning configuration +type DefenderForServersAwsOfferingMdeAutoProvisioning struct { + // configuration for Microsoft Defender for Endpoint autoprovisioning + Configuration interface{} `json:"configuration,omitempty"` + + // Is Microsoft Defender for Endpoint auto provisioning enabled + Enabled *bool `json:"enabled,omitempty"` +} + +// DefenderForServersAwsOfferingSubPlan - configuration for the servers offering subPlan +type DefenderForServersAwsOfferingSubPlan struct { + // The available sub plans + Type *SubPlan `json:"type,omitempty"` +} + +// DefenderForServersAwsOfferingVMScanners - The Microsoft Defender for Server VM scanning configuration +type DefenderForServersAwsOfferingVMScanners struct { + // configuration for Microsoft Defender for Server VM scanning + Configuration *DefenderForServersAwsOfferingVMScannersConfiguration `json:"configuration,omitempty"` + + // Is Microsoft Defender for Server VM scanning enabled + Enabled *bool `json:"enabled,omitempty"` +} + +// DefenderForServersAwsOfferingVMScannersConfiguration - configuration for Microsoft Defender for Server VM scanning +type DefenderForServersAwsOfferingVMScannersConfiguration struct { + // The cloud role ARN in AWS for this feature + CloudRoleArn *string `json:"cloudRoleArn,omitempty"` + + // VM tags that indicates that VM should not be scanned + ExclusionTags interface{} `json:"exclusionTags,omitempty"` + + // The scanning mode for the vm scan. + ScanningMode *ScanningMode `json:"scanningMode,omitempty"` +} + +// DefenderForServersAwsOfferingVaAutoProvisioning - The Vulnerability Assessment autoprovisioning configuration +type DefenderForServersAwsOfferingVaAutoProvisioning struct { + // configuration for Vulnerability Assessment autoprovisioning + Configuration *DefenderForServersAwsOfferingVaAutoProvisioningConfiguration `json:"configuration,omitempty"` + + // Is Vulnerability Assessment auto provisioning enabled + Enabled *bool `json:"enabled,omitempty"` +} + +// DefenderForServersAwsOfferingVaAutoProvisioningConfiguration - configuration for Vulnerability Assessment autoprovisioning +type DefenderForServersAwsOfferingVaAutoProvisioningConfiguration struct { + // The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + Type *Type `json:"type,omitempty"` +} + +// DefenderForServersGcpOffering - The Defender for Servers GCP offering configurations +type DefenderForServersGcpOffering struct { + // REQUIRED; The type of the security offering. + OfferingType *OfferingType `json:"offeringType,omitempty"` + + // The ARC autoprovisioning configuration + ArcAutoProvisioning *DefenderForServersGcpOfferingArcAutoProvisioning `json:"arcAutoProvisioning,omitempty"` + + // The Defender for servers connection configuration + DefenderForServers *DefenderForServersGcpOfferingDefenderForServers `json:"defenderForServers,omitempty"` + + // The Microsoft Defender for Endpoint autoprovisioning configuration + MdeAutoProvisioning *DefenderForServersGcpOfferingMdeAutoProvisioning `json:"mdeAutoProvisioning,omitempty"` + + // configuration for the servers offering subPlan + SubPlan *DefenderForServersGcpOfferingSubPlan `json:"subPlan,omitempty"` + + // The Vulnerability Assessment autoprovisioning configuration + VaAutoProvisioning *DefenderForServersGcpOfferingVaAutoProvisioning `json:"vaAutoProvisioning,omitempty"` + + // READ-ONLY; The offering description. + Description *string `json:"description,omitempty" azure:"ro"` +} + +// GetCloudOffering implements the CloudOfferingClassification interface for type DefenderForServersGcpOffering. +func (d *DefenderForServersGcpOffering) GetCloudOffering() *CloudOffering { + return &CloudOffering{ + OfferingType: d.OfferingType, + Description: d.Description, + } +} + +// DefenderForServersGcpOfferingArcAutoProvisioning - The ARC autoprovisioning configuration +type DefenderForServersGcpOfferingArcAutoProvisioning struct { + // Configuration for ARC autoprovisioning + Configuration *DefenderForServersGcpOfferingArcAutoProvisioningConfiguration `json:"configuration,omitempty"` + + // Is arc auto provisioning enabled + Enabled *bool `json:"enabled,omitempty"` +} + +// DefenderForServersGcpOfferingArcAutoProvisioningConfiguration - Configuration for ARC autoprovisioning +type DefenderForServersGcpOfferingArcAutoProvisioningConfiguration struct { + // The agent onboarding service account numeric id + AgentOnboardingServiceAccountNumericID *string `json:"agentOnboardingServiceAccountNumericId,omitempty"` + + // The Azure service principal client id for agent onboarding + ClientID *string `json:"clientId,omitempty"` +} + +// DefenderForServersGcpOfferingDefenderForServers - The Defender for servers connection configuration +type DefenderForServersGcpOfferingDefenderForServers struct { + // The service account email address in GCP for this feature + ServiceAccountEmailAddress *string `json:"serviceAccountEmailAddress,omitempty"` + + // The workload identity provider id in GCP for this feature + WorkloadIdentityProviderID *string `json:"workloadIdentityProviderId,omitempty"` +} + +// DefenderForServersGcpOfferingMdeAutoProvisioning - The Microsoft Defender for Endpoint autoprovisioning configuration +type DefenderForServersGcpOfferingMdeAutoProvisioning struct { + // configuration for Microsoft Defender for Endpoint autoprovisioning + Configuration interface{} `json:"configuration,omitempty"` + + // Is Microsoft Defender for Endpoint auto provisioning enabled + Enabled *bool `json:"enabled,omitempty"` +} + +// DefenderForServersGcpOfferingSubPlan - configuration for the servers offering subPlan +type DefenderForServersGcpOfferingSubPlan struct { + // The available sub plans + Type *SubPlan `json:"type,omitempty"` +} + +// DefenderForServersGcpOfferingVaAutoProvisioning - The Vulnerability Assessment autoprovisioning configuration +type DefenderForServersGcpOfferingVaAutoProvisioning struct { + // configuration for Vulnerability Assessment autoprovisioning + Configuration *DefenderForServersGcpOfferingVaAutoProvisioningConfiguration `json:"configuration,omitempty"` + + // Is Vulnerability Assessment auto provisioning enabled + Enabled *bool `json:"enabled,omitempty"` +} + +// DefenderForServersGcpOfferingVaAutoProvisioningConfiguration - configuration for Vulnerability Assessment autoprovisioning +type DefenderForServersGcpOfferingVaAutoProvisioningConfiguration struct { + // The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' + Type *Type `json:"type,omitempty"` +} + // DenylistCustomAlertRule - A custom alert rule that checks if a value (depends on the custom alert type) is denied. type DenylistCustomAlertRule struct { // REQUIRED; The values to deny. The format of the values depends on the rule type. @@ -3001,6 +3627,24 @@ type EffectiveNetworkSecurityGroups struct { NetworkSecurityGroups []*string `json:"networkSecurityGroups,omitempty"` } +// EnvironmentDataClassification provides polymorphic access to related types. +// Call the interface's GetEnvironmentData() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AWSEnvironmentData, *AzureDevOpsScopeEnvironmentData, *EnvironmentData, *GcpProjectEnvironmentData, *GithubScopeEnvironmentData +type EnvironmentDataClassification interface { + // GetEnvironmentData returns the EnvironmentData content of the underlying type. + GetEnvironmentData() *EnvironmentData +} + +// EnvironmentData - The security connector environment data. +type EnvironmentData struct { + // REQUIRED; The type of the environment data. + EnvironmentType *EnvironmentType `json:"environmentType,omitempty"` +} + +// GetEnvironmentData implements the EnvironmentDataClassification interface for type EnvironmentData. +func (e *EnvironmentData) GetEnvironmentData() *EnvironmentData { return e } + // ErrorAdditionalInfo - The resource management error additional info. type ErrorAdditionalInfo struct { // READ-ONLY; The additional info. @@ -3010,8 +3654,20 @@ type ErrorAdditionalInfo struct { Type *string `json:"type,omitempty" azure:"ro"` } -// ExternalSecuritySolution - Represents a security solution external to Azure Security Center which sends information to -// an OMS workspace and whose data is displayed by Azure Security Center. +// ExecuteGovernanceRuleParams - Governance rule execution parameters +type ExecuteGovernanceRuleParams struct { + // Describe if governance rule should be override + Override *bool `json:"override,omitempty"` +} + +// ExecuteRuleStatus - Execute status of Security GovernanceRule over a given scope +type ExecuteRuleStatus struct { + // READ-ONLY; Unique key for the execution of GovernanceRule + OperationID *string `json:"operationId,omitempty" azure:"ro"` +} + +// ExternalSecuritySolution - Represents a security solution external to Microsoft Defender for Cloud which sends information +// to an OMS workspace and whose data is displayed by Microsoft Defender for Cloud. type ExternalSecuritySolution struct { // The kind of the external solution Kind *ExternalSecuritySolutionKind `json:"kind,omitempty"` @@ -3245,6 +3901,315 @@ func (g *GcpCredentialsDetailsProperties) GetAuthenticationDetailsProperties() * } } +// GcpOrganizationalDataClassification provides polymorphic access to related types. +// Call the interface's GetGcpOrganizationalData() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *GcpOrganizationalData, *GcpOrganizationalDataMember, *GcpOrganizationalDataOrganization +type GcpOrganizationalDataClassification interface { + // GetGcpOrganizationalData returns the GcpOrganizationalData content of the underlying type. + GetGcpOrganizationalData() *GcpOrganizationalData +} + +// GcpOrganizationalData - The gcpOrganization data +type GcpOrganizationalData struct { + // REQUIRED; The multi cloud account's membership type in the organization + OrganizationMembershipType *OrganizationMembershipType `json:"organizationMembershipType,omitempty"` +} + +// GetGcpOrganizationalData implements the GcpOrganizationalDataClassification interface for type GcpOrganizationalData. +func (g *GcpOrganizationalData) GetGcpOrganizationalData() *GcpOrganizationalData { return g } + +// GcpOrganizationalDataMember - The gcpOrganization data for the member account +type GcpOrganizationalDataMember struct { + // REQUIRED; The multi cloud account's membership type in the organization + OrganizationMembershipType *OrganizationMembershipType `json:"organizationMembershipType,omitempty"` + + // The GCP management project number from organizational onboarding + ManagementProjectNumber *string `json:"managementProjectNumber,omitempty"` + + // If the multi cloud account is not of membership type organization, this will be the ID of the project's parent + ParentHierarchyID *string `json:"parentHierarchyId,omitempty"` +} + +// GetGcpOrganizationalData implements the GcpOrganizationalDataClassification interface for type GcpOrganizationalDataMember. +func (g *GcpOrganizationalDataMember) GetGcpOrganizationalData() *GcpOrganizationalData { + return &GcpOrganizationalData{ + OrganizationMembershipType: g.OrganizationMembershipType, + } +} + +// GcpOrganizationalDataOrganization - The gcpOrganization data for the parent account +type GcpOrganizationalDataOrganization struct { + // REQUIRED; The multi cloud account's membership type in the organization + OrganizationMembershipType *OrganizationMembershipType `json:"organizationMembershipType,omitempty"` + + // If the multi cloud account is of membership type organization, list of accounts excluded from offering + ExcludedProjectNumbers []*string `json:"excludedProjectNumbers,omitempty"` + + // The service account email address which represents the organization level permissions container. + ServiceAccountEmailAddress *string `json:"serviceAccountEmailAddress,omitempty"` + + // The GCP workload identity provider id which represents the permissions required to auto provision security connectors + WorkloadIdentityProviderID *string `json:"workloadIdentityProviderId,omitempty"` +} + +// GetGcpOrganizationalData implements the GcpOrganizationalDataClassification interface for type GcpOrganizationalDataOrganization. +func (g *GcpOrganizationalDataOrganization) GetGcpOrganizationalData() *GcpOrganizationalData { + return &GcpOrganizationalData{ + OrganizationMembershipType: g.OrganizationMembershipType, + } +} + +// GcpProjectDetails - The details about the project represented by the security connector +type GcpProjectDetails struct { + // The GCP Project id + ProjectID *string `json:"projectId,omitempty"` + + // The unique GCP Project number + ProjectNumber *string `json:"projectNumber,omitempty"` + + // READ-ONLY; The GCP workload identity federation pool id + WorkloadIdentityPoolID *string `json:"workloadIdentityPoolId,omitempty" azure:"ro"` +} + +// GcpProjectEnvironmentData - The GCP project connector environment data +type GcpProjectEnvironmentData struct { + // REQUIRED; The type of the environment data. + EnvironmentType *EnvironmentType `json:"environmentType,omitempty"` + + // The Gcp project's organizational data + OrganizationalData GcpOrganizationalDataClassification `json:"organizationalData,omitempty"` + + // The Gcp project's details + ProjectDetails *GcpProjectDetails `json:"projectDetails,omitempty"` +} + +// GetEnvironmentData implements the EnvironmentDataClassification interface for type GcpProjectEnvironmentData. +func (g *GcpProjectEnvironmentData) GetEnvironmentData() *EnvironmentData { + return &EnvironmentData{ + EnvironmentType: g.EnvironmentType, + } +} + +// GithubScopeEnvironmentData - The github scope connector's environment data +type GithubScopeEnvironmentData struct { + // REQUIRED; The type of the environment data. + EnvironmentType *EnvironmentType `json:"environmentType,omitempty"` +} + +// GetEnvironmentData implements the EnvironmentDataClassification interface for type GithubScopeEnvironmentData. +func (g *GithubScopeEnvironmentData) GetEnvironmentData() *EnvironmentData { + return &EnvironmentData{ + EnvironmentType: g.EnvironmentType, + } +} + +// GovernanceAssignment - Security GovernanceAssignment over a given scope +type GovernanceAssignment struct { + // Properties of a security governanceAssignment + Properties *GovernanceAssignmentProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GovernanceAssignmentAdditionalData - Describe the additional data of GovernanceAssignment - optional +type GovernanceAssignmentAdditionalData struct { + // Ticket link associated with this GovernanceAssignment - for example: https://snow.com + TicketLink *string `json:"ticketLink,omitempty"` + + // Ticket number associated with this GovernanceAssignment + TicketNumber *int32 `json:"ticketNumber,omitempty"` + + // The ticket status associated with this GovernanceAssignment - for example: Active + TicketStatus *string `json:"ticketStatus,omitempty"` +} + +// GovernanceAssignmentProperties - Describes properties of an governance assignment +type GovernanceAssignmentProperties struct { + // REQUIRED; The remediation due-date - after this date Secure Score will be affected (in case of active grace-period) + RemediationDueDate *time.Time `json:"remediationDueDate,omitempty"` + + // The additional data for the governance assignment - e.g. links to ticket (optional), see example + AdditionalData *GovernanceAssignmentAdditionalData `json:"additionalData,omitempty"` + + // The email notifications settings for the governance rule, states whether to disable notifications for mangers and owners + GovernanceEmailNotification *GovernanceEmailNotification `json:"governanceEmailNotification,omitempty"` + + // Defines whether there is a grace period on the governance assignment + IsGracePeriod *bool `json:"isGracePeriod,omitempty"` + + // The Owner for the governance assignment - e.g. user@contoso.com - see example + Owner *string `json:"owner,omitempty"` + + // The ETA (estimated time of arrival) for remediation (optional), see example + RemediationEta *RemediationEta `json:"remediationEta,omitempty"` +} + +// GovernanceAssignmentsClientCreateOrUpdateOptions contains the optional parameters for the GovernanceAssignmentsClient.CreateOrUpdate +// method. +type GovernanceAssignmentsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// GovernanceAssignmentsClientDeleteOptions contains the optional parameters for the GovernanceAssignmentsClient.Delete method. +type GovernanceAssignmentsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// GovernanceAssignmentsClientGetOptions contains the optional parameters for the GovernanceAssignmentsClient.Get method. +type GovernanceAssignmentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// GovernanceAssignmentsClientListOptions contains the optional parameters for the GovernanceAssignmentsClient.List method. +type GovernanceAssignmentsClientListOptions struct { + // placeholder for future optional parameters +} + +// GovernanceAssignmentsList - Page of a security governance assignments list +type GovernanceAssignmentsList struct { + // READ-ONLY; The URI to fetch the next page + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; Collection of governance assignments in this page + Value []*GovernanceAssignment `json:"value,omitempty" azure:"ro"` +} + +// GovernanceEmailNotification - The governance email weekly notification configuration. +type GovernanceEmailNotification struct { + // Exclude manager from weekly email notification. + DisableManagerEmailNotification *bool `json:"disableManagerEmailNotification,omitempty"` + + // Exclude owner from weekly email notification. + DisableOwnerEmailNotification *bool `json:"disableOwnerEmailNotification,omitempty"` +} + +// GovernanceRule - Security GovernanceRule over a given scope +type GovernanceRule struct { + // Properties of a security governanceRule + Properties *GovernanceRuleProperties `json:"properties,omitempty"` + + // READ-ONLY; Resource Id + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + +// GovernanceRuleClientListOptions contains the optional parameters for the GovernanceRuleClient.List method. +type GovernanceRuleClientListOptions struct { + // placeholder for future optional parameters +} + +// GovernanceRuleEmailNotification - The governance email weekly notification configuration. +type GovernanceRuleEmailNotification struct { + // Defines whether manager email notifications are disabled. + DisableManagerEmailNotification *bool `json:"disableManagerEmailNotification,omitempty"` + + // Defines whether owner email notifications are disabled. + DisableOwnerEmailNotification *bool `json:"disableOwnerEmailNotification,omitempty"` +} + +// GovernanceRuleList - Page of a security governanceRules list +type GovernanceRuleList struct { + // READ-ONLY; The URI to fetch the next page + NextLink *string `json:"nextLink,omitempty" azure:"ro"` + + // READ-ONLY; Collection of governanceRules in this page + Value []*GovernanceRule `json:"value,omitempty" azure:"ro"` +} + +// GovernanceRuleOwnerSource - Describe the owner source of governance rule +type GovernanceRuleOwnerSource struct { + // The owner type for the governance rule owner source + Type *GovernanceRuleOwnerSourceType `json:"type,omitempty"` + + // The source value e.g. tag key like owner name or email address + Value *string `json:"value,omitempty"` +} + +// GovernanceRuleProperties - Describes properties of an governanceRule +type GovernanceRuleProperties struct { + // REQUIRED; The governance rule conditionSets - see examples + ConditionSets []interface{} `json:"conditionSets,omitempty"` + + // REQUIRED; display name of the governanceRule + DisplayName *string `json:"displayName,omitempty"` + + // REQUIRED; The Owner source for the governance rule - e.g. Manually by user@contoso.com - see example + OwnerSource *GovernanceRuleOwnerSource `json:"ownerSource,omitempty"` + + // REQUIRED; The governance rule priority, priority to the lower number. Rules with the same priority on the same subscription + // will not be allowed + RulePriority *int32 `json:"rulePriority,omitempty"` + + // REQUIRED; The rule type of the governance rule, defines the source of the rule e.g. Integrated + RuleType *GovernanceRuleType `json:"ruleType,omitempty"` + + // REQUIRED; The governance rule source, what the rule affects, e.g. Assessments + SourceResourceType *GovernanceRuleSourceResourceType `json:"sourceResourceType,omitempty"` + + // description of the governanceRule + Description *string `json:"description,omitempty"` + + // The email notifications settings for the governance rule, states whether to disable notifications for mangers and owners + GovernanceEmailNotification *GovernanceRuleEmailNotification `json:"governanceEmailNotification,omitempty"` + + // Defines whether the rule is active/inactive + IsDisabled *bool `json:"isDisabled,omitempty"` + + // Defines whether there is a grace period on the governance rule + IsGracePeriod *bool `json:"isGracePeriod,omitempty"` + + // Governance rule remediation timeframe - this is the time that will affect on the grace-period duration e.g. 7.00:00:00 + // - means 7 days + RemediationTimeframe *string `json:"remediationTimeframe,omitempty"` +} + +// GovernanceRulesClientBeginRuleIDExecuteSingleSecurityConnectorOptions contains the optional parameters for the GovernanceRulesClient.BeginRuleIDExecuteSingleSecurityConnector +// method. +type GovernanceRulesClientBeginRuleIDExecuteSingleSecurityConnectorOptions struct { + // GovernanceRule over a subscription scope + ExecuteGovernanceRuleParams *ExecuteGovernanceRuleParams + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GovernanceRulesClientBeginRuleIDExecuteSingleSubscriptionOptions contains the optional parameters for the GovernanceRulesClient.BeginRuleIDExecuteSingleSubscription +// method. +type GovernanceRulesClientBeginRuleIDExecuteSingleSubscriptionOptions struct { + // GovernanceRule over a subscription scope + ExecuteGovernanceRuleParams *ExecuteGovernanceRuleParams + // Resumes the LRO from the provided token. + ResumeToken string +} + +// GovernanceRulesClientCreateOrUpdateOptions contains the optional parameters for the GovernanceRulesClient.CreateOrUpdate +// method. +type GovernanceRulesClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// GovernanceRulesClientDeleteOptions contains the optional parameters for the GovernanceRulesClient.Delete method. +type GovernanceRulesClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// GovernanceRulesClientGetOptions contains the optional parameters for the GovernanceRulesClient.Get method. +type GovernanceRulesClientGetOptions struct { + // placeholder for future optional parameters +} + // HTTPC2DMessagesNotInAllowedRange - Number of cloud to device messages (HTTP protocol) is not in allowed range. type HTTPC2DMessagesNotInAllowedRange struct { // REQUIRED; Status of the custom alert. @@ -3445,7 +4410,7 @@ type HybridComputeSettingsProperties struct { HybridComputeProvisioningState *HybridComputeProvisioningState `json:"hybridComputeProvisioningState,omitempty" azure:"ro"` } -// InformationProtectionAwsOffering - The information protection for AWS offering configurations +// InformationProtectionAwsOffering - The information protection for AWS offering type InformationProtectionAwsOffering struct { // REQUIRED; The type of the security offering. OfferingType *OfferingType `json:"offeringType,omitempty"` @@ -4753,8 +5718,14 @@ type PricingProperties struct { // a set of security features. When not specified, full plan is applied. SubPlan *string `json:"subPlan,omitempty"` + // READ-ONLY; Optional. True if the plan is deprecated. If there are replacing plans they will appear in replacedBy property + Deprecated *bool `json:"deprecated,omitempty" azure:"ro"` + // READ-ONLY; The duration left for the subscriptions free trial period - in ISO 8601 format (e.g. P3Y6M4DT12H30M5S). FreeTrialRemainingTime *string `json:"freeTrialRemainingTime,omitempty" azure:"ro"` + + // READ-ONLY; Optional. List of plans that replace this plan. This property exists only if this plan is deprecated. + ReplacedBy []*string `json:"replacedBy,omitempty" azure:"ro"` } // PricingsClientGetOptions contains the optional parameters for the PricingsClient.Get method. @@ -5140,6 +6111,15 @@ type Remediation struct { Scripts []*string `json:"scripts,omitempty"` } +// RemediationEta - The ETA (estimated time of arrival) for remediation +type RemediationEta struct { + // REQUIRED; ETA for remediation. + Eta *time.Time `json:"eta,omitempty"` + + // REQUIRED; Justification for change of Eta. + Justification *string `json:"justification,omitempty"` +} + // Resource - Describes an Azure resource. type Resource struct { // READ-ONLY; Resource Id @@ -6064,6 +7044,13 @@ type SubAssessmentsClientListOptions struct { // placeholder for future optional parameters } +// SubscriptionGovernanceRulesExecuteStatusClientBeginGetOptions contains the optional parameters for the SubscriptionGovernanceRulesExecuteStatusClient.BeginGet +// method. +type SubscriptionGovernanceRulesExecuteStatusClientBeginGetOptions struct { + // Resumes the LRO from the provided token. + ResumeToken string +} + type SuppressionAlertsScope struct { // REQUIRED; All the conditions inside need to be true in order to suppress the alert AllOf []*ScopeElement `json:"allOf,omitempty"` diff --git a/sdk/resourcemanager/security/armsecurity/models_serde.go b/sdk/resourcemanager/security/armsecurity/models_serde.go new file mode 100644 index 000000000000..fd7e999379af --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/models_serde.go @@ -0,0 +1,14253 @@ +//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 armsecurity + +import ( + "encoding/json" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "reflect" +) + +// MarshalJSON implements the json.Marshaller interface for type AADConnectivityStateAutoGenerated. +func (a AADConnectivityStateAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectivityState", a.ConnectivityState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AADConnectivityStateAutoGenerated. +func (a *AADConnectivityStateAutoGenerated) 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 "connectivityState": + err = unpopulate(val, "ConnectivityState", &a.ConnectivityState) + 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 AADExternalSecuritySolution. +func (a AADExternalSecuritySolution) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "kind", a.Kind) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AADExternalSecuritySolution. +func (a *AADExternalSecuritySolution) 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 "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + 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 "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 AADSolutionProperties. +func (a AADSolutionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectivityState", a.ConnectivityState) + populate(objectMap, "deviceType", a.DeviceType) + populate(objectMap, "deviceVendor", a.DeviceVendor) + populate(objectMap, "workspace", a.Workspace) + if a.AdditionalProperties != nil { + for key, val := range a.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AADSolutionProperties. +func (a *AADSolutionProperties) 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 "connectivityState": + err = unpopulate(val, "ConnectivityState", &a.ConnectivityState) + delete(rawMsg, key) + case "deviceType": + err = unpopulate(val, "DeviceType", &a.DeviceType) + delete(rawMsg, key) + case "deviceVendor": + err = unpopulate(val, "DeviceVendor", &a.DeviceVendor) + delete(rawMsg, key) + case "workspace": + err = unpopulate(val, "Workspace", &a.Workspace) + delete(rawMsg, key) + default: + if a.AdditionalProperties == nil { + a.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + a.AdditionalProperties[key] = aux + } + 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 AWSEnvironmentData. +func (a AWSEnvironmentData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["environmentType"] = EnvironmentTypeAwsAccount + populate(objectMap, "organizationalData", a.OrganizationalData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AWSEnvironmentData. +func (a *AWSEnvironmentData) 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 "environmentType": + err = unpopulate(val, "EnvironmentType", &a.EnvironmentType) + delete(rawMsg, key) + case "organizationalData": + a.OrganizationalData, err = unmarshalAwsOrganizationalDataClassification(val) + 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 ActiveConnectionsNotInAllowedRange. +func (a ActiveConnectionsNotInAllowedRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "isEnabled", a.IsEnabled) + populate(objectMap, "maxThreshold", a.MaxThreshold) + populate(objectMap, "minThreshold", a.MinThreshold) + objectMap["ruleType"] = "ActiveConnectionsNotInAllowedRange" + populate(objectMap, "timeWindowSize", a.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveConnectionsNotInAllowedRange. +func (a *ActiveConnectionsNotInAllowedRange) 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 "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &a.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &a.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &a.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &a.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &a.TimeWindowSize) + 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 AdaptiveApplicationControlGroup. +func (a AdaptiveApplicationControlGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveApplicationControlGroup. +func (a *AdaptiveApplicationControlGroup) 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 "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + 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 "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 AdaptiveApplicationControlGroupData. +func (a AdaptiveApplicationControlGroupData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configurationStatus", a.ConfigurationStatus) + populate(objectMap, "enforcementMode", a.EnforcementMode) + populate(objectMap, "issues", a.Issues) + populate(objectMap, "pathRecommendations", a.PathRecommendations) + populate(objectMap, "protectionMode", a.ProtectionMode) + populate(objectMap, "recommendationStatus", a.RecommendationStatus) + populate(objectMap, "sourceSystem", a.SourceSystem) + populate(objectMap, "vmRecommendations", a.VMRecommendations) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveApplicationControlGroupData. +func (a *AdaptiveApplicationControlGroupData) 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 "configurationStatus": + err = unpopulate(val, "ConfigurationStatus", &a.ConfigurationStatus) + delete(rawMsg, key) + case "enforcementMode": + err = unpopulate(val, "EnforcementMode", &a.EnforcementMode) + delete(rawMsg, key) + case "issues": + err = unpopulate(val, "Issues", &a.Issues) + delete(rawMsg, key) + case "pathRecommendations": + err = unpopulate(val, "PathRecommendations", &a.PathRecommendations) + delete(rawMsg, key) + case "protectionMode": + err = unpopulate(val, "ProtectionMode", &a.ProtectionMode) + delete(rawMsg, key) + case "recommendationStatus": + err = unpopulate(val, "RecommendationStatus", &a.RecommendationStatus) + delete(rawMsg, key) + case "sourceSystem": + err = unpopulate(val, "SourceSystem", &a.SourceSystem) + delete(rawMsg, key) + case "vmRecommendations": + err = unpopulate(val, "VMRecommendations", &a.VMRecommendations) + 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 AdaptiveApplicationControlGroups. +func (a AdaptiveApplicationControlGroups) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveApplicationControlGroups. +func (a *AdaptiveApplicationControlGroups) 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 "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 AdaptiveApplicationControlIssueSummary. +func (a AdaptiveApplicationControlIssueSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "issue", a.Issue) + populate(objectMap, "numberOfVms", a.NumberOfVMs) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveApplicationControlIssueSummary. +func (a *AdaptiveApplicationControlIssueSummary) 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 "issue": + err = unpopulate(val, "Issue", &a.Issue) + delete(rawMsg, key) + case "numberOfVms": + err = unpopulate(val, "NumberOfVMs", &a.NumberOfVMs) + 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 AdaptiveNetworkHardening. +func (a AdaptiveNetworkHardening) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveNetworkHardening. +func (a *AdaptiveNetworkHardening) 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 "id": + err = unpopulate(val, "ID", &a.ID) + 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 "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 AdaptiveNetworkHardeningEnforceRequest. +func (a AdaptiveNetworkHardeningEnforceRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkSecurityGroups", a.NetworkSecurityGroups) + populate(objectMap, "rules", a.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveNetworkHardeningEnforceRequest. +func (a *AdaptiveNetworkHardeningEnforceRequest) 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 "networkSecurityGroups": + err = unpopulate(val, "NetworkSecurityGroups", &a.NetworkSecurityGroups) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &a.Rules) + 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 AdaptiveNetworkHardeningProperties. +func (a AdaptiveNetworkHardeningProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "effectiveNetworkSecurityGroups", a.EffectiveNetworkSecurityGroups) + populate(objectMap, "rules", a.Rules) + populateTimeRFC3339(objectMap, "rulesCalculationTime", a.RulesCalculationTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveNetworkHardeningProperties. +func (a *AdaptiveNetworkHardeningProperties) 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 "effectiveNetworkSecurityGroups": + err = unpopulate(val, "EffectiveNetworkSecurityGroups", &a.EffectiveNetworkSecurityGroups) + delete(rawMsg, key) + case "rules": + err = unpopulate(val, "Rules", &a.Rules) + delete(rawMsg, key) + case "rulesCalculationTime": + err = unpopulateTimeRFC3339(val, "RulesCalculationTime", &a.RulesCalculationTime) + 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 AdaptiveNetworkHardeningsList. +func (a AdaptiveNetworkHardeningsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveNetworkHardeningsList. +func (a *AdaptiveNetworkHardeningsList) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + 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 AdditionalData. +func (a AdditionalData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["assessedResourceType"] = a.AssessedResourceType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalData. +func (a *AdditionalData) 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 "assessedResourceType": + err = unpopulate(val, "AssessedResourceType", &a.AssessedResourceType) + 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 AdditionalWorkspacesProperties. +func (a AdditionalWorkspacesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "dataTypes", a.DataTypes) + populate(objectMap, "type", a.Type) + populate(objectMap, "workspace", a.Workspace) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalWorkspacesProperties. +func (a *AdditionalWorkspacesProperties) 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 "dataTypes": + err = unpopulate(val, "DataTypes", &a.DataTypes) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + case "workspace": + err = unpopulate(val, "Workspace", &a.Workspace) + 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 AdvancedThreatProtectionProperties. +func (a AdvancedThreatProtectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isEnabled", a.IsEnabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdvancedThreatProtectionProperties. +func (a *AdvancedThreatProtectionProperties) 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 "isEnabled": + err = unpopulate(val, "IsEnabled", &a.IsEnabled) + 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 AdvancedThreatProtectionSetting. +func (a AdvancedThreatProtectionSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AdvancedThreatProtectionSetting. +func (a *AdvancedThreatProtectionSetting) 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 "id": + err = unpopulate(val, "ID", &a.ID) + 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 "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 Alert. +func (a Alert) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Alert. +func (a *Alert) 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 "id": + err = unpopulate(val, "ID", &a.ID) + 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 "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 AlertEntity. +func (a AlertEntity) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", a.Type) + if a.AdditionalProperties != nil { + for key, val := range a.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertEntity. +func (a *AlertEntity) 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 "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + default: + if a.AdditionalProperties == nil { + a.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + a.AdditionalProperties[key] = aux + } + 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 AlertList. +func (a AlertList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertList. +func (a *AlertList) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + 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 AlertProperties. +func (a AlertProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertDisplayName", a.AlertDisplayName) + populate(objectMap, "alertType", a.AlertType) + populate(objectMap, "alertUri", a.AlertURI) + populate(objectMap, "compromisedEntity", a.CompromisedEntity) + populate(objectMap, "correlationKey", a.CorrelationKey) + populate(objectMap, "description", a.Description) + populateTimeRFC3339(objectMap, "endTimeUtc", a.EndTimeUTC) + populate(objectMap, "entities", a.Entities) + populate(objectMap, "extendedLinks", a.ExtendedLinks) + populate(objectMap, "extendedProperties", a.ExtendedProperties) + populate(objectMap, "intent", a.Intent) + populate(objectMap, "isIncident", a.IsIncident) + populateTimeRFC3339(objectMap, "processingEndTimeUtc", a.ProcessingEndTimeUTC) + populate(objectMap, "productComponentName", a.ProductComponentName) + populate(objectMap, "productName", a.ProductName) + populate(objectMap, "remediationSteps", a.RemediationSteps) + populate(objectMap, "resourceIdentifiers", a.ResourceIdentifiers) + populate(objectMap, "severity", a.Severity) + populateTimeRFC3339(objectMap, "startTimeUtc", a.StartTimeUTC) + populate(objectMap, "status", a.Status) + populate(objectMap, "subTechniques", a.SubTechniques) + populate(objectMap, "supportingEvidence", a.SupportingEvidence) + populate(objectMap, "systemAlertId", a.SystemAlertID) + populate(objectMap, "techniques", a.Techniques) + populateTimeRFC3339(objectMap, "timeGeneratedUtc", a.TimeGeneratedUTC) + populate(objectMap, "vendorName", a.VendorName) + populate(objectMap, "version", a.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertProperties. +func (a *AlertProperties) 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 "alertDisplayName": + err = unpopulate(val, "AlertDisplayName", &a.AlertDisplayName) + delete(rawMsg, key) + case "alertType": + err = unpopulate(val, "AlertType", &a.AlertType) + delete(rawMsg, key) + case "alertUri": + err = unpopulate(val, "AlertURI", &a.AlertURI) + delete(rawMsg, key) + case "compromisedEntity": + err = unpopulate(val, "CompromisedEntity", &a.CompromisedEntity) + delete(rawMsg, key) + case "correlationKey": + err = unpopulate(val, "CorrelationKey", &a.CorrelationKey) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "endTimeUtc": + err = unpopulateTimeRFC3339(val, "EndTimeUTC", &a.EndTimeUTC) + delete(rawMsg, key) + case "entities": + err = unpopulate(val, "Entities", &a.Entities) + delete(rawMsg, key) + case "extendedLinks": + err = unpopulate(val, "ExtendedLinks", &a.ExtendedLinks) + delete(rawMsg, key) + case "extendedProperties": + err = unpopulate(val, "ExtendedProperties", &a.ExtendedProperties) + delete(rawMsg, key) + case "intent": + err = unpopulate(val, "Intent", &a.Intent) + delete(rawMsg, key) + case "isIncident": + err = unpopulate(val, "IsIncident", &a.IsIncident) + delete(rawMsg, key) + case "processingEndTimeUtc": + err = unpopulateTimeRFC3339(val, "ProcessingEndTimeUTC", &a.ProcessingEndTimeUTC) + delete(rawMsg, key) + case "productComponentName": + err = unpopulate(val, "ProductComponentName", &a.ProductComponentName) + delete(rawMsg, key) + case "productName": + err = unpopulate(val, "ProductName", &a.ProductName) + delete(rawMsg, key) + case "remediationSteps": + err = unpopulate(val, "RemediationSteps", &a.RemediationSteps) + delete(rawMsg, key) + case "resourceIdentifiers": + a.ResourceIdentifiers, err = unmarshalResourceIdentifierClassificationArray(val) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &a.Severity) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulateTimeRFC3339(val, "StartTimeUTC", &a.StartTimeUTC) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + delete(rawMsg, key) + case "subTechniques": + err = unpopulate(val, "SubTechniques", &a.SubTechniques) + delete(rawMsg, key) + case "supportingEvidence": + err = unpopulate(val, "SupportingEvidence", &a.SupportingEvidence) + delete(rawMsg, key) + case "systemAlertId": + err = unpopulate(val, "SystemAlertID", &a.SystemAlertID) + delete(rawMsg, key) + case "techniques": + err = unpopulate(val, "Techniques", &a.Techniques) + delete(rawMsg, key) + case "timeGeneratedUtc": + err = unpopulateTimeRFC3339(val, "TimeGeneratedUTC", &a.TimeGeneratedUTC) + delete(rawMsg, key) + case "vendorName": + err = unpopulate(val, "VendorName", &a.VendorName) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &a.Version) + 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 AlertPropertiesSupportingEvidence. +func (a AlertPropertiesSupportingEvidence) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", a.Type) + if a.AdditionalProperties != nil { + for key, val := range a.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertPropertiesSupportingEvidence. +func (a *AlertPropertiesSupportingEvidence) 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 "type": + err = unpopulate(val, "Type", &a.Type) + delete(rawMsg, key) + default: + if a.AdditionalProperties == nil { + a.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + a.AdditionalProperties[key] = aux + } + 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 AlertSimulatorBundlesRequestProperties. +func (a AlertSimulatorBundlesRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "bundles", a.Bundles) + objectMap["kind"] = KindBundles + if a.AdditionalProperties != nil { + for key, val := range a.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertSimulatorBundlesRequestProperties. +func (a *AlertSimulatorBundlesRequestProperties) 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 "bundles": + err = unpopulate(val, "Bundles", &a.Bundles) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + default: + if a.AdditionalProperties == nil { + a.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + a.AdditionalProperties[key] = aux + } + 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 AlertSimulatorRequestBody. +func (a AlertSimulatorRequestBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", a.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertSimulatorRequestBody. +func (a *AlertSimulatorRequestBody) 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 "properties": + a.Properties, err = unmarshalAlertSimulatorRequestPropertiesClassification(val) + 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 AlertSimulatorRequestProperties. +func (a AlertSimulatorRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["kind"] = a.Kind + if a.AdditionalProperties != nil { + for key, val := range a.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertSimulatorRequestProperties. +func (a *AlertSimulatorRequestProperties) 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 "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + default: + if a.AdditionalProperties == nil { + a.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + a.AdditionalProperties[key] = aux + } + 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 AlertSyncSettingProperties. +func (a AlertSyncSettingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", a.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertSyncSettingProperties. +func (a *AlertSyncSettingProperties) 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 "enabled": + err = unpopulate(val, "Enabled", &a.Enabled) + 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 AlertSyncSettings. +func (a AlertSyncSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + objectMap["kind"] = SettingKindAlertSyncSettings + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertSyncSettings. +func (a *AlertSyncSettings) 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 "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 "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 AlertsSuppressionRule. +func (a AlertsSuppressionRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertsSuppressionRule. +func (a *AlertsSuppressionRule) 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 "id": + err = unpopulate(val, "ID", &a.ID) + 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 "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 AlertsSuppressionRuleProperties. +func (a AlertsSuppressionRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertType", a.AlertType) + populate(objectMap, "comment", a.Comment) + populateTimeRFC3339(objectMap, "expirationDateUtc", a.ExpirationDateUTC) + populateTimeRFC3339(objectMap, "lastModifiedUtc", a.LastModifiedUTC) + populate(objectMap, "reason", a.Reason) + populate(objectMap, "state", a.State) + populate(objectMap, "suppressionAlertsScope", a.SuppressionAlertsScope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertsSuppressionRuleProperties. +func (a *AlertsSuppressionRuleProperties) 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 "alertType": + err = unpopulate(val, "AlertType", &a.AlertType) + delete(rawMsg, key) + case "comment": + err = unpopulate(val, "Comment", &a.Comment) + delete(rawMsg, key) + case "expirationDateUtc": + err = unpopulateTimeRFC3339(val, "ExpirationDateUTC", &a.ExpirationDateUTC) + delete(rawMsg, key) + case "lastModifiedUtc": + err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &a.LastModifiedUTC) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &a.Reason) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &a.State) + delete(rawMsg, key) + case "suppressionAlertsScope": + err = unpopulate(val, "SuppressionAlertsScope", &a.SuppressionAlertsScope) + 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 AlertsSuppressionRulesList. +func (a AlertsSuppressionRulesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AlertsSuppressionRulesList. +func (a *AlertsSuppressionRulesList) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + 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 AllowedConnectionsList. +func (a AllowedConnectionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AllowedConnectionsList. +func (a *AllowedConnectionsList) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + 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 AllowedConnectionsResource. +func (a AllowedConnectionsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AllowedConnectionsResource. +func (a *AllowedConnectionsResource) 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 "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + 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 "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 AllowedConnectionsResourceProperties. +func (a AllowedConnectionsResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "calculatedDateTime", a.CalculatedDateTime) + populate(objectMap, "connectableResources", a.ConnectableResources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AllowedConnectionsResourceProperties. +func (a *AllowedConnectionsResourceProperties) 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 "calculatedDateTime": + err = unpopulateTimeRFC3339(val, "CalculatedDateTime", &a.CalculatedDateTime) + delete(rawMsg, key) + case "connectableResources": + err = unpopulate(val, "ConnectableResources", &a.ConnectableResources) + 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 AllowlistCustomAlertRule. +func (a AllowlistCustomAlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowlistValues", a.AllowlistValues) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "isEnabled", a.IsEnabled) + objectMap["ruleType"] = "AllowlistCustomAlertRule" + populate(objectMap, "valueType", a.ValueType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AllowlistCustomAlertRule. +func (a *AllowlistCustomAlertRule) 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 "allowlistValues": + err = unpopulate(val, "AllowlistValues", &a.AllowlistValues) + 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 "isEnabled": + err = unpopulate(val, "IsEnabled", &a.IsEnabled) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &a.RuleType) + delete(rawMsg, key) + case "valueType": + err = unpopulate(val, "ValueType", &a.ValueType) + 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 AmqpC2DMessagesNotInAllowedRange. +func (a AmqpC2DMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "isEnabled", a.IsEnabled) + populate(objectMap, "maxThreshold", a.MaxThreshold) + populate(objectMap, "minThreshold", a.MinThreshold) + objectMap["ruleType"] = "AmqpC2DMessagesNotInAllowedRange" + populate(objectMap, "timeWindowSize", a.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AmqpC2DMessagesNotInAllowedRange. +func (a *AmqpC2DMessagesNotInAllowedRange) 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 "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &a.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &a.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &a.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &a.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &a.TimeWindowSize) + 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 AmqpC2DRejectedMessagesNotInAllowedRange. +func (a AmqpC2DRejectedMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "isEnabled", a.IsEnabled) + populate(objectMap, "maxThreshold", a.MaxThreshold) + populate(objectMap, "minThreshold", a.MinThreshold) + objectMap["ruleType"] = "AmqpC2DRejectedMessagesNotInAllowedRange" + populate(objectMap, "timeWindowSize", a.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AmqpC2DRejectedMessagesNotInAllowedRange. +func (a *AmqpC2DRejectedMessagesNotInAllowedRange) 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 "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &a.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &a.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &a.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &a.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &a.TimeWindowSize) + 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 AmqpD2CMessagesNotInAllowedRange. +func (a AmqpD2CMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "isEnabled", a.IsEnabled) + populate(objectMap, "maxThreshold", a.MaxThreshold) + populate(objectMap, "minThreshold", a.MinThreshold) + objectMap["ruleType"] = "AmqpD2CMessagesNotInAllowedRange" + populate(objectMap, "timeWindowSize", a.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AmqpD2CMessagesNotInAllowedRange. +func (a *AmqpD2CMessagesNotInAllowedRange) 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 "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &a.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &a.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &a.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &a.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &a.TimeWindowSize) + 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 Application. +func (a Application) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Application. +func (a *Application) 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 "id": + err = unpopulate(val, "ID", &a.ID) + 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 "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 ApplicationCondition. +func (a ApplicationCondition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "operator", a.Operator) + populate(objectMap, "property", a.Property) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationCondition. +func (a *ApplicationCondition) 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 "operator": + err = unpopulate(val, "Operator", &a.Operator) + delete(rawMsg, key) + case "property": + err = unpopulate(val, "Property", &a.Property) + 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 ApplicationProperties. +func (a ApplicationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "conditionSets", a.ConditionSets) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "sourceResourceType", a.SourceResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationProperties. +func (a *ApplicationProperties) 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 "conditionSets": + err = unpopulate(val, "ConditionSets", &a.ConditionSets) + 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 "sourceResourceType": + err = unpopulate(val, "SourceResourceType", &a.SourceResourceType) + 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 ApplicationsList. +func (a ApplicationsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ApplicationsList. +func (a *ApplicationsList) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + 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 AscLocation. +func (a AscLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", &a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AscLocation. +func (a *AscLocation) 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 "id": + err = unpopulate(val, "ID", &a.ID) + 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 "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 AscLocationList. +func (a AscLocationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AscLocationList. +func (a *AscLocationList) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + 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 Assessment. +func (a Assessment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Assessment. +func (a *Assessment) 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 "id": + err = unpopulate(val, "ID", &a.ID) + 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 "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 AssessmentLinks. +func (a AssessmentLinks) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azurePortalUri", a.AzurePortalURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentLinks. +func (a *AssessmentLinks) 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 "azurePortalUri": + err = unpopulate(val, "AzurePortalURI", &a.AzurePortalURI) + 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 AssessmentList. +func (a AssessmentList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentList. +func (a *AssessmentList) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + 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 AssessmentMetadata. +func (a AssessmentMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentMetadata. +func (a *AssessmentMetadata) 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 "id": + err = unpopulate(val, "ID", &a.ID) + 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 "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 AssessmentMetadataPartnerData. +func (a AssessmentMetadataPartnerData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "partnerName", a.PartnerName) + populate(objectMap, "productName", a.ProductName) + populate(objectMap, "secret", a.Secret) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentMetadataPartnerData. +func (a *AssessmentMetadataPartnerData) 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 "partnerName": + err = unpopulate(val, "PartnerName", &a.PartnerName) + delete(rawMsg, key) + case "productName": + err = unpopulate(val, "ProductName", &a.ProductName) + delete(rawMsg, key) + case "secret": + err = unpopulate(val, "Secret", &a.Secret) + 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 AssessmentMetadataProperties. +func (a AssessmentMetadataProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assessmentType", a.AssessmentType) + populate(objectMap, "categories", a.Categories) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "implementationEffort", a.ImplementationEffort) + populate(objectMap, "partnerData", a.PartnerData) + populate(objectMap, "policyDefinitionId", a.PolicyDefinitionID) + populate(objectMap, "preview", a.Preview) + populate(objectMap, "remediationDescription", a.RemediationDescription) + populate(objectMap, "severity", a.Severity) + populate(objectMap, "threats", a.Threats) + populate(objectMap, "userImpact", a.UserImpact) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentMetadataProperties. +func (a *AssessmentMetadataProperties) 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 "assessmentType": + err = unpopulate(val, "AssessmentType", &a.AssessmentType) + delete(rawMsg, key) + case "categories": + err = unpopulate(val, "Categories", &a.Categories) + 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 "implementationEffort": + err = unpopulate(val, "ImplementationEffort", &a.ImplementationEffort) + delete(rawMsg, key) + case "partnerData": + err = unpopulate(val, "PartnerData", &a.PartnerData) + delete(rawMsg, key) + case "policyDefinitionId": + err = unpopulate(val, "PolicyDefinitionID", &a.PolicyDefinitionID) + delete(rawMsg, key) + case "preview": + err = unpopulate(val, "Preview", &a.Preview) + delete(rawMsg, key) + case "remediationDescription": + err = unpopulate(val, "RemediationDescription", &a.RemediationDescription) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &a.Severity) + delete(rawMsg, key) + case "threats": + err = unpopulate(val, "Threats", &a.Threats) + delete(rawMsg, key) + case "userImpact": + err = unpopulate(val, "UserImpact", &a.UserImpact) + 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 AssessmentMetadataPropertiesResponse. +func (a AssessmentMetadataPropertiesResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assessmentType", a.AssessmentType) + populate(objectMap, "categories", a.Categories) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "implementationEffort", a.ImplementationEffort) + populate(objectMap, "partnerData", a.PartnerData) + populate(objectMap, "plannedDeprecationDate", a.PlannedDeprecationDate) + populate(objectMap, "policyDefinitionId", a.PolicyDefinitionID) + populate(objectMap, "preview", a.Preview) + populate(objectMap, "publishDates", a.PublishDates) + populate(objectMap, "remediationDescription", a.RemediationDescription) + populate(objectMap, "severity", a.Severity) + populate(objectMap, "tactics", a.Tactics) + populate(objectMap, "techniques", a.Techniques) + populate(objectMap, "threats", a.Threats) + populate(objectMap, "userImpact", a.UserImpact) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentMetadataPropertiesResponse. +func (a *AssessmentMetadataPropertiesResponse) 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 "assessmentType": + err = unpopulate(val, "AssessmentType", &a.AssessmentType) + delete(rawMsg, key) + case "categories": + err = unpopulate(val, "Categories", &a.Categories) + 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 "implementationEffort": + err = unpopulate(val, "ImplementationEffort", &a.ImplementationEffort) + delete(rawMsg, key) + case "partnerData": + err = unpopulate(val, "PartnerData", &a.PartnerData) + delete(rawMsg, key) + case "plannedDeprecationDate": + err = unpopulate(val, "PlannedDeprecationDate", &a.PlannedDeprecationDate) + delete(rawMsg, key) + case "policyDefinitionId": + err = unpopulate(val, "PolicyDefinitionID", &a.PolicyDefinitionID) + delete(rawMsg, key) + case "preview": + err = unpopulate(val, "Preview", &a.Preview) + delete(rawMsg, key) + case "publishDates": + err = unpopulate(val, "PublishDates", &a.PublishDates) + delete(rawMsg, key) + case "remediationDescription": + err = unpopulate(val, "RemediationDescription", &a.RemediationDescription) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &a.Severity) + 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) + case "threats": + err = unpopulate(val, "Threats", &a.Threats) + delete(rawMsg, key) + case "userImpact": + err = unpopulate(val, "UserImpact", &a.UserImpact) + 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 AssessmentMetadataPropertiesResponsePublishDates. +func (a AssessmentMetadataPropertiesResponsePublishDates) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "GA", a.GA) + populate(objectMap, "public", a.Public) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentMetadataPropertiesResponsePublishDates. +func (a *AssessmentMetadataPropertiesResponsePublishDates) 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 "GA": + err = unpopulate(val, "GA", &a.GA) + delete(rawMsg, key) + case "public": + err = unpopulate(val, "Public", &a.Public) + 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 AssessmentMetadataResponse. +func (a AssessmentMetadataResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentMetadataResponse. +func (a *AssessmentMetadataResponse) 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 "id": + err = unpopulate(val, "ID", &a.ID) + 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 "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 AssessmentMetadataResponseList. +func (a AssessmentMetadataResponseList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentMetadataResponseList. +func (a *AssessmentMetadataResponseList) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + 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 AssessmentPartnerData. +func (a AssessmentPartnerData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "partnerName", a.PartnerName) + populate(objectMap, "secret", a.Secret) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentPartnerData. +func (a *AssessmentPartnerData) 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 "partnerName": + err = unpopulate(val, "PartnerName", &a.PartnerName) + delete(rawMsg, key) + case "secret": + err = unpopulate(val, "Secret", &a.Secret) + 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 AssessmentProperties. +func (a AssessmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", a.AdditionalData) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "links", a.Links) + populate(objectMap, "metadata", a.Metadata) + populate(objectMap, "partnersData", a.PartnersData) + populate(objectMap, "resourceDetails", a.ResourceDetails) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentProperties. +func (a *AssessmentProperties) 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 "additionalData": + err = unpopulate(val, "AdditionalData", &a.AdditionalData) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "links": + err = unpopulate(val, "Links", &a.Links) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &a.Metadata) + delete(rawMsg, key) + case "partnersData": + err = unpopulate(val, "PartnersData", &a.PartnersData) + delete(rawMsg, key) + case "resourceDetails": + a.ResourceDetails, err = unmarshalResourceDetailsClassification(val) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + 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 AssessmentPropertiesBase. +func (a AssessmentPropertiesBase) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", a.AdditionalData) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "links", a.Links) + populate(objectMap, "metadata", a.Metadata) + populate(objectMap, "partnersData", a.PartnersData) + populate(objectMap, "resourceDetails", a.ResourceDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentPropertiesBase. +func (a *AssessmentPropertiesBase) 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 "additionalData": + err = unpopulate(val, "AdditionalData", &a.AdditionalData) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "links": + err = unpopulate(val, "Links", &a.Links) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &a.Metadata) + delete(rawMsg, key) + case "partnersData": + err = unpopulate(val, "PartnersData", &a.PartnersData) + delete(rawMsg, key) + case "resourceDetails": + a.ResourceDetails, err = unmarshalResourceDetailsClassification(val) + 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 AssessmentPropertiesResponse. +func (a AssessmentPropertiesResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", a.AdditionalData) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "links", a.Links) + populate(objectMap, "metadata", a.Metadata) + populate(objectMap, "partnersData", a.PartnersData) + populate(objectMap, "resourceDetails", a.ResourceDetails) + populate(objectMap, "status", a.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentPropertiesResponse. +func (a *AssessmentPropertiesResponse) 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 "additionalData": + err = unpopulate(val, "AdditionalData", &a.AdditionalData) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &a.DisplayName) + delete(rawMsg, key) + case "links": + err = unpopulate(val, "Links", &a.Links) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &a.Metadata) + delete(rawMsg, key) + case "partnersData": + err = unpopulate(val, "PartnersData", &a.PartnersData) + delete(rawMsg, key) + case "resourceDetails": + a.ResourceDetails, err = unmarshalResourceDetailsClassification(val) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &a.Status) + 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 AssessmentResponse. +func (a AssessmentResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentResponse. +func (a *AssessmentResponse) 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 "id": + err = unpopulate(val, "ID", &a.ID) + 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 "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 AssessmentStatus. +func (a AssessmentStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cause", a.Cause) + populate(objectMap, "code", a.Code) + populate(objectMap, "description", a.Description) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentStatus. +func (a *AssessmentStatus) 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 "cause": + err = unpopulate(val, "Cause", &a.Cause) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &a.Code) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + 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 AssessmentStatusResponse. +func (a AssessmentStatusResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cause", a.Cause) + populate(objectMap, "code", a.Code) + populate(objectMap, "description", a.Description) + populateTimeRFC3339(objectMap, "firstEvaluationDate", a.FirstEvaluationDate) + populateTimeRFC3339(objectMap, "statusChangeDate", a.StatusChangeDate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentStatusResponse. +func (a *AssessmentStatusResponse) 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 "cause": + err = unpopulate(val, "Cause", &a.Cause) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &a.Code) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "firstEvaluationDate": + err = unpopulateTimeRFC3339(val, "FirstEvaluationDate", &a.FirstEvaluationDate) + delete(rawMsg, key) + case "statusChangeDate": + err = unpopulateTimeRFC3339(val, "StatusChangeDate", &a.StatusChangeDate) + 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 AtaExternalSecuritySolution. +func (a AtaExternalSecuritySolution) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "kind", a.Kind) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AtaExternalSecuritySolution. +func (a *AtaExternalSecuritySolution) 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 "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &a.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &a.Location) + 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 "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 AtaSolutionProperties. +func (a AtaSolutionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deviceType", a.DeviceType) + populate(objectMap, "deviceVendor", a.DeviceVendor) + populate(objectMap, "lastEventReceived", a.LastEventReceived) + populate(objectMap, "workspace", a.Workspace) + if a.AdditionalProperties != nil { + for key, val := range a.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AtaSolutionProperties. +func (a *AtaSolutionProperties) 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 "deviceType": + err = unpopulate(val, "DeviceType", &a.DeviceType) + delete(rawMsg, key) + case "deviceVendor": + err = unpopulate(val, "DeviceVendor", &a.DeviceVendor) + delete(rawMsg, key) + case "lastEventReceived": + err = unpopulate(val, "LastEventReceived", &a.LastEventReceived) + delete(rawMsg, key) + case "workspace": + err = unpopulate(val, "Workspace", &a.Workspace) + delete(rawMsg, key) + default: + if a.AdditionalProperties == nil { + a.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + a.AdditionalProperties[key] = aux + } + 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 AuthenticationDetailsProperties. +func (a AuthenticationDetailsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationProvisioningState", a.AuthenticationProvisioningState) + objectMap["authenticationType"] = a.AuthenticationType + populate(objectMap, "grantedPermissions", a.GrantedPermissions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AuthenticationDetailsProperties. +func (a *AuthenticationDetailsProperties) 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 "authenticationProvisioningState": + err = unpopulate(val, "AuthenticationProvisioningState", &a.AuthenticationProvisioningState) + delete(rawMsg, key) + case "authenticationType": + err = unpopulate(val, "AuthenticationType", &a.AuthenticationType) + delete(rawMsg, key) + case "grantedPermissions": + err = unpopulate(val, "GrantedPermissions", &a.GrantedPermissions) + 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 AutoProvisioningSetting. +func (a AutoProvisioningSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoProvisioningSetting. +func (a *AutoProvisioningSetting) 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 "id": + err = unpopulate(val, "ID", &a.ID) + 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 "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 AutoProvisioningSettingList. +func (a AutoProvisioningSettingList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoProvisioningSettingList. +func (a *AutoProvisioningSettingList) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + 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 AutoProvisioningSettingProperties. +func (a AutoProvisioningSettingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoProvision", a.AutoProvision) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutoProvisioningSettingProperties. +func (a *AutoProvisioningSettingProperties) 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 "autoProvision": + err = unpopulate(val, "AutoProvision", &a.AutoProvision) + 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 Automation. +func (a Automation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", a.Etag) + populate(objectMap, "id", a.ID) + populate(objectMap, "kind", a.Kind) + populate(objectMap, "location", a.Location) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Automation. +func (a *Automation) 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 "location": + err = unpopulate(val, "Location", &a.Location) + 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 "tags": + err = unpopulate(val, "Tags", &a.Tags) + 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 AutomationAction. +func (a AutomationAction) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["actionType"] = a.ActionType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationAction. +func (a *AutomationAction) 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 "actionType": + err = unpopulate(val, "ActionType", &a.ActionType) + 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 AutomationActionEventHub. +func (a AutomationActionEventHub) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["actionType"] = ActionTypeEventHub + populate(objectMap, "connectionString", a.ConnectionString) + populate(objectMap, "eventHubResourceId", a.EventHubResourceID) + populate(objectMap, "sasPolicyName", a.SasPolicyName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationActionEventHub. +func (a *AutomationActionEventHub) 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 "actionType": + err = unpopulate(val, "ActionType", &a.ActionType) + delete(rawMsg, key) + case "connectionString": + err = unpopulate(val, "ConnectionString", &a.ConnectionString) + delete(rawMsg, key) + case "eventHubResourceId": + err = unpopulate(val, "EventHubResourceID", &a.EventHubResourceID) + delete(rawMsg, key) + case "sasPolicyName": + err = unpopulate(val, "SasPolicyName", &a.SasPolicyName) + 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 AutomationActionLogicApp. +func (a AutomationActionLogicApp) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["actionType"] = ActionTypeLogicApp + populate(objectMap, "logicAppResourceId", a.LogicAppResourceID) + populate(objectMap, "uri", a.URI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationActionLogicApp. +func (a *AutomationActionLogicApp) 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 "actionType": + err = unpopulate(val, "ActionType", &a.ActionType) + delete(rawMsg, key) + case "logicAppResourceId": + err = unpopulate(val, "LogicAppResourceID", &a.LogicAppResourceID) + delete(rawMsg, key) + case "uri": + err = unpopulate(val, "URI", &a.URI) + 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 AutomationActionWorkspace. +func (a AutomationActionWorkspace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["actionType"] = ActionTypeWorkspace + populate(objectMap, "workspaceResourceId", a.WorkspaceResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationActionWorkspace. +func (a *AutomationActionWorkspace) 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 "actionType": + err = unpopulate(val, "ActionType", &a.ActionType) + delete(rawMsg, key) + case "workspaceResourceId": + err = unpopulate(val, "WorkspaceResourceID", &a.WorkspaceResourceID) + 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 AutomationList. +func (a AutomationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationList. +func (a *AutomationList) 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 "nextLink": + err = unpopulate(val, "NextLink", &a.NextLink) + 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 AutomationProperties. +func (a AutomationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actions", a.Actions) + populate(objectMap, "description", a.Description) + populate(objectMap, "isEnabled", a.IsEnabled) + populate(objectMap, "scopes", a.Scopes) + populate(objectMap, "sources", a.Sources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationProperties. +func (a *AutomationProperties) 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 "actions": + a.Actions, err = unmarshalAutomationActionClassificationArray(val) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &a.IsEnabled) + delete(rawMsg, key) + case "scopes": + err = unpopulate(val, "Scopes", &a.Scopes) + delete(rawMsg, key) + case "sources": + err = unpopulate(val, "Sources", &a.Sources) + 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 AutomationRuleSet. +func (a AutomationRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "rules", a.Rules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationRuleSet. +func (a *AutomationRuleSet) 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 "rules": + err = unpopulate(val, "Rules", &a.Rules) + 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 AutomationScope. +func (a AutomationScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", a.Description) + populate(objectMap, "scopePath", a.ScopePath) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationScope. +func (a *AutomationScope) 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 "description": + err = unpopulate(val, "Description", &a.Description) + delete(rawMsg, key) + case "scopePath": + err = unpopulate(val, "ScopePath", &a.ScopePath) + 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 AutomationSource. +func (a AutomationSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "eventSource", a.EventSource) + populate(objectMap, "ruleSets", a.RuleSets) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationSource. +func (a *AutomationSource) 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 "eventSource": + err = unpopulate(val, "EventSource", &a.EventSource) + delete(rawMsg, key) + case "ruleSets": + err = unpopulate(val, "RuleSets", &a.RuleSets) + 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 AutomationTriggeringRule. +func (a AutomationTriggeringRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "expectedValue", a.ExpectedValue) + populate(objectMap, "operator", a.Operator) + populate(objectMap, "propertyJPath", a.PropertyJPath) + populate(objectMap, "propertyType", a.PropertyType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationTriggeringRule. +func (a *AutomationTriggeringRule) 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 "expectedValue": + err = unpopulate(val, "ExpectedValue", &a.ExpectedValue) + delete(rawMsg, key) + case "operator": + err = unpopulate(val, "Operator", &a.Operator) + delete(rawMsg, key) + case "propertyJPath": + err = unpopulate(val, "PropertyJPath", &a.PropertyJPath) + delete(rawMsg, key) + case "propertyType": + err = unpopulate(val, "PropertyType", &a.PropertyType) + 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 AutomationValidationStatus. +func (a AutomationValidationStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "isValid", a.IsValid) + populate(objectMap, "message", a.Message) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationValidationStatus. +func (a *AutomationValidationStatus) 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 "isValid": + err = unpopulate(val, "IsValid", &a.IsValid) + delete(rawMsg, key) + case "message": + err = unpopulate(val, "Message", &a.Message) + 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 AwAssumeRoleAuthenticationDetailsProperties. +func (a AwAssumeRoleAuthenticationDetailsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountId", a.AccountID) + populate(objectMap, "authenticationProvisioningState", a.AuthenticationProvisioningState) + objectMap["authenticationType"] = AuthenticationTypeAwsAssumeRole + populate(objectMap, "awsAssumeRoleArn", a.AwsAssumeRoleArn) + populate(objectMap, "awsExternalId", a.AwsExternalID) + populate(objectMap, "grantedPermissions", a.GrantedPermissions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwAssumeRoleAuthenticationDetailsProperties. +func (a *AwAssumeRoleAuthenticationDetailsProperties) 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 "accountId": + err = unpopulate(val, "AccountID", &a.AccountID) + delete(rawMsg, key) + case "authenticationProvisioningState": + err = unpopulate(val, "AuthenticationProvisioningState", &a.AuthenticationProvisioningState) + delete(rawMsg, key) + case "authenticationType": + err = unpopulate(val, "AuthenticationType", &a.AuthenticationType) + delete(rawMsg, key) + case "awsAssumeRoleArn": + err = unpopulate(val, "AwsAssumeRoleArn", &a.AwsAssumeRoleArn) + delete(rawMsg, key) + case "awsExternalId": + err = unpopulate(val, "AwsExternalID", &a.AwsExternalID) + delete(rawMsg, key) + case "grantedPermissions": + err = unpopulate(val, "GrantedPermissions", &a.GrantedPermissions) + 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 AwsCredsAuthenticationDetailsProperties. +func (a AwsCredsAuthenticationDetailsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "accountId", a.AccountID) + populate(objectMap, "authenticationProvisioningState", a.AuthenticationProvisioningState) + objectMap["authenticationType"] = AuthenticationTypeAwsCreds + populate(objectMap, "awsAccessKeyId", a.AwsAccessKeyID) + populate(objectMap, "awsSecretAccessKey", a.AwsSecretAccessKey) + populate(objectMap, "grantedPermissions", a.GrantedPermissions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsCredsAuthenticationDetailsProperties. +func (a *AwsCredsAuthenticationDetailsProperties) 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 "accountId": + err = unpopulate(val, "AccountID", &a.AccountID) + delete(rawMsg, key) + case "authenticationProvisioningState": + err = unpopulate(val, "AuthenticationProvisioningState", &a.AuthenticationProvisioningState) + delete(rawMsg, key) + case "authenticationType": + err = unpopulate(val, "AuthenticationType", &a.AuthenticationType) + delete(rawMsg, key) + case "awsAccessKeyId": + err = unpopulate(val, "AwsAccessKeyID", &a.AwsAccessKeyID) + delete(rawMsg, key) + case "awsSecretAccessKey": + err = unpopulate(val, "AwsSecretAccessKey", &a.AwsSecretAccessKey) + delete(rawMsg, key) + case "grantedPermissions": + err = unpopulate(val, "GrantedPermissions", &a.GrantedPermissions) + 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 AwsOrganizationalData. +func (a AwsOrganizationalData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["organizationMembershipType"] = a.OrganizationMembershipType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsOrganizationalData. +func (a *AwsOrganizationalData) 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 "organizationMembershipType": + err = unpopulate(val, "OrganizationMembershipType", &a.OrganizationMembershipType) + 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 AwsOrganizationalDataMaster. +func (a AwsOrganizationalDataMaster) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "excludedAccountIds", a.ExcludedAccountIDs) + objectMap["organizationMembershipType"] = OrganizationMembershipTypeOrganization + populate(objectMap, "stacksetName", a.StacksetName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsOrganizationalDataMaster. +func (a *AwsOrganizationalDataMaster) 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 "excludedAccountIds": + err = unpopulate(val, "ExcludedAccountIDs", &a.ExcludedAccountIDs) + delete(rawMsg, key) + case "organizationMembershipType": + err = unpopulate(val, "OrganizationMembershipType", &a.OrganizationMembershipType) + delete(rawMsg, key) + case "stacksetName": + err = unpopulate(val, "StacksetName", &a.StacksetName) + 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 AwsOrganizationalDataMember. +func (a AwsOrganizationalDataMember) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["organizationMembershipType"] = OrganizationMembershipTypeMember + populate(objectMap, "parentHierarchyId", a.ParentHierarchyID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AwsOrganizationalDataMember. +func (a *AwsOrganizationalDataMember) 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 "organizationMembershipType": + err = unpopulate(val, "OrganizationMembershipType", &a.OrganizationMembershipType) + delete(rawMsg, key) + case "parentHierarchyId": + err = unpopulate(val, "ParentHierarchyID", &a.ParentHierarchyID) + 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 AzureDevOpsScopeEnvironmentData. +func (a AzureDevOpsScopeEnvironmentData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["environmentType"] = EnvironmentTypeAzureDevOpsScope + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDevOpsScopeEnvironmentData. +func (a *AzureDevOpsScopeEnvironmentData) 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 "environmentType": + err = unpopulate(val, "EnvironmentType", &a.EnvironmentType) + 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 AzureResourceDetails. +func (a AzureResourceDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + objectMap["source"] = SourceAzure + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceDetails. +func (a *AzureResourceDetails) 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 "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &a.Source) + 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 AzureResourceIdentifier. +func (a AzureResourceIdentifier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "azureResourceId", a.AzureResourceID) + objectMap["type"] = ResourceIdentifierTypeAzureResource + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceIdentifier. +func (a *AzureResourceIdentifier) 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 "azureResourceId": + err = unpopulate(val, "AzureResourceID", &a.AzureResourceID) + 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 AzureResourceLink. +func (a AzureResourceLink) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", a.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceLink. +func (a *AzureResourceLink) 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 "id": + err = unpopulate(val, "ID", &a.ID) + 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 AzureTrackedResourceLocation. +func (a AzureTrackedResourceLocation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", a.Location) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureTrackedResourceLocation. +func (a *AzureTrackedResourceLocation) 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 "location": + err = unpopulate(val, "Location", &a.Location) + 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 Baseline. +func (b Baseline) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "expectedResults", b.ExpectedResults) + populateTimeRFC3339(objectMap, "updatedTime", b.UpdatedTime) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Baseline. +func (b *Baseline) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "expectedResults": + err = unpopulate(val, "ExpectedResults", &b.ExpectedResults) + delete(rawMsg, key) + case "updatedTime": + err = unpopulateTimeRFC3339(val, "UpdatedTime", &b.UpdatedTime) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BaselineAdjustedResult. +func (b BaselineAdjustedResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "baseline", b.Baseline) + populate(objectMap, "resultsNotInBaseline", b.ResultsNotInBaseline) + populate(objectMap, "resultsOnlyInBaseline", b.ResultsOnlyInBaseline) + populate(objectMap, "status", b.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BaselineAdjustedResult. +func (b *BaselineAdjustedResult) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "baseline": + err = unpopulate(val, "Baseline", &b.Baseline) + delete(rawMsg, key) + case "resultsNotInBaseline": + err = unpopulate(val, "ResultsNotInBaseline", &b.ResultsNotInBaseline) + delete(rawMsg, key) + case "resultsOnlyInBaseline": + err = unpopulate(val, "ResultsOnlyInBaseline", &b.ResultsOnlyInBaseline) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &b.Status) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BenchmarkReference. +func (b BenchmarkReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "benchmark", b.Benchmark) + populate(objectMap, "reference", b.Reference) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BenchmarkReference. +func (b *BenchmarkReference) 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", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "benchmark": + err = unpopulate(val, "Benchmark", &b.Benchmark) + delete(rawMsg, key) + case "reference": + err = unpopulate(val, "Reference", &b.Reference) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CVE. +func (c CVE) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "link", c.Link) + populate(objectMap, "title", c.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CVE. +func (c *CVE) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "link": + err = unpopulate(val, "Link", &c.Link) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &c.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CVSS. +func (c CVSS) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "base", c.Base) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CVSS. +func (c *CVSS) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "base": + err = unpopulate(val, "Base", &c.Base) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CefExternalSecuritySolution. +func (c CefExternalSecuritySolution) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "kind", c.Kind) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CefExternalSecuritySolution. +func (c *CefExternalSecuritySolution) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &c.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CefSolutionProperties. +func (c CefSolutionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "agent", c.Agent) + populate(objectMap, "deviceType", c.DeviceType) + populate(objectMap, "deviceVendor", c.DeviceVendor) + populate(objectMap, "hostname", c.Hostname) + populate(objectMap, "lastEventReceived", c.LastEventReceived) + populate(objectMap, "workspace", c.Workspace) + if c.AdditionalProperties != nil { + for key, val := range c.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CefSolutionProperties. +func (c *CefSolutionProperties) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agent": + err = unpopulate(val, "Agent", &c.Agent) + delete(rawMsg, key) + case "deviceType": + err = unpopulate(val, "DeviceType", &c.DeviceType) + delete(rawMsg, key) + case "deviceVendor": + err = unpopulate(val, "DeviceVendor", &c.DeviceVendor) + delete(rawMsg, key) + case "hostname": + err = unpopulate(val, "Hostname", &c.Hostname) + delete(rawMsg, key) + case "lastEventReceived": + err = unpopulate(val, "LastEventReceived", &c.LastEventReceived) + delete(rawMsg, key) + case "workspace": + err = unpopulate(val, "Workspace", &c.Workspace) + delete(rawMsg, key) + default: + if c.AdditionalProperties == nil { + c.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + c.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CloudOffering. +func (c CloudOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", c.Description) + objectMap["offeringType"] = c.OfferingType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudOffering. +func (c *CloudOffering) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "offeringType": + err = unpopulate(val, "OfferingType", &c.OfferingType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Compliance. +func (c Compliance) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Compliance. +func (c *Compliance) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComplianceList. +func (c ComplianceList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComplianceList. +func (c *ComplianceList) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComplianceProperties. +func (c ComplianceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assessmentResult", c.AssessmentResult) + populateTimeRFC3339(objectMap, "assessmentTimestampUtcDate", c.AssessmentTimestampUTCDate) + populate(objectMap, "resourceCount", c.ResourceCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComplianceProperties. +func (c *ComplianceProperties) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assessmentResult": + err = unpopulate(val, "AssessmentResult", &c.AssessmentResult) + delete(rawMsg, key) + case "assessmentTimestampUtcDate": + err = unpopulateTimeRFC3339(val, "AssessmentTimestampUTCDate", &c.AssessmentTimestampUTCDate) + delete(rawMsg, key) + case "resourceCount": + err = unpopulate(val, "ResourceCount", &c.ResourceCount) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComplianceResult. +func (c ComplianceResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComplianceResult. +func (c *ComplianceResult) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComplianceResultList. +func (c ComplianceResultList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComplianceResultList. +func (c *ComplianceResultList) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComplianceResultProperties. +func (c ComplianceResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "resourceStatus", c.ResourceStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComplianceResultProperties. +func (c *ComplianceResultProperties) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "resourceStatus": + err = unpopulate(val, "ResourceStatus", &c.ResourceStatus) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ComplianceSegment. +func (c ComplianceSegment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "percentage", c.Percentage) + populate(objectMap, "segmentType", c.SegmentType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ComplianceSegment. +func (c *ComplianceSegment) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "percentage": + err = unpopulate(val, "Percentage", &c.Percentage) + delete(rawMsg, key) + case "segmentType": + err = unpopulate(val, "SegmentType", &c.SegmentType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Condition. +func (c Condition) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "operator", c.Operator) + populate(objectMap, "property", c.Property) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Condition. +func (c *Condition) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operator": + err = unpopulate(val, "Operator", &c.Operator) + delete(rawMsg, key) + case "property": + err = unpopulate(val, "Property", &c.Property) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectableResource. +func (c ConnectableResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "inboundConnectedResources", c.InboundConnectedResources) + populate(objectMap, "outboundConnectedResources", c.OutboundConnectedResources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectableResource. +func (c *ConnectableResource) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "inboundConnectedResources": + err = unpopulate(val, "InboundConnectedResources", &c.InboundConnectedResources) + delete(rawMsg, key) + case "outboundConnectedResources": + err = unpopulate(val, "OutboundConnectedResources", &c.OutboundConnectedResources) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectedResource. +func (c ConnectedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "connectedResourceId", c.ConnectedResourceID) + populate(objectMap, "tcpPorts", c.TCPPorts) + populate(objectMap, "udpPorts", c.UDPPorts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedResource. +func (c *ConnectedResource) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "connectedResourceId": + err = unpopulate(val, "ConnectedResourceID", &c.ConnectedResourceID) + delete(rawMsg, key) + case "tcpPorts": + err = unpopulate(val, "TCPPorts", &c.TCPPorts) + delete(rawMsg, key) + case "udpPorts": + err = unpopulate(val, "UDPPorts", &c.UDPPorts) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectedWorkspace. +func (c ConnectedWorkspace) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectedWorkspace. +func (c *ConnectedWorkspace) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionFromIPNotAllowed. +func (c ConnectionFromIPNotAllowed) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowlistValues", c.AllowlistValues) + populate(objectMap, "description", c.Description) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "isEnabled", c.IsEnabled) + objectMap["ruleType"] = "ConnectionFromIpNotAllowed" + populate(objectMap, "valueType", c.ValueType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionFromIPNotAllowed. +func (c *ConnectionFromIPNotAllowed) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowlistValues": + err = unpopulate(val, "AllowlistValues", &c.AllowlistValues) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &c.IsEnabled) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &c.RuleType) + delete(rawMsg, key) + case "valueType": + err = unpopulate(val, "ValueType", &c.ValueType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionStrings. +func (c ConnectionStrings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionStrings. +func (c *ConnectionStrings) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectionToIPNotAllowed. +func (c ConnectionToIPNotAllowed) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowlistValues", c.AllowlistValues) + populate(objectMap, "description", c.Description) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "isEnabled", c.IsEnabled) + objectMap["ruleType"] = "ConnectionToIpNotAllowed" + populate(objectMap, "valueType", c.ValueType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionToIPNotAllowed. +func (c *ConnectionToIPNotAllowed) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowlistValues": + err = unpopulate(val, "AllowlistValues", &c.AllowlistValues) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &c.IsEnabled) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &c.RuleType) + delete(rawMsg, key) + case "valueType": + err = unpopulate(val, "ValueType", &c.ValueType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Connector. +func (c Connector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", c.Etag) + populate(objectMap, "id", c.ID) + populate(objectMap, "kind", c.Kind) + populate(objectMap, "location", c.Location) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "tags", c.Tags) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Connector. +func (c *Connector) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &c.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &c.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &c.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &c.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectorProperties. +func (c ConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "environmentData", c.EnvironmentData) + populate(objectMap, "environmentName", c.EnvironmentName) + populate(objectMap, "hierarchyIdentifier", c.HierarchyIdentifier) + populateTimeRFC3339(objectMap, "hierarchyIdentifierTrialEndDate", c.HierarchyIdentifierTrialEndDate) + populate(objectMap, "offerings", c.Offerings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectorProperties. +func (c *ConnectorProperties) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "environmentData": + c.EnvironmentData, err = unmarshalEnvironmentDataClassification(val) + delete(rawMsg, key) + case "environmentName": + err = unpopulate(val, "EnvironmentName", &c.EnvironmentName) + delete(rawMsg, key) + case "hierarchyIdentifier": + err = unpopulate(val, "HierarchyIdentifier", &c.HierarchyIdentifier) + delete(rawMsg, key) + case "hierarchyIdentifierTrialEndDate": + err = unpopulateTimeRFC3339(val, "HierarchyIdentifierTrialEndDate", &c.HierarchyIdentifierTrialEndDate) + delete(rawMsg, key) + case "offerings": + c.Offerings, err = unmarshalCloudOfferingClassificationArray(val) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectorSetting. +func (c ConnectorSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectorSetting. +func (c *ConnectorSetting) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectorSettingList. +func (c ConnectorSettingList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectorSettingList. +func (c *ConnectorSettingList) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectorSettingProperties. +func (c ConnectorSettingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authenticationDetails", c.AuthenticationDetails) + populate(objectMap, "hybridComputeSettings", c.HybridComputeSettings) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectorSettingProperties. +func (c *ConnectorSettingProperties) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authenticationDetails": + c.AuthenticationDetails, err = unmarshalAuthenticationDetailsPropertiesClassification(val) + delete(rawMsg, key) + case "hybridComputeSettings": + err = unpopulate(val, "HybridComputeSettings", &c.HybridComputeSettings) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ConnectorsList. +func (c ConnectorsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectorsList. +func (c *ConnectorsList) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Contact. +func (c Contact) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Contact. +func (c *Contact) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContactList. +func (c ContactList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactList. +func (c *ContactList) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContactProperties. +func (c ContactProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertNotifications", c.AlertNotifications) + populate(objectMap, "emails", c.Emails) + populate(objectMap, "notificationsByRole", c.NotificationsByRole) + populate(objectMap, "phone", c.Phone) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactProperties. +func (c *ContactProperties) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "alertNotifications": + err = unpopulate(val, "AlertNotifications", &c.AlertNotifications) + delete(rawMsg, key) + case "emails": + err = unpopulate(val, "Emails", &c.Emails) + delete(rawMsg, key) + case "notificationsByRole": + err = unpopulate(val, "NotificationsByRole", &c.NotificationsByRole) + delete(rawMsg, key) + case "phone": + err = unpopulate(val, "Phone", &c.Phone) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContactPropertiesAlertNotifications. +func (c ContactPropertiesAlertNotifications) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "minimalSeverity", c.MinimalSeverity) + populate(objectMap, "state", c.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactPropertiesAlertNotifications. +func (c *ContactPropertiesAlertNotifications) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "minimalSeverity": + err = unpopulate(val, "MinimalSeverity", &c.MinimalSeverity) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &c.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContactPropertiesNotificationsByRole. +func (c ContactPropertiesNotificationsByRole) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "roles", c.Roles) + populate(objectMap, "state", c.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContactPropertiesNotificationsByRole. +func (c *ContactPropertiesNotificationsByRole) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "roles": + err = unpopulate(val, "Roles", &c.Roles) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &c.State) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ContainerRegistryVulnerabilityProperties. +func (c ContainerRegistryVulnerabilityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["assessedResourceType"] = AssessedResourceTypeContainerRegistryVulnerability + populate(objectMap, "cve", c.Cve) + populate(objectMap, "cvss", c.Cvss) + populate(objectMap, "imageDigest", c.ImageDigest) + populate(objectMap, "patchable", c.Patchable) + populateTimeRFC3339(objectMap, "publishedTime", c.PublishedTime) + populate(objectMap, "repositoryName", c.RepositoryName) + populate(objectMap, "type", c.Type) + populate(objectMap, "vendorReferences", c.VendorReferences) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerRegistryVulnerabilityProperties. +func (c *ContainerRegistryVulnerabilityProperties) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assessedResourceType": + err = unpopulate(val, "AssessedResourceType", &c.AssessedResourceType) + delete(rawMsg, key) + case "cve": + err = unpopulate(val, "Cve", &c.Cve) + delete(rawMsg, key) + case "cvss": + err = unpopulate(val, "Cvss", &c.Cvss) + delete(rawMsg, key) + case "imageDigest": + err = unpopulate(val, "ImageDigest", &c.ImageDigest) + delete(rawMsg, key) + case "patchable": + err = unpopulate(val, "Patchable", &c.Patchable) + delete(rawMsg, key) + case "publishedTime": + err = unpopulateTimeRFC3339(val, "PublishedTime", &c.PublishedTime) + delete(rawMsg, key) + case "repositoryName": + err = unpopulate(val, "RepositoryName", &c.RepositoryName) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + case "vendorReferences": + err = unpopulate(val, "VendorReferences", &c.VendorReferences) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CspmMonitorAwsOffering. +func (c CspmMonitorAwsOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", c.Description) + populate(objectMap, "nativeCloudConnection", c.NativeCloudConnection) + objectMap["offeringType"] = OfferingTypeCspmMonitorAws + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorAwsOffering. +func (c *CspmMonitorAwsOffering) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "nativeCloudConnection": + err = unpopulate(val, "NativeCloudConnection", &c.NativeCloudConnection) + delete(rawMsg, key) + case "offeringType": + err = unpopulate(val, "OfferingType", &c.OfferingType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CspmMonitorAwsOfferingNativeCloudConnection. +func (c CspmMonitorAwsOfferingNativeCloudConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cloudRoleArn", c.CloudRoleArn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorAwsOfferingNativeCloudConnection. +func (c *CspmMonitorAwsOfferingNativeCloudConnection) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "cloudRoleArn": + err = unpopulate(val, "CloudRoleArn", &c.CloudRoleArn) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CspmMonitorAzureDevOpsOffering. +func (c CspmMonitorAzureDevOpsOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", c.Description) + objectMap["offeringType"] = OfferingTypeCspmMonitorAzureDevOps + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorAzureDevOpsOffering. +func (c *CspmMonitorAzureDevOpsOffering) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "offeringType": + err = unpopulate(val, "OfferingType", &c.OfferingType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CspmMonitorGcpOffering. +func (c CspmMonitorGcpOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", c.Description) + populate(objectMap, "nativeCloudConnection", c.NativeCloudConnection) + objectMap["offeringType"] = OfferingTypeCspmMonitorGcp + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorGcpOffering. +func (c *CspmMonitorGcpOffering) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "nativeCloudConnection": + err = unpopulate(val, "NativeCloudConnection", &c.NativeCloudConnection) + delete(rawMsg, key) + case "offeringType": + err = unpopulate(val, "OfferingType", &c.OfferingType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CspmMonitorGcpOfferingNativeCloudConnection. +func (c CspmMonitorGcpOfferingNativeCloudConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "serviceAccountEmailAddress", c.ServiceAccountEmailAddress) + populate(objectMap, "workloadIdentityProviderId", c.WorkloadIdentityProviderID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorGcpOfferingNativeCloudConnection. +func (c *CspmMonitorGcpOfferingNativeCloudConnection) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "serviceAccountEmailAddress": + err = unpopulate(val, "ServiceAccountEmailAddress", &c.ServiceAccountEmailAddress) + delete(rawMsg, key) + case "workloadIdentityProviderId": + err = unpopulate(val, "WorkloadIdentityProviderID", &c.WorkloadIdentityProviderID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CspmMonitorGithubOffering. +func (c CspmMonitorGithubOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", c.Description) + objectMap["offeringType"] = OfferingTypeCspmMonitorGithub + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorGithubOffering. +func (c *CspmMonitorGithubOffering) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "offeringType": + err = unpopulate(val, "OfferingType", &c.OfferingType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomAlertRule. +func (c CustomAlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", c.Description) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "isEnabled", c.IsEnabled) + objectMap["ruleType"] = c.RuleType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomAlertRule. +func (c *CustomAlertRule) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &c.IsEnabled) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &c.RuleType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomation. +func (c CustomAssessmentAutomation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomAssessmentAutomation. +func (c *CustomAssessmentAutomation) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomationProperties. +func (c CustomAssessmentAutomationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assessmentKey", c.AssessmentKey) + populate(objectMap, "compressedQuery", c.CompressedQuery) + populate(objectMap, "description", c.Description) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "remediationDescription", c.RemediationDescription) + if c.Severity == nil { + c.Severity = to.Ptr(SeverityEnumLow) + } + populate(objectMap, "severity", c.Severity) + if c.SupportedCloud == nil { + c.SupportedCloud = to.Ptr(SupportedCloudEnumAWS) + } + populate(objectMap, "supportedCloud", c.SupportedCloud) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomAssessmentAutomationProperties. +func (c *CustomAssessmentAutomationProperties) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "assessmentKey": + err = unpopulate(val, "AssessmentKey", &c.AssessmentKey) + delete(rawMsg, key) + case "compressedQuery": + err = unpopulate(val, "CompressedQuery", &c.CompressedQuery) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "remediationDescription": + err = unpopulate(val, "RemediationDescription", &c.RemediationDescription) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &c.Severity) + delete(rawMsg, key) + case "supportedCloud": + err = unpopulate(val, "SupportedCloud", &c.SupportedCloud) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomationRequest. +func (c CustomAssessmentAutomationRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomAssessmentAutomationRequest. +func (c *CustomAssessmentAutomationRequest) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomationRequestProperties. +func (c CustomAssessmentAutomationRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "compressedQuery", c.CompressedQuery) + populate(objectMap, "description", c.Description) + populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "remediationDescription", c.RemediationDescription) + if c.Severity == nil { + c.Severity = to.Ptr(SeverityEnumLow) + } + populate(objectMap, "severity", c.Severity) + if c.SupportedCloud == nil { + c.SupportedCloud = to.Ptr(SupportedCloudEnumAWS) + } + populate(objectMap, "supportedCloud", c.SupportedCloud) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomAssessmentAutomationRequestProperties. +func (c *CustomAssessmentAutomationRequestProperties) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "compressedQuery": + err = unpopulate(val, "CompressedQuery", &c.CompressedQuery) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &c.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &c.DisplayName) + delete(rawMsg, key) + case "remediationDescription": + err = unpopulate(val, "RemediationDescription", &c.RemediationDescription) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &c.Severity) + delete(rawMsg, key) + case "supportedCloud": + err = unpopulate(val, "SupportedCloud", &c.SupportedCloud) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomationsListResult. +func (c CustomAssessmentAutomationsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomAssessmentAutomationsListResult. +func (c *CustomAssessmentAutomationsListResult) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomEntityStoreAssignment. +func (c CustomEntityStoreAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", c.ID) + populate(objectMap, "name", c.Name) + populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) + populate(objectMap, "type", c.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomEntityStoreAssignment. +func (c *CustomEntityStoreAssignment) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &c.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &c.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &c.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &c.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomEntityStoreAssignmentProperties. +func (c CustomEntityStoreAssignmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "entityStoreDatabaseLink", c.EntityStoreDatabaseLink) + populate(objectMap, "principal", c.Principal) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomEntityStoreAssignmentProperties. +func (c *CustomEntityStoreAssignmentProperties) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "entityStoreDatabaseLink": + err = unpopulate(val, "EntityStoreDatabaseLink", &c.EntityStoreDatabaseLink) + delete(rawMsg, key) + case "principal": + err = unpopulate(val, "Principal", &c.Principal) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomEntityStoreAssignmentRequest. +func (c CustomEntityStoreAssignmentRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomEntityStoreAssignmentRequest. +func (c *CustomEntityStoreAssignmentRequest) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomEntityStoreAssignmentRequestProperties. +func (c CustomEntityStoreAssignmentRequestProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "principal", c.Principal) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomEntityStoreAssignmentRequestProperties. +func (c *CustomEntityStoreAssignmentRequestProperties) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "principal": + err = unpopulate(val, "Principal", &c.Principal) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type CustomEntityStoreAssignmentsListResult. +func (c CustomEntityStoreAssignmentsListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomEntityStoreAssignmentsListResult. +func (c *CustomEntityStoreAssignmentsListResult) 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", c, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &c.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", c, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type DataExportSettingProperties. +func (d DataExportSettingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "enabled", d.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataExportSettingProperties. +func (d *DataExportSettingProperties) 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 "enabled": + err = unpopulate(val, "Enabled", &d.Enabled) + 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 DataExportSettings. +func (d DataExportSettings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + objectMap["kind"] = SettingKindDataExportSettings + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DataExportSettings. +func (d *DataExportSettings) 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 "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + 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 DefenderFoDatabasesAwsOffering. +func (d DefenderFoDatabasesAwsOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "arcAutoProvisioning", d.ArcAutoProvisioning) + populate(objectMap, "description", d.Description) + objectMap["offeringType"] = OfferingTypeDefenderForDatabasesAws + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderFoDatabasesAwsOffering. +func (d *DefenderFoDatabasesAwsOffering) 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 "arcAutoProvisioning": + err = unpopulate(val, "ArcAutoProvisioning", &d.ArcAutoProvisioning) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "offeringType": + err = unpopulate(val, "OfferingType", &d.OfferingType) + 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 DefenderFoDatabasesAwsOfferingArcAutoProvisioning. +func (d DefenderFoDatabasesAwsOfferingArcAutoProvisioning) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cloudRoleArn", d.CloudRoleArn) + populate(objectMap, "enabled", d.Enabled) + populate(objectMap, "servicePrincipalSecretMetadata", d.ServicePrincipalSecretMetadata) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderFoDatabasesAwsOfferingArcAutoProvisioning. +func (d *DefenderFoDatabasesAwsOfferingArcAutoProvisioning) 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 "cloudRoleArn": + err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &d.Enabled) + delete(rawMsg, key) + case "servicePrincipalSecretMetadata": + err = unpopulate(val, "ServicePrincipalSecretMetadata", &d.ServicePrincipalSecretMetadata) + 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 DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata. +func (d DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "expiryDate", d.ExpiryDate) + populate(objectMap, "parameterNameInStore", d.ParameterNameInStore) + populate(objectMap, "parameterStoreRegion", d.ParameterStoreRegion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata. +func (d *DefenderFoDatabasesAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata) 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 "expiryDate": + err = unpopulateTimeRFC3339(val, "ExpiryDate", &d.ExpiryDate) + delete(rawMsg, key) + case "parameterNameInStore": + err = unpopulate(val, "ParameterNameInStore", &d.ParameterNameInStore) + delete(rawMsg, key) + case "parameterStoreRegion": + err = unpopulate(val, "ParameterStoreRegion", &d.ParameterStoreRegion) + 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 DefenderForContainersAwsOffering. +func (d DefenderForContainersAwsOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoProvisioning", d.AutoProvisioning) + populate(objectMap, "cloudWatchToKinesis", d.CloudWatchToKinesis) + populate(objectMap, "containerVulnerabilityAssessment", d.ContainerVulnerabilityAssessment) + populate(objectMap, "containerVulnerabilityAssessmentTask", d.ContainerVulnerabilityAssessmentTask) + populate(objectMap, "description", d.Description) + populate(objectMap, "enableContainerVulnerabilityAssessment", d.EnableContainerVulnerabilityAssessment) + populate(objectMap, "kinesisToS3", d.KinesisToS3) + populate(objectMap, "kubeAuditRetentionTime", d.KubeAuditRetentionTime) + populate(objectMap, "kubernetesScubaReader", d.KubernetesScubaReader) + populate(objectMap, "kubernetesService", d.KubernetesService) + objectMap["offeringType"] = OfferingTypeDefenderForContainersAws + populate(objectMap, "scubaExternalId", d.ScubaExternalID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersAwsOffering. +func (d *DefenderForContainersAwsOffering) 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 "autoProvisioning": + err = unpopulate(val, "AutoProvisioning", &d.AutoProvisioning) + delete(rawMsg, key) + case "cloudWatchToKinesis": + err = unpopulate(val, "CloudWatchToKinesis", &d.CloudWatchToKinesis) + delete(rawMsg, key) + case "containerVulnerabilityAssessment": + err = unpopulate(val, "ContainerVulnerabilityAssessment", &d.ContainerVulnerabilityAssessment) + delete(rawMsg, key) + case "containerVulnerabilityAssessmentTask": + err = unpopulate(val, "ContainerVulnerabilityAssessmentTask", &d.ContainerVulnerabilityAssessmentTask) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "enableContainerVulnerabilityAssessment": + err = unpopulate(val, "EnableContainerVulnerabilityAssessment", &d.EnableContainerVulnerabilityAssessment) + delete(rawMsg, key) + case "kinesisToS3": + err = unpopulate(val, "KinesisToS3", &d.KinesisToS3) + delete(rawMsg, key) + case "kubeAuditRetentionTime": + err = unpopulate(val, "KubeAuditRetentionTime", &d.KubeAuditRetentionTime) + delete(rawMsg, key) + case "kubernetesScubaReader": + err = unpopulate(val, "KubernetesScubaReader", &d.KubernetesScubaReader) + delete(rawMsg, key) + case "kubernetesService": + err = unpopulate(val, "KubernetesService", &d.KubernetesService) + delete(rawMsg, key) + case "offeringType": + err = unpopulate(val, "OfferingType", &d.OfferingType) + delete(rawMsg, key) + case "scubaExternalId": + err = unpopulate(val, "ScubaExternalID", &d.ScubaExternalID) + 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 DefenderForContainersAwsOfferingCloudWatchToKinesis. +func (d DefenderForContainersAwsOfferingCloudWatchToKinesis) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cloudRoleArn", d.CloudRoleArn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersAwsOfferingCloudWatchToKinesis. +func (d *DefenderForContainersAwsOfferingCloudWatchToKinesis) 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 "cloudRoleArn": + err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) + 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 DefenderForContainersAwsOfferingContainerVulnerabilityAssessment. +func (d DefenderForContainersAwsOfferingContainerVulnerabilityAssessment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cloudRoleArn", d.CloudRoleArn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersAwsOfferingContainerVulnerabilityAssessment. +func (d *DefenderForContainersAwsOfferingContainerVulnerabilityAssessment) 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 "cloudRoleArn": + err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) + 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 DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask. +func (d DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cloudRoleArn", d.CloudRoleArn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask. +func (d *DefenderForContainersAwsOfferingContainerVulnerabilityAssessmentTask) 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 "cloudRoleArn": + err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) + 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 DefenderForContainersAwsOfferingKinesisToS3. +func (d DefenderForContainersAwsOfferingKinesisToS3) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cloudRoleArn", d.CloudRoleArn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersAwsOfferingKinesisToS3. +func (d *DefenderForContainersAwsOfferingKinesisToS3) 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 "cloudRoleArn": + err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) + 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 DefenderForContainersAwsOfferingKubernetesScubaReader. +func (d DefenderForContainersAwsOfferingKubernetesScubaReader) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cloudRoleArn", d.CloudRoleArn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersAwsOfferingKubernetesScubaReader. +func (d *DefenderForContainersAwsOfferingKubernetesScubaReader) 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 "cloudRoleArn": + err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) + 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 DefenderForContainersAwsOfferingKubernetesService. +func (d DefenderForContainersAwsOfferingKubernetesService) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cloudRoleArn", d.CloudRoleArn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersAwsOfferingKubernetesService. +func (d *DefenderForContainersAwsOfferingKubernetesService) 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 "cloudRoleArn": + err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) + 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 DefenderForContainersGcpOffering. +func (d DefenderForContainersGcpOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "auditLogsAutoProvisioningFlag", d.AuditLogsAutoProvisioningFlag) + populate(objectMap, "dataPipelineNativeCloudConnection", d.DataPipelineNativeCloudConnection) + populate(objectMap, "defenderAgentAutoProvisioningFlag", d.DefenderAgentAutoProvisioningFlag) + populate(objectMap, "description", d.Description) + populate(objectMap, "nativeCloudConnection", d.NativeCloudConnection) + objectMap["offeringType"] = OfferingTypeDefenderForContainersGcp + populate(objectMap, "policyAgentAutoProvisioningFlag", d.PolicyAgentAutoProvisioningFlag) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersGcpOffering. +func (d *DefenderForContainersGcpOffering) 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 "auditLogsAutoProvisioningFlag": + err = unpopulate(val, "AuditLogsAutoProvisioningFlag", &d.AuditLogsAutoProvisioningFlag) + delete(rawMsg, key) + case "dataPipelineNativeCloudConnection": + err = unpopulate(val, "DataPipelineNativeCloudConnection", &d.DataPipelineNativeCloudConnection) + delete(rawMsg, key) + case "defenderAgentAutoProvisioningFlag": + err = unpopulate(val, "DefenderAgentAutoProvisioningFlag", &d.DefenderAgentAutoProvisioningFlag) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "nativeCloudConnection": + err = unpopulate(val, "NativeCloudConnection", &d.NativeCloudConnection) + delete(rawMsg, key) + case "offeringType": + err = unpopulate(val, "OfferingType", &d.OfferingType) + delete(rawMsg, key) + case "policyAgentAutoProvisioningFlag": + err = unpopulate(val, "PolicyAgentAutoProvisioningFlag", &d.PolicyAgentAutoProvisioningFlag) + 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 DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection. +func (d DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "serviceAccountEmailAddress", d.ServiceAccountEmailAddress) + populate(objectMap, "workloadIdentityProviderId", d.WorkloadIdentityProviderID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection. +func (d *DefenderForContainersGcpOfferingDataPipelineNativeCloudConnection) 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 "serviceAccountEmailAddress": + err = unpopulate(val, "ServiceAccountEmailAddress", &d.ServiceAccountEmailAddress) + delete(rawMsg, key) + case "workloadIdentityProviderId": + err = unpopulate(val, "WorkloadIdentityProviderID", &d.WorkloadIdentityProviderID) + 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 DefenderForContainersGcpOfferingNativeCloudConnection. +func (d DefenderForContainersGcpOfferingNativeCloudConnection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "serviceAccountEmailAddress", d.ServiceAccountEmailAddress) + populate(objectMap, "workloadIdentityProviderId", d.WorkloadIdentityProviderID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersGcpOfferingNativeCloudConnection. +func (d *DefenderForContainersGcpOfferingNativeCloudConnection) 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 "serviceAccountEmailAddress": + err = unpopulate(val, "ServiceAccountEmailAddress", &d.ServiceAccountEmailAddress) + delete(rawMsg, key) + case "workloadIdentityProviderId": + err = unpopulate(val, "WorkloadIdentityProviderID", &d.WorkloadIdentityProviderID) + 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 DefenderForDatabasesGcpOffering. +func (d DefenderForDatabasesGcpOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "arcAutoProvisioning", d.ArcAutoProvisioning) + populate(objectMap, "defenderForDatabasesArcAutoProvisioning", d.DefenderForDatabasesArcAutoProvisioning) + populate(objectMap, "description", d.Description) + objectMap["offeringType"] = OfferingTypeDefenderForDatabasesGcp + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForDatabasesGcpOffering. +func (d *DefenderForDatabasesGcpOffering) 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 "arcAutoProvisioning": + err = unpopulate(val, "ArcAutoProvisioning", &d.ArcAutoProvisioning) + delete(rawMsg, key) + case "defenderForDatabasesArcAutoProvisioning": + err = unpopulate(val, "DefenderForDatabasesArcAutoProvisioning", &d.DefenderForDatabasesArcAutoProvisioning) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "offeringType": + err = unpopulate(val, "OfferingType", &d.OfferingType) + 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 DefenderForDatabasesGcpOfferingArcAutoProvisioning. +func (d DefenderForDatabasesGcpOfferingArcAutoProvisioning) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configuration", d.Configuration) + populate(objectMap, "enabled", d.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForDatabasesGcpOfferingArcAutoProvisioning. +func (d *DefenderForDatabasesGcpOfferingArcAutoProvisioning) 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 "configuration": + err = unpopulate(val, "Configuration", &d.Configuration) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &d.Enabled) + 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 DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration. +func (d DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "agentOnboardingServiceAccountNumericId", d.AgentOnboardingServiceAccountNumericID) + populate(objectMap, "clientId", d.ClientID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration. +func (d *DefenderForDatabasesGcpOfferingArcAutoProvisioningConfiguration) 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 "agentOnboardingServiceAccountNumericId": + err = unpopulate(val, "AgentOnboardingServiceAccountNumericID", &d.AgentOnboardingServiceAccountNumericID) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &d.ClientID) + 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 DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning. +func (d DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "serviceAccountEmailAddress", d.ServiceAccountEmailAddress) + populate(objectMap, "workloadIdentityProviderId", d.WorkloadIdentityProviderID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning. +func (d *DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning) 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 "serviceAccountEmailAddress": + err = unpopulate(val, "ServiceAccountEmailAddress", &d.ServiceAccountEmailAddress) + delete(rawMsg, key) + case "workloadIdentityProviderId": + err = unpopulate(val, "WorkloadIdentityProviderID", &d.WorkloadIdentityProviderID) + 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 DefenderForServersAwsOffering. +func (d DefenderForServersAwsOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "arcAutoProvisioning", d.ArcAutoProvisioning) + populate(objectMap, "defenderForServers", d.DefenderForServers) + populate(objectMap, "description", d.Description) + populate(objectMap, "mdeAutoProvisioning", d.MdeAutoProvisioning) + objectMap["offeringType"] = OfferingTypeDefenderForServersAws + populate(objectMap, "subPlan", d.SubPlan) + populate(objectMap, "vmScanners", d.VMScanners) + populate(objectMap, "vaAutoProvisioning", d.VaAutoProvisioning) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOffering. +func (d *DefenderForServersAwsOffering) 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 "arcAutoProvisioning": + err = unpopulate(val, "ArcAutoProvisioning", &d.ArcAutoProvisioning) + delete(rawMsg, key) + case "defenderForServers": + err = unpopulate(val, "DefenderForServers", &d.DefenderForServers) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "mdeAutoProvisioning": + err = unpopulate(val, "MdeAutoProvisioning", &d.MdeAutoProvisioning) + delete(rawMsg, key) + case "offeringType": + err = unpopulate(val, "OfferingType", &d.OfferingType) + delete(rawMsg, key) + case "subPlan": + err = unpopulate(val, "SubPlan", &d.SubPlan) + delete(rawMsg, key) + case "vmScanners": + err = unpopulate(val, "VMScanners", &d.VMScanners) + delete(rawMsg, key) + case "vaAutoProvisioning": + err = unpopulate(val, "VaAutoProvisioning", &d.VaAutoProvisioning) + 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 DefenderForServersAwsOfferingArcAutoProvisioning. +func (d DefenderForServersAwsOfferingArcAutoProvisioning) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cloudRoleArn", d.CloudRoleArn) + populate(objectMap, "enabled", d.Enabled) + populate(objectMap, "servicePrincipalSecretMetadata", d.ServicePrincipalSecretMetadata) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOfferingArcAutoProvisioning. +func (d *DefenderForServersAwsOfferingArcAutoProvisioning) 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 "cloudRoleArn": + err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &d.Enabled) + delete(rawMsg, key) + case "servicePrincipalSecretMetadata": + err = unpopulate(val, "ServicePrincipalSecretMetadata", &d.ServicePrincipalSecretMetadata) + 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 DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata. +func (d DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "expiryDate", d.ExpiryDate) + populate(objectMap, "parameterNameInStore", d.ParameterNameInStore) + populate(objectMap, "parameterStoreRegion", d.ParameterStoreRegion) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata. +func (d *DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata) 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 "expiryDate": + err = unpopulate(val, "ExpiryDate", &d.ExpiryDate) + delete(rawMsg, key) + case "parameterNameInStore": + err = unpopulate(val, "ParameterNameInStore", &d.ParameterNameInStore) + delete(rawMsg, key) + case "parameterStoreRegion": + err = unpopulate(val, "ParameterStoreRegion", &d.ParameterStoreRegion) + 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 DefenderForServersAwsOfferingDefenderForServers. +func (d DefenderForServersAwsOfferingDefenderForServers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cloudRoleArn", d.CloudRoleArn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOfferingDefenderForServers. +func (d *DefenderForServersAwsOfferingDefenderForServers) 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 "cloudRoleArn": + err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) + 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 DefenderForServersAwsOfferingMdeAutoProvisioning. +func (d DefenderForServersAwsOfferingMdeAutoProvisioning) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configuration", &d.Configuration) + populate(objectMap, "enabled", d.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOfferingMdeAutoProvisioning. +func (d *DefenderForServersAwsOfferingMdeAutoProvisioning) 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 "configuration": + err = unpopulate(val, "Configuration", &d.Configuration) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &d.Enabled) + 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 DefenderForServersAwsOfferingSubPlan. +func (d DefenderForServersAwsOfferingSubPlan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOfferingSubPlan. +func (d *DefenderForServersAwsOfferingSubPlan) 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 "type": + err = unpopulate(val, "Type", &d.Type) + 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 DefenderForServersAwsOfferingVMScanners. +func (d DefenderForServersAwsOfferingVMScanners) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configuration", d.Configuration) + populate(objectMap, "enabled", d.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOfferingVMScanners. +func (d *DefenderForServersAwsOfferingVMScanners) 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 "configuration": + err = unpopulate(val, "Configuration", &d.Configuration) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &d.Enabled) + 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 DefenderForServersAwsOfferingVMScannersConfiguration. +func (d DefenderForServersAwsOfferingVMScannersConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cloudRoleArn", d.CloudRoleArn) + populate(objectMap, "exclusionTags", &d.ExclusionTags) + populate(objectMap, "scanningMode", d.ScanningMode) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOfferingVMScannersConfiguration. +func (d *DefenderForServersAwsOfferingVMScannersConfiguration) 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 "cloudRoleArn": + err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) + delete(rawMsg, key) + case "exclusionTags": + err = unpopulate(val, "ExclusionTags", &d.ExclusionTags) + delete(rawMsg, key) + case "scanningMode": + err = unpopulate(val, "ScanningMode", &d.ScanningMode) + 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 DefenderForServersAwsOfferingVaAutoProvisioning. +func (d DefenderForServersAwsOfferingVaAutoProvisioning) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configuration", d.Configuration) + populate(objectMap, "enabled", d.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOfferingVaAutoProvisioning. +func (d *DefenderForServersAwsOfferingVaAutoProvisioning) 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 "configuration": + err = unpopulate(val, "Configuration", &d.Configuration) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &d.Enabled) + 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 DefenderForServersAwsOfferingVaAutoProvisioningConfiguration. +func (d DefenderForServersAwsOfferingVaAutoProvisioningConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOfferingVaAutoProvisioningConfiguration. +func (d *DefenderForServersAwsOfferingVaAutoProvisioningConfiguration) 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 "type": + err = unpopulate(val, "Type", &d.Type) + 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 DefenderForServersGcpOffering. +func (d DefenderForServersGcpOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "arcAutoProvisioning", d.ArcAutoProvisioning) + populate(objectMap, "defenderForServers", d.DefenderForServers) + populate(objectMap, "description", d.Description) + populate(objectMap, "mdeAutoProvisioning", d.MdeAutoProvisioning) + objectMap["offeringType"] = OfferingTypeDefenderForServersGcp + populate(objectMap, "subPlan", d.SubPlan) + populate(objectMap, "vaAutoProvisioning", d.VaAutoProvisioning) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersGcpOffering. +func (d *DefenderForServersGcpOffering) 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 "arcAutoProvisioning": + err = unpopulate(val, "ArcAutoProvisioning", &d.ArcAutoProvisioning) + delete(rawMsg, key) + case "defenderForServers": + err = unpopulate(val, "DefenderForServers", &d.DefenderForServers) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "mdeAutoProvisioning": + err = unpopulate(val, "MdeAutoProvisioning", &d.MdeAutoProvisioning) + delete(rawMsg, key) + case "offeringType": + err = unpopulate(val, "OfferingType", &d.OfferingType) + delete(rawMsg, key) + case "subPlan": + err = unpopulate(val, "SubPlan", &d.SubPlan) + delete(rawMsg, key) + case "vaAutoProvisioning": + err = unpopulate(val, "VaAutoProvisioning", &d.VaAutoProvisioning) + 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 DefenderForServersGcpOfferingArcAutoProvisioning. +func (d DefenderForServersGcpOfferingArcAutoProvisioning) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configuration", d.Configuration) + populate(objectMap, "enabled", d.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersGcpOfferingArcAutoProvisioning. +func (d *DefenderForServersGcpOfferingArcAutoProvisioning) 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 "configuration": + err = unpopulate(val, "Configuration", &d.Configuration) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &d.Enabled) + 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 DefenderForServersGcpOfferingArcAutoProvisioningConfiguration. +func (d DefenderForServersGcpOfferingArcAutoProvisioningConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "agentOnboardingServiceAccountNumericId", d.AgentOnboardingServiceAccountNumericID) + populate(objectMap, "clientId", d.ClientID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersGcpOfferingArcAutoProvisioningConfiguration. +func (d *DefenderForServersGcpOfferingArcAutoProvisioningConfiguration) 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 "agentOnboardingServiceAccountNumericId": + err = unpopulate(val, "AgentOnboardingServiceAccountNumericID", &d.AgentOnboardingServiceAccountNumericID) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &d.ClientID) + 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 DefenderForServersGcpOfferingDefenderForServers. +func (d DefenderForServersGcpOfferingDefenderForServers) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "serviceAccountEmailAddress", d.ServiceAccountEmailAddress) + populate(objectMap, "workloadIdentityProviderId", d.WorkloadIdentityProviderID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersGcpOfferingDefenderForServers. +func (d *DefenderForServersGcpOfferingDefenderForServers) 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 "serviceAccountEmailAddress": + err = unpopulate(val, "ServiceAccountEmailAddress", &d.ServiceAccountEmailAddress) + delete(rawMsg, key) + case "workloadIdentityProviderId": + err = unpopulate(val, "WorkloadIdentityProviderID", &d.WorkloadIdentityProviderID) + 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 DefenderForServersGcpOfferingMdeAutoProvisioning. +func (d DefenderForServersGcpOfferingMdeAutoProvisioning) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configuration", &d.Configuration) + populate(objectMap, "enabled", d.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersGcpOfferingMdeAutoProvisioning. +func (d *DefenderForServersGcpOfferingMdeAutoProvisioning) 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 "configuration": + err = unpopulate(val, "Configuration", &d.Configuration) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &d.Enabled) + 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 DefenderForServersGcpOfferingSubPlan. +func (d DefenderForServersGcpOfferingSubPlan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersGcpOfferingSubPlan. +func (d *DefenderForServersGcpOfferingSubPlan) 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 "type": + err = unpopulate(val, "Type", &d.Type) + 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 DefenderForServersGcpOfferingVaAutoProvisioning. +func (d DefenderForServersGcpOfferingVaAutoProvisioning) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configuration", d.Configuration) + populate(objectMap, "enabled", d.Enabled) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersGcpOfferingVaAutoProvisioning. +func (d *DefenderForServersGcpOfferingVaAutoProvisioning) 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 "configuration": + err = unpopulate(val, "Configuration", &d.Configuration) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &d.Enabled) + 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 DefenderForServersGcpOfferingVaAutoProvisioningConfiguration. +func (d DefenderForServersGcpOfferingVaAutoProvisioningConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersGcpOfferingVaAutoProvisioningConfiguration. +func (d *DefenderForServersGcpOfferingVaAutoProvisioningConfiguration) 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 "type": + err = unpopulate(val, "Type", &d.Type) + 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 DenylistCustomAlertRule. +func (d DenylistCustomAlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "denylistValues", d.DenylistValues) + populate(objectMap, "description", d.Description) + populate(objectMap, "displayName", d.DisplayName) + populate(objectMap, "isEnabled", d.IsEnabled) + objectMap["ruleType"] = "DenylistCustomAlertRule" + populate(objectMap, "valueType", d.ValueType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DenylistCustomAlertRule. +func (d *DenylistCustomAlertRule) 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 "denylistValues": + err = unpopulate(val, "DenylistValues", &d.DenylistValues) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &d.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &d.IsEnabled) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &d.RuleType) + delete(rawMsg, key) + case "valueType": + err = unpopulate(val, "ValueType", &d.ValueType) + 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 DeviceSecurityGroup. +func (d DeviceSecurityGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceSecurityGroup. +func (d *DeviceSecurityGroup) 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 "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + 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 DeviceSecurityGroupList. +func (d DeviceSecurityGroupList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceSecurityGroupList. +func (d *DeviceSecurityGroupList) 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 "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + 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 DeviceSecurityGroupProperties. +func (d DeviceSecurityGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowlistRules", d.AllowlistRules) + populate(objectMap, "denylistRules", d.DenylistRules) + populate(objectMap, "thresholdRules", d.ThresholdRules) + populate(objectMap, "timeWindowRules", d.TimeWindowRules) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceSecurityGroupProperties. +func (d *DeviceSecurityGroupProperties) 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 "allowlistRules": + d.AllowlistRules, err = unmarshalAllowlistCustomAlertRuleClassificationArray(val) + delete(rawMsg, key) + case "denylistRules": + err = unpopulate(val, "DenylistRules", &d.DenylistRules) + delete(rawMsg, key) + case "thresholdRules": + d.ThresholdRules, err = unmarshalThresholdCustomAlertRuleClassificationArray(val) + delete(rawMsg, key) + case "timeWindowRules": + d.TimeWindowRules, err = unmarshalTimeWindowCustomAlertRuleClassificationArray(val) + 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 DirectMethodInvokesNotInAllowedRange. +func (d DirectMethodInvokesNotInAllowedRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", d.Description) + populate(objectMap, "displayName", d.DisplayName) + populate(objectMap, "isEnabled", d.IsEnabled) + populate(objectMap, "maxThreshold", d.MaxThreshold) + populate(objectMap, "minThreshold", d.MinThreshold) + objectMap["ruleType"] = "DirectMethodInvokesNotInAllowedRange" + populate(objectMap, "timeWindowSize", d.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DirectMethodInvokesNotInAllowedRange. +func (d *DirectMethodInvokesNotInAllowedRange) 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 "description": + err = unpopulate(val, "Description", &d.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &d.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &d.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &d.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &d.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &d.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &d.TimeWindowSize) + 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 DiscoveredSecuritySolution. +func (d DiscoveredSecuritySolution) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", d.ID) + populate(objectMap, "location", d.Location) + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "type", d.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiscoveredSecuritySolution. +func (d *DiscoveredSecuritySolution) 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 "id": + err = unpopulate(val, "ID", &d.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &d.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &d.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &d.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &d.Type) + 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 DiscoveredSecuritySolutionList. +func (d DiscoveredSecuritySolutionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiscoveredSecuritySolutionList. +func (d *DiscoveredSecuritySolutionList) 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 "nextLink": + err = unpopulate(val, "NextLink", &d.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &d.Value) + 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 DiscoveredSecuritySolutionProperties. +func (d DiscoveredSecuritySolutionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "offer", d.Offer) + populate(objectMap, "publisher", d.Publisher) + populate(objectMap, "sku", d.SKU) + populate(objectMap, "securityFamily", d.SecurityFamily) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DiscoveredSecuritySolutionProperties. +func (d *DiscoveredSecuritySolutionProperties) 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 "offer": + err = unpopulate(val, "Offer", &d.Offer) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &d.Publisher) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, "SKU", &d.SKU) + delete(rawMsg, key) + case "securityFamily": + err = unpopulate(val, "SecurityFamily", &d.SecurityFamily) + 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 ETag. +func (e ETag) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", e.Etag) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ETag. +func (e *ETag) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &e.Etag) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EffectiveNetworkSecurityGroups. +func (e EffectiveNetworkSecurityGroups) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "networkInterface", e.NetworkInterface) + populate(objectMap, "networkSecurityGroups", e.NetworkSecurityGroups) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EffectiveNetworkSecurityGroups. +func (e *EffectiveNetworkSecurityGroups) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "networkInterface": + err = unpopulate(val, "NetworkInterface", &e.NetworkInterface) + delete(rawMsg, key) + case "networkSecurityGroups": + err = unpopulate(val, "NetworkSecurityGroups", &e.NetworkSecurityGroups) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type EnvironmentData. +func (e EnvironmentData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["environmentType"] = e.EnvironmentType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type EnvironmentData. +func (e *EnvironmentData) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "environmentType": + err = unpopulate(val, "EnvironmentType", &e.EnvironmentType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorAdditionalInfo. +func (e ErrorAdditionalInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "info", &e.Info) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorAdditionalInfo. +func (e *ErrorAdditionalInfo) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "info": + err = unpopulate(val, "Info", &e.Info) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExecuteGovernanceRuleParams. +func (e ExecuteGovernanceRuleParams) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "override", e.Override) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExecuteGovernanceRuleParams. +func (e *ExecuteGovernanceRuleParams) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "override": + err = unpopulate(val, "Override", &e.Override) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExecuteRuleStatus. +func (e ExecuteRuleStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "operationId", e.OperationID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExecuteRuleStatus. +func (e *ExecuteRuleStatus) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "operationId": + err = unpopulate(val, "OperationID", &e.OperationID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExternalSecuritySolution. +func (e ExternalSecuritySolution) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", e.ID) + populate(objectMap, "kind", e.Kind) + populate(objectMap, "location", e.Location) + populate(objectMap, "name", e.Name) + populate(objectMap, "type", e.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExternalSecuritySolution. +func (e *ExternalSecuritySolution) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &e.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &e.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &e.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &e.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExternalSecuritySolutionKindAutoGenerated. +func (e ExternalSecuritySolutionKindAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "kind", e.Kind) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExternalSecuritySolutionKindAutoGenerated. +func (e *ExternalSecuritySolutionKindAutoGenerated) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &e.Kind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExternalSecuritySolutionList. +func (e ExternalSecuritySolutionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", e.NextLink) + populate(objectMap, "value", e.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExternalSecuritySolutionList. +func (e *ExternalSecuritySolutionList) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &e.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &e.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ExternalSecuritySolutionProperties. +func (e ExternalSecuritySolutionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deviceType", e.DeviceType) + populate(objectMap, "deviceVendor", e.DeviceVendor) + populate(objectMap, "workspace", e.Workspace) + if e.AdditionalProperties != nil { + for key, val := range e.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExternalSecuritySolutionProperties. +func (e *ExternalSecuritySolutionProperties) 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", e, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "deviceType": + err = unpopulate(val, "DeviceType", &e.DeviceType) + delete(rawMsg, key) + case "deviceVendor": + err = unpopulate(val, "DeviceVendor", &e.DeviceVendor) + delete(rawMsg, key) + case "workspace": + err = unpopulate(val, "Workspace", &e.Workspace) + delete(rawMsg, key) + default: + if e.AdditionalProperties == nil { + e.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + e.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", e, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FailedLocalLoginsNotInAllowedRange. +func (f FailedLocalLoginsNotInAllowedRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", f.Description) + populate(objectMap, "displayName", f.DisplayName) + populate(objectMap, "isEnabled", f.IsEnabled) + populate(objectMap, "maxThreshold", f.MaxThreshold) + populate(objectMap, "minThreshold", f.MinThreshold) + objectMap["ruleType"] = "FailedLocalLoginsNotInAllowedRange" + populate(objectMap, "timeWindowSize", f.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FailedLocalLoginsNotInAllowedRange. +func (f *FailedLocalLoginsNotInAllowedRange) 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &f.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &f.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &f.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &f.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &f.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &f.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &f.TimeWindowSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type FileUploadsNotInAllowedRange. +func (f FileUploadsNotInAllowedRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", f.Description) + populate(objectMap, "displayName", f.DisplayName) + populate(objectMap, "isEnabled", f.IsEnabled) + populate(objectMap, "maxThreshold", f.MaxThreshold) + populate(objectMap, "minThreshold", f.MinThreshold) + objectMap["ruleType"] = "FileUploadsNotInAllowedRange" + populate(objectMap, "timeWindowSize", f.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type FileUploadsNotInAllowedRange. +func (f *FileUploadsNotInAllowedRange) 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", f, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &f.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &f.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &f.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &f.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &f.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &f.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &f.TimeWindowSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", f, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type GcpCredentialsDetailsProperties. +func (g GcpCredentialsDetailsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "authProviderX509CertUrl", g.AuthProviderX509CertURL) + populate(objectMap, "authUri", g.AuthURI) + populate(objectMap, "authenticationProvisioningState", g.AuthenticationProvisioningState) + objectMap["authenticationType"] = AuthenticationTypeGcpCredentials + populate(objectMap, "clientEmail", g.ClientEmail) + populate(objectMap, "clientId", g.ClientID) + populate(objectMap, "clientX509CertUrl", g.ClientX509CertURL) + populate(objectMap, "grantedPermissions", g.GrantedPermissions) + populate(objectMap, "organizationId", g.OrganizationID) + populate(objectMap, "privateKey", g.PrivateKey) + populate(objectMap, "privateKeyId", g.PrivateKeyID) + populate(objectMap, "projectId", g.ProjectID) + populate(objectMap, "tokenUri", g.TokenURI) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GcpCredentialsDetailsProperties. +func (g *GcpCredentialsDetailsProperties) 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 "authProviderX509CertUrl": + err = unpopulate(val, "AuthProviderX509CertURL", &g.AuthProviderX509CertURL) + delete(rawMsg, key) + case "authUri": + err = unpopulate(val, "AuthURI", &g.AuthURI) + delete(rawMsg, key) + case "authenticationProvisioningState": + err = unpopulate(val, "AuthenticationProvisioningState", &g.AuthenticationProvisioningState) + delete(rawMsg, key) + case "authenticationType": + err = unpopulate(val, "AuthenticationType", &g.AuthenticationType) + delete(rawMsg, key) + case "clientEmail": + err = unpopulate(val, "ClientEmail", &g.ClientEmail) + delete(rawMsg, key) + case "clientId": + err = unpopulate(val, "ClientID", &g.ClientID) + delete(rawMsg, key) + case "clientX509CertUrl": + err = unpopulate(val, "ClientX509CertURL", &g.ClientX509CertURL) + delete(rawMsg, key) + case "grantedPermissions": + err = unpopulate(val, "GrantedPermissions", &g.GrantedPermissions) + delete(rawMsg, key) + case "organizationId": + err = unpopulate(val, "OrganizationID", &g.OrganizationID) + delete(rawMsg, key) + case "privateKey": + err = unpopulate(val, "PrivateKey", &g.PrivateKey) + delete(rawMsg, key) + case "privateKeyId": + err = unpopulate(val, "PrivateKeyID", &g.PrivateKeyID) + delete(rawMsg, key) + case "projectId": + err = unpopulate(val, "ProjectID", &g.ProjectID) + delete(rawMsg, key) + case "tokenUri": + err = unpopulate(val, "TokenURI", &g.TokenURI) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + 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 GcpOrganizationalData. +func (g GcpOrganizationalData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["organizationMembershipType"] = g.OrganizationMembershipType + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GcpOrganizationalData. +func (g *GcpOrganizationalData) 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 "organizationMembershipType": + err = unpopulate(val, "OrganizationMembershipType", &g.OrganizationMembershipType) + 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 GcpOrganizationalDataMember. +func (g GcpOrganizationalDataMember) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "managementProjectNumber", g.ManagementProjectNumber) + objectMap["organizationMembershipType"] = OrganizationMembershipTypeMember + populate(objectMap, "parentHierarchyId", g.ParentHierarchyID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GcpOrganizationalDataMember. +func (g *GcpOrganizationalDataMember) 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 "managementProjectNumber": + err = unpopulate(val, "ManagementProjectNumber", &g.ManagementProjectNumber) + delete(rawMsg, key) + case "organizationMembershipType": + err = unpopulate(val, "OrganizationMembershipType", &g.OrganizationMembershipType) + delete(rawMsg, key) + case "parentHierarchyId": + err = unpopulate(val, "ParentHierarchyID", &g.ParentHierarchyID) + 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 GcpOrganizationalDataOrganization. +func (g GcpOrganizationalDataOrganization) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "excludedProjectNumbers", g.ExcludedProjectNumbers) + objectMap["organizationMembershipType"] = OrganizationMembershipTypeOrganization + populate(objectMap, "serviceAccountEmailAddress", g.ServiceAccountEmailAddress) + populate(objectMap, "workloadIdentityProviderId", g.WorkloadIdentityProviderID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GcpOrganizationalDataOrganization. +func (g *GcpOrganizationalDataOrganization) 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 "excludedProjectNumbers": + err = unpopulate(val, "ExcludedProjectNumbers", &g.ExcludedProjectNumbers) + delete(rawMsg, key) + case "organizationMembershipType": + err = unpopulate(val, "OrganizationMembershipType", &g.OrganizationMembershipType) + delete(rawMsg, key) + case "serviceAccountEmailAddress": + err = unpopulate(val, "ServiceAccountEmailAddress", &g.ServiceAccountEmailAddress) + delete(rawMsg, key) + case "workloadIdentityProviderId": + err = unpopulate(val, "WorkloadIdentityProviderID", &g.WorkloadIdentityProviderID) + 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 GcpProjectDetails. +func (g GcpProjectDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "projectId", g.ProjectID) + populate(objectMap, "projectNumber", g.ProjectNumber) + populate(objectMap, "workloadIdentityPoolId", g.WorkloadIdentityPoolID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GcpProjectDetails. +func (g *GcpProjectDetails) 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 "projectId": + err = unpopulate(val, "ProjectID", &g.ProjectID) + delete(rawMsg, key) + case "projectNumber": + err = unpopulate(val, "ProjectNumber", &g.ProjectNumber) + delete(rawMsg, key) + case "workloadIdentityPoolId": + err = unpopulate(val, "WorkloadIdentityPoolID", &g.WorkloadIdentityPoolID) + 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 GcpProjectEnvironmentData. +func (g GcpProjectEnvironmentData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["environmentType"] = EnvironmentTypeGcpProject + populate(objectMap, "organizationalData", g.OrganizationalData) + populate(objectMap, "projectDetails", g.ProjectDetails) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GcpProjectEnvironmentData. +func (g *GcpProjectEnvironmentData) 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 "environmentType": + err = unpopulate(val, "EnvironmentType", &g.EnvironmentType) + delete(rawMsg, key) + case "organizationalData": + g.OrganizationalData, err = unmarshalGcpOrganizationalDataClassification(val) + delete(rawMsg, key) + case "projectDetails": + err = unpopulate(val, "ProjectDetails", &g.ProjectDetails) + 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 GithubScopeEnvironmentData. +func (g GithubScopeEnvironmentData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["environmentType"] = EnvironmentTypeGithubScope + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GithubScopeEnvironmentData. +func (g *GithubScopeEnvironmentData) 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 "environmentType": + err = unpopulate(val, "EnvironmentType", &g.EnvironmentType) + 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 GovernanceAssignment. +func (g GovernanceAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceAssignment. +func (g *GovernanceAssignment) 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 "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + 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 GovernanceAssignmentAdditionalData. +func (g GovernanceAssignmentAdditionalData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ticketLink", g.TicketLink) + populate(objectMap, "ticketNumber", g.TicketNumber) + populate(objectMap, "ticketStatus", g.TicketStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceAssignmentAdditionalData. +func (g *GovernanceAssignmentAdditionalData) 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 "ticketLink": + err = unpopulate(val, "TicketLink", &g.TicketLink) + delete(rawMsg, key) + case "ticketNumber": + err = unpopulate(val, "TicketNumber", &g.TicketNumber) + delete(rawMsg, key) + case "ticketStatus": + err = unpopulate(val, "TicketStatus", &g.TicketStatus) + 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 GovernanceAssignmentProperties. +func (g GovernanceAssignmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", g.AdditionalData) + populate(objectMap, "governanceEmailNotification", g.GovernanceEmailNotification) + populate(objectMap, "isGracePeriod", g.IsGracePeriod) + populate(objectMap, "owner", g.Owner) + populateTimeRFC3339(objectMap, "remediationDueDate", g.RemediationDueDate) + populate(objectMap, "remediationEta", g.RemediationEta) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceAssignmentProperties. +func (g *GovernanceAssignmentProperties) 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 "additionalData": + err = unpopulate(val, "AdditionalData", &g.AdditionalData) + delete(rawMsg, key) + case "governanceEmailNotification": + err = unpopulate(val, "GovernanceEmailNotification", &g.GovernanceEmailNotification) + delete(rawMsg, key) + case "isGracePeriod": + err = unpopulate(val, "IsGracePeriod", &g.IsGracePeriod) + delete(rawMsg, key) + case "owner": + err = unpopulate(val, "Owner", &g.Owner) + delete(rawMsg, key) + case "remediationDueDate": + err = unpopulateTimeRFC3339(val, "RemediationDueDate", &g.RemediationDueDate) + delete(rawMsg, key) + case "remediationEta": + err = unpopulate(val, "RemediationEta", &g.RemediationEta) + 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 GovernanceAssignmentsList. +func (g GovernanceAssignmentsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceAssignmentsList. +func (g *GovernanceAssignmentsList) 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 "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + 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 GovernanceEmailNotification. +func (g GovernanceEmailNotification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "disableManagerEmailNotification", g.DisableManagerEmailNotification) + populate(objectMap, "disableOwnerEmailNotification", g.DisableOwnerEmailNotification) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceEmailNotification. +func (g *GovernanceEmailNotification) 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 "disableManagerEmailNotification": + err = unpopulate(val, "DisableManagerEmailNotification", &g.DisableManagerEmailNotification) + delete(rawMsg, key) + case "disableOwnerEmailNotification": + err = unpopulate(val, "DisableOwnerEmailNotification", &g.DisableOwnerEmailNotification) + 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 GovernanceRule. +func (g GovernanceRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", g.ID) + populate(objectMap, "name", g.Name) + populate(objectMap, "properties", g.Properties) + populate(objectMap, "type", g.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceRule. +func (g *GovernanceRule) 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 "id": + err = unpopulate(val, "ID", &g.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &g.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &g.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &g.Type) + 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 GovernanceRuleEmailNotification. +func (g GovernanceRuleEmailNotification) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "disableManagerEmailNotification", g.DisableManagerEmailNotification) + populate(objectMap, "disableOwnerEmailNotification", g.DisableOwnerEmailNotification) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceRuleEmailNotification. +func (g *GovernanceRuleEmailNotification) 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 "disableManagerEmailNotification": + err = unpopulate(val, "DisableManagerEmailNotification", &g.DisableManagerEmailNotification) + delete(rawMsg, key) + case "disableOwnerEmailNotification": + err = unpopulate(val, "DisableOwnerEmailNotification", &g.DisableOwnerEmailNotification) + 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 GovernanceRuleList. +func (g GovernanceRuleList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", g.NextLink) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceRuleList. +func (g *GovernanceRuleList) 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 "nextLink": + err = unpopulate(val, "NextLink", &g.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + 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 GovernanceRuleOwnerSource. +func (g GovernanceRuleOwnerSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "type", g.Type) + populate(objectMap, "value", g.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceRuleOwnerSource. +func (g *GovernanceRuleOwnerSource) 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 "type": + err = unpopulate(val, "Type", &g.Type) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &g.Value) + 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 GovernanceRuleProperties. +func (g GovernanceRuleProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "conditionSets", g.ConditionSets) + populate(objectMap, "description", g.Description) + populate(objectMap, "displayName", g.DisplayName) + populate(objectMap, "governanceEmailNotification", g.GovernanceEmailNotification) + populate(objectMap, "isDisabled", g.IsDisabled) + populate(objectMap, "isGracePeriod", g.IsGracePeriod) + populate(objectMap, "ownerSource", g.OwnerSource) + populate(objectMap, "remediationTimeframe", g.RemediationTimeframe) + populate(objectMap, "rulePriority", g.RulePriority) + populate(objectMap, "ruleType", g.RuleType) + populate(objectMap, "sourceResourceType", g.SourceResourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type GovernanceRuleProperties. +func (g *GovernanceRuleProperties) 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 "conditionSets": + err = unpopulate(val, "ConditionSets", &g.ConditionSets) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &g.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &g.DisplayName) + delete(rawMsg, key) + case "governanceEmailNotification": + err = unpopulate(val, "GovernanceEmailNotification", &g.GovernanceEmailNotification) + delete(rawMsg, key) + case "isDisabled": + err = unpopulate(val, "IsDisabled", &g.IsDisabled) + delete(rawMsg, key) + case "isGracePeriod": + err = unpopulate(val, "IsGracePeriod", &g.IsGracePeriod) + delete(rawMsg, key) + case "ownerSource": + err = unpopulate(val, "OwnerSource", &g.OwnerSource) + delete(rawMsg, key) + case "remediationTimeframe": + err = unpopulate(val, "RemediationTimeframe", &g.RemediationTimeframe) + delete(rawMsg, key) + case "rulePriority": + err = unpopulate(val, "RulePriority", &g.RulePriority) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &g.RuleType) + delete(rawMsg, key) + case "sourceResourceType": + err = unpopulate(val, "SourceResourceType", &g.SourceResourceType) + 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 HTTPC2DMessagesNotInAllowedRange. +func (h HTTPC2DMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", h.Description) + populate(objectMap, "displayName", h.DisplayName) + populate(objectMap, "isEnabled", h.IsEnabled) + populate(objectMap, "maxThreshold", h.MaxThreshold) + populate(objectMap, "minThreshold", h.MinThreshold) + objectMap["ruleType"] = "HttpC2DMessagesNotInAllowedRange" + populate(objectMap, "timeWindowSize", h.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPC2DMessagesNotInAllowedRange. +func (h *HTTPC2DMessagesNotInAllowedRange) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &h.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &h.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &h.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &h.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &h.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &h.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &h.TimeWindowSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HTTPC2DRejectedMessagesNotInAllowedRange. +func (h HTTPC2DRejectedMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", h.Description) + populate(objectMap, "displayName", h.DisplayName) + populate(objectMap, "isEnabled", h.IsEnabled) + populate(objectMap, "maxThreshold", h.MaxThreshold) + populate(objectMap, "minThreshold", h.MinThreshold) + objectMap["ruleType"] = "HttpC2DRejectedMessagesNotInAllowedRange" + populate(objectMap, "timeWindowSize", h.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPC2DRejectedMessagesNotInAllowedRange. +func (h *HTTPC2DRejectedMessagesNotInAllowedRange) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &h.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &h.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &h.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &h.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &h.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &h.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &h.TimeWindowSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HTTPD2CMessagesNotInAllowedRange. +func (h HTTPD2CMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", h.Description) + populate(objectMap, "displayName", h.DisplayName) + populate(objectMap, "isEnabled", h.IsEnabled) + populate(objectMap, "maxThreshold", h.MaxThreshold) + populate(objectMap, "minThreshold", h.MinThreshold) + objectMap["ruleType"] = "HttpD2CMessagesNotInAllowedRange" + populate(objectMap, "timeWindowSize", h.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPD2CMessagesNotInAllowedRange. +func (h *HTTPD2CMessagesNotInAllowedRange) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &h.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &h.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &h.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &h.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &h.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &h.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &h.TimeWindowSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type HybridComputeSettingsProperties. +func (h HybridComputeSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "autoProvision", h.AutoProvision) + populate(objectMap, "hybridComputeProvisioningState", h.HybridComputeProvisioningState) + populate(objectMap, "proxyServer", h.ProxyServer) + populate(objectMap, "region", h.Region) + populate(objectMap, "resourceGroupName", h.ResourceGroupName) + populate(objectMap, "servicePrincipal", h.ServicePrincipal) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HybridComputeSettingsProperties. +func (h *HybridComputeSettingsProperties) 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", h, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "autoProvision": + err = unpopulate(val, "AutoProvision", &h.AutoProvision) + delete(rawMsg, key) + case "hybridComputeProvisioningState": + err = unpopulate(val, "HybridComputeProvisioningState", &h.HybridComputeProvisioningState) + delete(rawMsg, key) + case "proxyServer": + err = unpopulate(val, "ProxyServer", &h.ProxyServer) + delete(rawMsg, key) + case "region": + err = unpopulate(val, "Region", &h.Region) + delete(rawMsg, key) + case "resourceGroupName": + err = unpopulate(val, "ResourceGroupName", &h.ResourceGroupName) + delete(rawMsg, key) + case "servicePrincipal": + err = unpopulate(val, "ServicePrincipal", &h.ServicePrincipal) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", h, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type InformationProtectionAwsOffering. +func (i InformationProtectionAwsOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", i.Description) + populate(objectMap, "informationProtection", i.InformationProtection) + objectMap["offeringType"] = OfferingTypeInformationProtectionAws + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InformationProtectionAwsOffering. +func (i *InformationProtectionAwsOffering) 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 "description": + err = unpopulate(val, "Description", &i.Description) + delete(rawMsg, key) + case "informationProtection": + err = unpopulate(val, "InformationProtection", &i.InformationProtection) + delete(rawMsg, key) + case "offeringType": + err = unpopulate(val, "OfferingType", &i.OfferingType) + 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 InformationProtectionAwsOfferingInformationProtection. +func (i InformationProtectionAwsOfferingInformationProtection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cloudRoleArn", i.CloudRoleArn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InformationProtectionAwsOfferingInformationProtection. +func (i *InformationProtectionAwsOfferingInformationProtection) 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 "cloudRoleArn": + err = unpopulate(val, "CloudRoleArn", &i.CloudRoleArn) + 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 InformationProtectionKeyword. +func (i InformationProtectionKeyword) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "canBeNumeric", i.CanBeNumeric) + populate(objectMap, "custom", i.Custom) + populate(objectMap, "excluded", i.Excluded) + populate(objectMap, "pattern", i.Pattern) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InformationProtectionKeyword. +func (i *InformationProtectionKeyword) 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 "canBeNumeric": + err = unpopulate(val, "CanBeNumeric", &i.CanBeNumeric) + delete(rawMsg, key) + case "custom": + err = unpopulate(val, "Custom", &i.Custom) + delete(rawMsg, key) + case "excluded": + err = unpopulate(val, "Excluded", &i.Excluded) + delete(rawMsg, key) + case "pattern": + err = unpopulate(val, "Pattern", &i.Pattern) + 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 InformationProtectionPolicy. +func (i InformationProtectionPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InformationProtectionPolicy. +func (i *InformationProtectionPolicy) 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 "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + 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 InformationProtectionPolicyList. +func (i InformationProtectionPolicyList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InformationProtectionPolicyList. +func (i *InformationProtectionPolicyList) 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 "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + 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 InformationProtectionPolicyProperties. +func (i InformationProtectionPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "informationTypes", i.InformationTypes) + populate(objectMap, "labels", i.Labels) + populateTimeRFC3339(objectMap, "lastModifiedUtc", i.LastModifiedUTC) + populate(objectMap, "version", i.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InformationProtectionPolicyProperties. +func (i *InformationProtectionPolicyProperties) 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 "informationTypes": + err = unpopulate(val, "InformationTypes", &i.InformationTypes) + delete(rawMsg, key) + case "labels": + err = unpopulate(val, "Labels", &i.Labels) + delete(rawMsg, key) + case "lastModifiedUtc": + err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &i.LastModifiedUTC) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &i.Version) + 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 InformationType. +func (i InformationType) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "custom", i.Custom) + populate(objectMap, "description", i.Description) + populate(objectMap, "displayName", i.DisplayName) + populate(objectMap, "enabled", i.Enabled) + populate(objectMap, "keywords", i.Keywords) + populate(objectMap, "order", i.Order) + populate(objectMap, "recommendedLabelId", i.RecommendedLabelID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InformationType. +func (i *InformationType) 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 "custom": + err = unpopulate(val, "Custom", &i.Custom) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &i.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &i.DisplayName) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &i.Enabled) + delete(rawMsg, key) + case "keywords": + err = unpopulate(val, "Keywords", &i.Keywords) + delete(rawMsg, key) + case "order": + err = unpopulate(val, "Order", &i.Order) + delete(rawMsg, key) + case "recommendedLabelId": + err = unpopulate(val, "RecommendedLabelID", &i.RecommendedLabelID) + 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 IngestionConnectionString. +func (i IngestionConnectionString) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", i.Location) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IngestionConnectionString. +func (i *IngestionConnectionString) 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 "location": + err = unpopulate(val, "Location", &i.Location) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + 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 IngestionSetting. +func (i IngestionSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", &i.Properties) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IngestionSetting. +func (i *IngestionSetting) 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 "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + 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 IngestionSettingList. +func (i IngestionSettingList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IngestionSettingList. +func (i *IngestionSettingList) 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 "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + 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 IngestionSettingToken. +func (i IngestionSettingToken) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "token", i.Token) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IngestionSettingToken. +func (i *IngestionSettingToken) 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 "token": + err = unpopulate(val, "Token", &i.Token) + 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 IoTSecurityAggregatedAlert. +func (i IoTSecurityAggregatedAlert) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "tags", i.Tags) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAggregatedAlert. +func (i *IoTSecurityAggregatedAlert) 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 "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + 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 IoTSecurityAggregatedAlertList. +func (i IoTSecurityAggregatedAlertList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAggregatedAlertList. +func (i *IoTSecurityAggregatedAlertList) 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 "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + 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 IoTSecurityAggregatedAlertProperties. +func (i IoTSecurityAggregatedAlertProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "actionTaken", i.ActionTaken) + populateDateType(objectMap, "aggregatedDateUtc", i.AggregatedDateUTC) + populate(objectMap, "alertDisplayName", i.AlertDisplayName) + populate(objectMap, "alertType", i.AlertType) + populate(objectMap, "count", i.Count) + populate(objectMap, "description", i.Description) + populate(objectMap, "effectedResourceType", i.EffectedResourceType) + populate(objectMap, "logAnalyticsQuery", i.LogAnalyticsQuery) + populate(objectMap, "remediationSteps", i.RemediationSteps) + populate(objectMap, "reportedSeverity", i.ReportedSeverity) + populate(objectMap, "systemSource", i.SystemSource) + populate(objectMap, "topDevicesList", i.TopDevicesList) + populate(objectMap, "vendorName", i.VendorName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAggregatedAlertProperties. +func (i *IoTSecurityAggregatedAlertProperties) 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 "actionTaken": + err = unpopulate(val, "ActionTaken", &i.ActionTaken) + delete(rawMsg, key) + case "aggregatedDateUtc": + err = unpopulateDateType(val, "AggregatedDateUTC", &i.AggregatedDateUTC) + delete(rawMsg, key) + case "alertDisplayName": + err = unpopulate(val, "AlertDisplayName", &i.AlertDisplayName) + delete(rawMsg, key) + case "alertType": + err = unpopulate(val, "AlertType", &i.AlertType) + delete(rawMsg, key) + case "count": + err = unpopulate(val, "Count", &i.Count) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &i.Description) + delete(rawMsg, key) + case "effectedResourceType": + err = unpopulate(val, "EffectedResourceType", &i.EffectedResourceType) + delete(rawMsg, key) + case "logAnalyticsQuery": + err = unpopulate(val, "LogAnalyticsQuery", &i.LogAnalyticsQuery) + delete(rawMsg, key) + case "remediationSteps": + err = unpopulate(val, "RemediationSteps", &i.RemediationSteps) + delete(rawMsg, key) + case "reportedSeverity": + err = unpopulate(val, "ReportedSeverity", &i.ReportedSeverity) + delete(rawMsg, key) + case "systemSource": + err = unpopulate(val, "SystemSource", &i.SystemSource) + delete(rawMsg, key) + case "topDevicesList": + err = unpopulate(val, "TopDevicesList", &i.TopDevicesList) + delete(rawMsg, key) + case "vendorName": + err = unpopulate(val, "VendorName", &i.VendorName) + 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 IoTSecurityAggregatedAlertPropertiesTopDevicesListItem. +func (i IoTSecurityAggregatedAlertPropertiesTopDevicesListItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertsCount", i.AlertsCount) + populate(objectMap, "deviceId", i.DeviceID) + populate(objectMap, "lastOccurrence", i.LastOccurrence) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAggregatedAlertPropertiesTopDevicesListItem. +func (i *IoTSecurityAggregatedAlertPropertiesTopDevicesListItem) 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 "alertsCount": + err = unpopulate(val, "AlertsCount", &i.AlertsCount) + delete(rawMsg, key) + case "deviceId": + err = unpopulate(val, "DeviceID", &i.DeviceID) + delete(rawMsg, key) + case "lastOccurrence": + err = unpopulate(val, "LastOccurrence", &i.LastOccurrence) + 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 IoTSecurityAggregatedRecommendation. +func (i IoTSecurityAggregatedRecommendation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "tags", i.Tags) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAggregatedRecommendation. +func (i *IoTSecurityAggregatedRecommendation) 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 "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + 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 IoTSecurityAggregatedRecommendationList. +func (i IoTSecurityAggregatedRecommendationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAggregatedRecommendationList. +func (i *IoTSecurityAggregatedRecommendationList) 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 "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + 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 IoTSecurityAggregatedRecommendationProperties. +func (i IoTSecurityAggregatedRecommendationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", i.Description) + populate(objectMap, "detectedBy", i.DetectedBy) + populate(objectMap, "healthyDevices", i.HealthyDevices) + populate(objectMap, "logAnalyticsQuery", i.LogAnalyticsQuery) + populate(objectMap, "recommendationDisplayName", i.RecommendationDisplayName) + populate(objectMap, "recommendationName", i.RecommendationName) + populate(objectMap, "recommendationTypeId", i.RecommendationTypeID) + populate(objectMap, "remediationSteps", i.RemediationSteps) + populate(objectMap, "reportedSeverity", i.ReportedSeverity) + populate(objectMap, "unhealthyDeviceCount", i.UnhealthyDeviceCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAggregatedRecommendationProperties. +func (i *IoTSecurityAggregatedRecommendationProperties) 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 "description": + err = unpopulate(val, "Description", &i.Description) + delete(rawMsg, key) + case "detectedBy": + err = unpopulate(val, "DetectedBy", &i.DetectedBy) + delete(rawMsg, key) + case "healthyDevices": + err = unpopulate(val, "HealthyDevices", &i.HealthyDevices) + delete(rawMsg, key) + case "logAnalyticsQuery": + err = unpopulate(val, "LogAnalyticsQuery", &i.LogAnalyticsQuery) + delete(rawMsg, key) + case "recommendationDisplayName": + err = unpopulate(val, "RecommendationDisplayName", &i.RecommendationDisplayName) + delete(rawMsg, key) + case "recommendationName": + err = unpopulate(val, "RecommendationName", &i.RecommendationName) + delete(rawMsg, key) + case "recommendationTypeId": + err = unpopulate(val, "RecommendationTypeID", &i.RecommendationTypeID) + delete(rawMsg, key) + case "remediationSteps": + err = unpopulate(val, "RemediationSteps", &i.RemediationSteps) + delete(rawMsg, key) + case "reportedSeverity": + err = unpopulate(val, "ReportedSeverity", &i.ReportedSeverity) + delete(rawMsg, key) + case "unhealthyDeviceCount": + err = unpopulate(val, "UnhealthyDeviceCount", &i.UnhealthyDeviceCount) + 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 IoTSecurityAlertedDevice. +func (i IoTSecurityAlertedDevice) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertsCount", i.AlertsCount) + populate(objectMap, "deviceId", i.DeviceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAlertedDevice. +func (i *IoTSecurityAlertedDevice) 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 "alertsCount": + err = unpopulate(val, "AlertsCount", &i.AlertsCount) + delete(rawMsg, key) + case "deviceId": + err = unpopulate(val, "DeviceID", &i.DeviceID) + 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 IoTSecurityDeviceAlert. +func (i IoTSecurityDeviceAlert) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertDisplayName", i.AlertDisplayName) + populate(objectMap, "alertsCount", i.AlertsCount) + populate(objectMap, "reportedSeverity", i.ReportedSeverity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityDeviceAlert. +func (i *IoTSecurityDeviceAlert) 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 "alertDisplayName": + err = unpopulate(val, "AlertDisplayName", &i.AlertDisplayName) + delete(rawMsg, key) + case "alertsCount": + err = unpopulate(val, "AlertsCount", &i.AlertsCount) + delete(rawMsg, key) + case "reportedSeverity": + err = unpopulate(val, "ReportedSeverity", &i.ReportedSeverity) + 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 IoTSecurityDeviceRecommendation. +func (i IoTSecurityDeviceRecommendation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "devicesCount", i.DevicesCount) + populate(objectMap, "recommendationDisplayName", i.RecommendationDisplayName) + populate(objectMap, "reportedSeverity", i.ReportedSeverity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityDeviceRecommendation. +func (i *IoTSecurityDeviceRecommendation) 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 "devicesCount": + err = unpopulate(val, "DevicesCount", &i.DevicesCount) + delete(rawMsg, key) + case "recommendationDisplayName": + err = unpopulate(val, "RecommendationDisplayName", &i.RecommendationDisplayName) + delete(rawMsg, key) + case "reportedSeverity": + err = unpopulate(val, "ReportedSeverity", &i.ReportedSeverity) + 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 IoTSecuritySolutionAnalyticsModel. +func (i IoTSecuritySolutionAnalyticsModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecuritySolutionAnalyticsModel. +func (i *IoTSecuritySolutionAnalyticsModel) 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 "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + 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 IoTSecuritySolutionAnalyticsModelList. +func (i IoTSecuritySolutionAnalyticsModelList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecuritySolutionAnalyticsModelList. +func (i *IoTSecuritySolutionAnalyticsModelList) 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 "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + 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 IoTSecuritySolutionAnalyticsModelProperties. +func (i IoTSecuritySolutionAnalyticsModelProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "devicesMetrics", i.DevicesMetrics) + populate(objectMap, "metrics", i.Metrics) + populate(objectMap, "mostPrevalentDeviceAlerts", i.MostPrevalentDeviceAlerts) + populate(objectMap, "mostPrevalentDeviceRecommendations", i.MostPrevalentDeviceRecommendations) + populate(objectMap, "topAlertedDevices", i.TopAlertedDevices) + populate(objectMap, "unhealthyDeviceCount", i.UnhealthyDeviceCount) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecuritySolutionAnalyticsModelProperties. +func (i *IoTSecuritySolutionAnalyticsModelProperties) 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 "devicesMetrics": + err = unpopulate(val, "DevicesMetrics", &i.DevicesMetrics) + delete(rawMsg, key) + case "metrics": + err = unpopulate(val, "Metrics", &i.Metrics) + delete(rawMsg, key) + case "mostPrevalentDeviceAlerts": + err = unpopulate(val, "MostPrevalentDeviceAlerts", &i.MostPrevalentDeviceAlerts) + delete(rawMsg, key) + case "mostPrevalentDeviceRecommendations": + err = unpopulate(val, "MostPrevalentDeviceRecommendations", &i.MostPrevalentDeviceRecommendations) + delete(rawMsg, key) + case "topAlertedDevices": + err = unpopulate(val, "TopAlertedDevices", &i.TopAlertedDevices) + delete(rawMsg, key) + case "unhealthyDeviceCount": + err = unpopulate(val, "UnhealthyDeviceCount", &i.UnhealthyDeviceCount) + 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 IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem. +func (i IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "date", i.Date) + populate(objectMap, "devicesMetrics", i.DevicesMetrics) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem. +func (i *IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem) 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 "date": + err = unpopulateTimeRFC3339(val, "Date", &i.Date) + delete(rawMsg, key) + case "devicesMetrics": + err = unpopulate(val, "DevicesMetrics", &i.DevicesMetrics) + 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 IoTSecuritySolutionModel. +func (i IoTSecuritySolutionModel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", i.ID) + populate(objectMap, "location", i.Location) + populate(objectMap, "name", i.Name) + populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) + populate(objectMap, "tags", i.Tags) + populate(objectMap, "type", i.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecuritySolutionModel. +func (i *IoTSecuritySolutionModel) 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 "id": + err = unpopulate(val, "ID", &i.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &i.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &i.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &i.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &i.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &i.Type) + 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 IoTSecuritySolutionProperties. +func (i IoTSecuritySolutionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalWorkspaces", i.AdditionalWorkspaces) + populate(objectMap, "autoDiscoveredResources", i.AutoDiscoveredResources) + populate(objectMap, "disabledDataSources", i.DisabledDataSources) + populate(objectMap, "displayName", i.DisplayName) + populate(objectMap, "export", i.Export) + populate(objectMap, "iotHubs", i.IotHubs) + populate(objectMap, "recommendationsConfiguration", i.RecommendationsConfiguration) + populate(objectMap, "status", i.Status) + populate(objectMap, "unmaskedIpLoggingStatus", i.UnmaskedIPLoggingStatus) + populate(objectMap, "userDefinedResources", i.UserDefinedResources) + populate(objectMap, "workspace", i.Workspace) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecuritySolutionProperties. +func (i *IoTSecuritySolutionProperties) 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 "additionalWorkspaces": + err = unpopulate(val, "AdditionalWorkspaces", &i.AdditionalWorkspaces) + delete(rawMsg, key) + case "autoDiscoveredResources": + err = unpopulate(val, "AutoDiscoveredResources", &i.AutoDiscoveredResources) + delete(rawMsg, key) + case "disabledDataSources": + err = unpopulate(val, "DisabledDataSources", &i.DisabledDataSources) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &i.DisplayName) + delete(rawMsg, key) + case "export": + err = unpopulate(val, "Export", &i.Export) + delete(rawMsg, key) + case "iotHubs": + err = unpopulate(val, "IotHubs", &i.IotHubs) + delete(rawMsg, key) + case "recommendationsConfiguration": + err = unpopulate(val, "RecommendationsConfiguration", &i.RecommendationsConfiguration) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &i.Status) + delete(rawMsg, key) + case "unmaskedIpLoggingStatus": + err = unpopulate(val, "UnmaskedIPLoggingStatus", &i.UnmaskedIPLoggingStatus) + delete(rawMsg, key) + case "userDefinedResources": + err = unpopulate(val, "UserDefinedResources", &i.UserDefinedResources) + delete(rawMsg, key) + case "workspace": + err = unpopulate(val, "Workspace", &i.Workspace) + 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 IoTSecuritySolutionsList. +func (i IoTSecuritySolutionsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", i.NextLink) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecuritySolutionsList. +func (i *IoTSecuritySolutionsList) 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 "nextLink": + err = unpopulate(val, "NextLink", &i.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &i.Value) + 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 IoTSeverityMetrics. +func (i IoTSeverityMetrics) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "high", i.High) + populate(objectMap, "low", i.Low) + populate(objectMap, "medium", i.Medium) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSeverityMetrics. +func (i *IoTSeverityMetrics) 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 "high": + err = unpopulate(val, "High", &i.High) + delete(rawMsg, key) + case "low": + err = unpopulate(val, "Low", &i.Low) + delete(rawMsg, key) + case "medium": + err = unpopulate(val, "Medium", &i.Medium) + 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 JitNetworkAccessPoliciesList. +func (j JitNetworkAccessPoliciesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", j.NextLink) + populate(objectMap, "value", j.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPoliciesList. +func (j *JitNetworkAccessPoliciesList) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &j.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &j.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicy. +func (j JitNetworkAccessPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", j.ID) + populate(objectMap, "kind", j.Kind) + populate(objectMap, "location", j.Location) + populate(objectMap, "name", j.Name) + populate(objectMap, "properties", j.Properties) + populate(objectMap, "type", j.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPolicy. +func (j *JitNetworkAccessPolicy) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &j.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &j.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &j.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &j.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &j.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &j.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicyInitiatePort. +func (j JitNetworkAccessPolicyInitiatePort) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedSourceAddressPrefix", j.AllowedSourceAddressPrefix) + populateTimeRFC3339(objectMap, "endTimeUtc", j.EndTimeUTC) + populate(objectMap, "number", j.Number) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPolicyInitiatePort. +func (j *JitNetworkAccessPolicyInitiatePort) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowedSourceAddressPrefix": + err = unpopulate(val, "AllowedSourceAddressPrefix", &j.AllowedSourceAddressPrefix) + delete(rawMsg, key) + case "endTimeUtc": + err = unpopulateTimeRFC3339(val, "EndTimeUTC", &j.EndTimeUTC) + delete(rawMsg, key) + case "number": + err = unpopulate(val, "Number", &j.Number) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicyInitiateRequest. +func (j JitNetworkAccessPolicyInitiateRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "justification", j.Justification) + populate(objectMap, "virtualMachines", j.VirtualMachines) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPolicyInitiateRequest. +func (j *JitNetworkAccessPolicyInitiateRequest) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "justification": + err = unpopulate(val, "Justification", &j.Justification) + delete(rawMsg, key) + case "virtualMachines": + err = unpopulate(val, "VirtualMachines", &j.VirtualMachines) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicyInitiateVirtualMachine. +func (j JitNetworkAccessPolicyInitiateVirtualMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", j.ID) + populate(objectMap, "ports", j.Ports) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPolicyInitiateVirtualMachine. +func (j *JitNetworkAccessPolicyInitiateVirtualMachine) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &j.ID) + delete(rawMsg, key) + case "ports": + err = unpopulate(val, "Ports", &j.Ports) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicyProperties. +func (j JitNetworkAccessPolicyProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", j.ProvisioningState) + populate(objectMap, "requests", j.Requests) + populate(objectMap, "virtualMachines", j.VirtualMachines) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPolicyProperties. +func (j *JitNetworkAccessPolicyProperties) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &j.ProvisioningState) + delete(rawMsg, key) + case "requests": + err = unpopulate(val, "Requests", &j.Requests) + delete(rawMsg, key) + case "virtualMachines": + err = unpopulate(val, "VirtualMachines", &j.VirtualMachines) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicyVirtualMachine. +func (j JitNetworkAccessPolicyVirtualMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", j.ID) + populate(objectMap, "ports", j.Ports) + populate(objectMap, "publicIpAddress", j.PublicIPAddress) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPolicyVirtualMachine. +func (j *JitNetworkAccessPolicyVirtualMachine) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &j.ID) + delete(rawMsg, key) + case "ports": + err = unpopulate(val, "Ports", &j.Ports) + delete(rawMsg, key) + case "publicIpAddress": + err = unpopulate(val, "PublicIPAddress", &j.PublicIPAddress) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPortRule. +func (j JitNetworkAccessPortRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedSourceAddressPrefix", j.AllowedSourceAddressPrefix) + populate(objectMap, "allowedSourceAddressPrefixes", j.AllowedSourceAddressPrefixes) + populate(objectMap, "maxRequestAccessDuration", j.MaxRequestAccessDuration) + populate(objectMap, "number", j.Number) + populate(objectMap, "protocol", j.Protocol) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPortRule. +func (j *JitNetworkAccessPortRule) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowedSourceAddressPrefix": + err = unpopulate(val, "AllowedSourceAddressPrefix", &j.AllowedSourceAddressPrefix) + delete(rawMsg, key) + case "allowedSourceAddressPrefixes": + err = unpopulate(val, "AllowedSourceAddressPrefixes", &j.AllowedSourceAddressPrefixes) + delete(rawMsg, key) + case "maxRequestAccessDuration": + err = unpopulate(val, "MaxRequestAccessDuration", &j.MaxRequestAccessDuration) + delete(rawMsg, key) + case "number": + err = unpopulate(val, "Number", &j.Number) + delete(rawMsg, key) + case "protocol": + err = unpopulate(val, "Protocol", &j.Protocol) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessRequest. +func (j JitNetworkAccessRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "justification", j.Justification) + populate(objectMap, "requestor", j.Requestor) + populateTimeRFC3339(objectMap, "startTimeUtc", j.StartTimeUTC) + populate(objectMap, "virtualMachines", j.VirtualMachines) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessRequest. +func (j *JitNetworkAccessRequest) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "justification": + err = unpopulate(val, "Justification", &j.Justification) + delete(rawMsg, key) + case "requestor": + err = unpopulate(val, "Requestor", &j.Requestor) + delete(rawMsg, key) + case "startTimeUtc": + err = unpopulateTimeRFC3339(val, "StartTimeUTC", &j.StartTimeUTC) + delete(rawMsg, key) + case "virtualMachines": + err = unpopulate(val, "VirtualMachines", &j.VirtualMachines) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessRequestPort. +func (j JitNetworkAccessRequestPort) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowedSourceAddressPrefix", j.AllowedSourceAddressPrefix) + populate(objectMap, "allowedSourceAddressPrefixes", j.AllowedSourceAddressPrefixes) + populateTimeRFC3339(objectMap, "endTimeUtc", j.EndTimeUTC) + populate(objectMap, "mappedPort", j.MappedPort) + populate(objectMap, "number", j.Number) + populate(objectMap, "status", j.Status) + populate(objectMap, "statusReason", j.StatusReason) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessRequestPort. +func (j *JitNetworkAccessRequestPort) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowedSourceAddressPrefix": + err = unpopulate(val, "AllowedSourceAddressPrefix", &j.AllowedSourceAddressPrefix) + delete(rawMsg, key) + case "allowedSourceAddressPrefixes": + err = unpopulate(val, "AllowedSourceAddressPrefixes", &j.AllowedSourceAddressPrefixes) + delete(rawMsg, key) + case "endTimeUtc": + err = unpopulateTimeRFC3339(val, "EndTimeUTC", &j.EndTimeUTC) + delete(rawMsg, key) + case "mappedPort": + err = unpopulate(val, "MappedPort", &j.MappedPort) + delete(rawMsg, key) + case "number": + err = unpopulate(val, "Number", &j.Number) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &j.Status) + delete(rawMsg, key) + case "statusReason": + err = unpopulate(val, "StatusReason", &j.StatusReason) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessRequestVirtualMachine. +func (j JitNetworkAccessRequestVirtualMachine) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", j.ID) + populate(objectMap, "ports", j.Ports) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessRequestVirtualMachine. +func (j *JitNetworkAccessRequestVirtualMachine) 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", j, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &j.ID) + delete(rawMsg, key) + case "ports": + err = unpopulate(val, "Ports", &j.Ports) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", j, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type KindAutoGenerated. +func (k KindAutoGenerated) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "kind", k.Kind) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KindAutoGenerated. +func (k *KindAutoGenerated) 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", k, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "kind": + err = unpopulate(val, "Kind", &k.Kind) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", k, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ListCustomAlertRule. +func (l ListCustomAlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", l.Description) + populate(objectMap, "displayName", l.DisplayName) + populate(objectMap, "isEnabled", l.IsEnabled) + objectMap["ruleType"] = "ListCustomAlertRule" + populate(objectMap, "valueType", l.ValueType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ListCustomAlertRule. +func (l *ListCustomAlertRule) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &l.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &l.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &l.IsEnabled) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &l.RuleType) + delete(rawMsg, key) + case "valueType": + err = unpopulate(val, "ValueType", &l.ValueType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LocalUserNotAllowed. +func (l LocalUserNotAllowed) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowlistValues", l.AllowlistValues) + populate(objectMap, "description", l.Description) + populate(objectMap, "displayName", l.DisplayName) + populate(objectMap, "isEnabled", l.IsEnabled) + objectMap["ruleType"] = "LocalUserNotAllowed" + populate(objectMap, "valueType", l.ValueType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LocalUserNotAllowed. +func (l *LocalUserNotAllowed) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "allowlistValues": + err = unpopulate(val, "AllowlistValues", &l.AllowlistValues) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &l.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &l.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &l.IsEnabled) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &l.RuleType) + delete(rawMsg, key) + case "valueType": + err = unpopulate(val, "ValueType", &l.ValueType) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type Location. +func (l Location) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "location", l.Location) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Location. +func (l *Location) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, "Location", &l.Location) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type LogAnalyticsIdentifier. +func (l LogAnalyticsIdentifier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "agentId", l.AgentID) + objectMap["type"] = ResourceIdentifierTypeLogAnalytics + populate(objectMap, "workspaceId", l.WorkspaceID) + populate(objectMap, "workspaceResourceGroup", l.WorkspaceResourceGroup) + populate(objectMap, "workspaceSubscriptionId", l.WorkspaceSubscriptionID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type LogAnalyticsIdentifier. +func (l *LogAnalyticsIdentifier) 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", l, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "agentId": + err = unpopulate(val, "AgentID", &l.AgentID) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &l.Type) + delete(rawMsg, key) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &l.WorkspaceID) + delete(rawMsg, key) + case "workspaceResourceGroup": + err = unpopulate(val, "WorkspaceResourceGroup", &l.WorkspaceResourceGroup) + delete(rawMsg, key) + case "workspaceSubscriptionId": + err = unpopulate(val, "WorkspaceSubscriptionID", &l.WorkspaceSubscriptionID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", l, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type MdeOnboardingData. +func (m MdeOnboardingData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", m.ID) + populate(objectMap, "name", m.Name) + populate(objectMap, "properties", m.Properties) + populate(objectMap, "type", m.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MdeOnboardingData. +func (m *MdeOnboardingData) 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 "name": + err = unpopulate(val, "Name", &m.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &m.Properties) + 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 MdeOnboardingDataList. +func (m MdeOnboardingDataList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MdeOnboardingDataList. +func (m *MdeOnboardingDataList) 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 "value": + err = unpopulate(val, "Value", &m.Value) + 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 MdeOnboardingDataProperties. +func (m MdeOnboardingDataProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateByteArray(objectMap, "onboardingPackageLinux", m.OnboardingPackageLinux, runtime.Base64StdFormat) + populateByteArray(objectMap, "onboardingPackageWindows", m.OnboardingPackageWindows, runtime.Base64StdFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MdeOnboardingDataProperties. +func (m *MdeOnboardingDataProperties) 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 "onboardingPackageLinux": + err = runtime.DecodeByteArray(string(val), &m.OnboardingPackageLinux, runtime.Base64StdFormat) + delete(rawMsg, key) + case "onboardingPackageWindows": + err = runtime.DecodeByteArray(string(val), &m.OnboardingPackageWindows, runtime.Base64StdFormat) + 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 MqttC2DMessagesNotInAllowedRange. +func (m MqttC2DMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", m.Description) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "isEnabled", m.IsEnabled) + populate(objectMap, "maxThreshold", m.MaxThreshold) + populate(objectMap, "minThreshold", m.MinThreshold) + objectMap["ruleType"] = "MqttC2DMessagesNotInAllowedRange" + populate(objectMap, "timeWindowSize", m.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MqttC2DMessagesNotInAllowedRange. +func (m *MqttC2DMessagesNotInAllowedRange) 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 "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &m.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &m.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &m.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &m.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &m.TimeWindowSize) + 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 MqttC2DRejectedMessagesNotInAllowedRange. +func (m MqttC2DRejectedMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", m.Description) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "isEnabled", m.IsEnabled) + populate(objectMap, "maxThreshold", m.MaxThreshold) + populate(objectMap, "minThreshold", m.MinThreshold) + objectMap["ruleType"] = "MqttC2DRejectedMessagesNotInAllowedRange" + populate(objectMap, "timeWindowSize", m.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MqttC2DRejectedMessagesNotInAllowedRange. +func (m *MqttC2DRejectedMessagesNotInAllowedRange) 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 "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &m.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &m.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &m.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &m.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &m.TimeWindowSize) + 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 MqttD2CMessagesNotInAllowedRange. +func (m MqttD2CMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", m.Description) + populate(objectMap, "displayName", m.DisplayName) + populate(objectMap, "isEnabled", m.IsEnabled) + populate(objectMap, "maxThreshold", m.MaxThreshold) + populate(objectMap, "minThreshold", m.MinThreshold) + objectMap["ruleType"] = "MqttD2CMessagesNotInAllowedRange" + populate(objectMap, "timeWindowSize", m.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MqttD2CMessagesNotInAllowedRange. +func (m *MqttD2CMessagesNotInAllowedRange) 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 "description": + err = unpopulate(val, "Description", &m.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &m.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &m.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &m.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &m.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &m.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &m.TimeWindowSize) + 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 OnPremiseResourceDetails. +func (o OnPremiseResourceDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "machineName", o.MachineName) + objectMap["source"] = SourceOnPremise + populate(objectMap, "sourceComputerId", o.SourceComputerID) + populate(objectMap, "vmuuid", o.Vmuuid) + populate(objectMap, "workspaceId", o.WorkspaceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OnPremiseResourceDetails. +func (o *OnPremiseResourceDetails) 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 "machineName": + err = unpopulate(val, "MachineName", &o.MachineName) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &o.Source) + delete(rawMsg, key) + case "sourceComputerId": + err = unpopulate(val, "SourceComputerID", &o.SourceComputerID) + delete(rawMsg, key) + case "vmuuid": + err = unpopulate(val, "Vmuuid", &o.Vmuuid) + delete(rawMsg, key) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &o.WorkspaceID) + 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 OnPremiseSQLResourceDetails. +func (o OnPremiseSQLResourceDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "databaseName", o.DatabaseName) + populate(objectMap, "machineName", o.MachineName) + populate(objectMap, "serverName", o.ServerName) + objectMap["source"] = SourceOnPremiseSQL + populate(objectMap, "sourceComputerId", o.SourceComputerID) + populate(objectMap, "vmuuid", o.Vmuuid) + populate(objectMap, "workspaceId", o.WorkspaceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OnPremiseSQLResourceDetails. +func (o *OnPremiseSQLResourceDetails) 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 "databaseName": + err = unpopulate(val, "DatabaseName", &o.DatabaseName) + delete(rawMsg, key) + case "machineName": + err = unpopulate(val, "MachineName", &o.MachineName) + delete(rawMsg, key) + case "serverName": + err = unpopulate(val, "ServerName", &o.ServerName) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &o.Source) + delete(rawMsg, key) + case "sourceComputerId": + err = unpopulate(val, "SourceComputerID", &o.SourceComputerID) + delete(rawMsg, key) + case "vmuuid": + err = unpopulate(val, "Vmuuid", &o.Vmuuid) + delete(rawMsg, key) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &o.WorkspaceID) + 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]interface{}) + populate(objectMap, "display", o.Display) + 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 "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]interface{}) + 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 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) + } + for key, val := range rawMsg { + var err error + switch key { + 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 { + return fmt.Errorf("unmarshalling type %T: %v", o, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type OperationList. +func (o OperationList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", o.NextLink) + populate(objectMap, "value", o.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationList. +func (o *OperationList) 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 "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 PathRecommendation. +func (p PathRecommendation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "action", p.Action) + populate(objectMap, "common", p.Common) + populate(objectMap, "configurationStatus", p.ConfigurationStatus) + populate(objectMap, "fileType", p.FileType) + populate(objectMap, "path", p.Path) + populate(objectMap, "publisherInfo", p.PublisherInfo) + populate(objectMap, "type", p.Type) + populate(objectMap, "userSids", p.UserSids) + populate(objectMap, "usernames", p.Usernames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PathRecommendation. +func (p *PathRecommendation) 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 "action": + err = unpopulate(val, "Action", &p.Action) + delete(rawMsg, key) + case "common": + err = unpopulate(val, "Common", &p.Common) + delete(rawMsg, key) + case "configurationStatus": + err = unpopulate(val, "ConfigurationStatus", &p.ConfigurationStatus) + delete(rawMsg, key) + case "fileType": + err = unpopulate(val, "FileType", &p.FileType) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &p.Path) + delete(rawMsg, key) + case "publisherInfo": + err = unpopulate(val, "PublisherInfo", &p.PublisherInfo) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &p.Type) + delete(rawMsg, key) + case "userSids": + err = unpopulate(val, "UserSids", &p.UserSids) + delete(rawMsg, key) + case "usernames": + err = unpopulate(val, "Usernames", &p.Usernames) + 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 Pricing. +func (p Pricing) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Pricing. +func (p *Pricing) 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 "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + 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 PricingList. +func (p PricingList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PricingList. +func (p *PricingList) 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 "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 PricingProperties. +func (p PricingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deprecated", p.Deprecated) + populate(objectMap, "freeTrialRemainingTime", p.FreeTrialRemainingTime) + populate(objectMap, "pricingTier", p.PricingTier) + populate(objectMap, "replacedBy", p.ReplacedBy) + populate(objectMap, "subPlan", p.SubPlan) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PricingProperties. +func (p *PricingProperties) 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 "deprecated": + err = unpopulate(val, "Deprecated", &p.Deprecated) + delete(rawMsg, key) + case "freeTrialRemainingTime": + err = unpopulate(val, "FreeTrialRemainingTime", &p.FreeTrialRemainingTime) + delete(rawMsg, key) + case "pricingTier": + err = unpopulate(val, "PricingTier", &p.PricingTier) + delete(rawMsg, key) + case "replacedBy": + err = unpopulate(val, "ReplacedBy", &p.ReplacedBy) + delete(rawMsg, key) + case "subPlan": + err = unpopulate(val, "SubPlan", &p.SubPlan) + 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 ProcessNotAllowed. +func (p ProcessNotAllowed) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allowlistValues", p.AllowlistValues) + populate(objectMap, "description", p.Description) + populate(objectMap, "displayName", p.DisplayName) + populate(objectMap, "isEnabled", p.IsEnabled) + objectMap["ruleType"] = "ProcessNotAllowed" + populate(objectMap, "valueType", p.ValueType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProcessNotAllowed. +func (p *ProcessNotAllowed) 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 "allowlistValues": + err = unpopulate(val, "AllowlistValues", &p.AllowlistValues) + 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 "isEnabled": + err = unpopulate(val, "IsEnabled", &p.IsEnabled) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &p.RuleType) + delete(rawMsg, key) + case "valueType": + err = unpopulate(val, "ValueType", &p.ValueType) + 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 ProtectionMode. +func (p ProtectionMode) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "exe", p.Exe) + populate(objectMap, "executable", p.Executable) + populate(objectMap, "msi", p.Msi) + populate(objectMap, "script", p.Script) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectionMode. +func (p *ProtectionMode) 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 "exe": + err = unpopulate(val, "Exe", &p.Exe) + delete(rawMsg, key) + case "executable": + err = unpopulate(val, "Executable", &p.Executable) + delete(rawMsg, key) + case "msi": + err = unpopulate(val, "Msi", &p.Msi) + delete(rawMsg, key) + case "script": + err = unpopulate(val, "Script", &p.Script) + 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 ProxyServerProperties. +func (p ProxyServerProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ip", p.IP) + populate(objectMap, "port", p.Port) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyServerProperties. +func (p *ProxyServerProperties) 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 "ip": + err = unpopulate(val, "IP", &p.IP) + delete(rawMsg, key) + case "port": + err = unpopulate(val, "Port", &p.Port) + 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 PublisherInfo. +func (p PublisherInfo) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "binaryName", p.BinaryName) + populate(objectMap, "productName", p.ProductName) + populate(objectMap, "publisherName", p.PublisherName) + populate(objectMap, "version", p.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PublisherInfo. +func (p *PublisherInfo) 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 "binaryName": + err = unpopulate(val, "BinaryName", &p.BinaryName) + delete(rawMsg, key) + case "productName": + err = unpopulate(val, "ProductName", &p.ProductName) + delete(rawMsg, key) + case "publisherName": + err = unpopulate(val, "PublisherName", &p.PublisherName) + 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 QueryCheck. +func (q QueryCheck) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "columnNames", q.ColumnNames) + populate(objectMap, "expectedResult", q.ExpectedResult) + populate(objectMap, "query", q.Query) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueryCheck. +func (q *QueryCheck) 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", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "columnNames": + err = unpopulate(val, "ColumnNames", &q.ColumnNames) + delete(rawMsg, key) + case "expectedResult": + err = unpopulate(val, "ExpectedResult", &q.ExpectedResult) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &q.Query) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type QueuePurgesNotInAllowedRange. +func (q QueuePurgesNotInAllowedRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", q.Description) + populate(objectMap, "displayName", q.DisplayName) + populate(objectMap, "isEnabled", q.IsEnabled) + populate(objectMap, "maxThreshold", q.MaxThreshold) + populate(objectMap, "minThreshold", q.MinThreshold) + objectMap["ruleType"] = "QueuePurgesNotInAllowedRange" + populate(objectMap, "timeWindowSize", q.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type QueuePurgesNotInAllowedRange. +func (q *QueuePurgesNotInAllowedRange) 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", q, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &q.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &q.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &q.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &q.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &q.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &q.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &q.TimeWindowSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", q, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type RecommendationConfigurationProperties. +func (r RecommendationConfigurationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", r.Name) + populate(objectMap, "recommendationType", r.RecommendationType) + populate(objectMap, "status", r.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RecommendationConfigurationProperties. +func (r *RecommendationConfigurationProperties) 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 "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "recommendationType": + err = unpopulate(val, "RecommendationType", &r.RecommendationType) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &r.Status) + 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 RegulatoryComplianceAssessment. +func (r RegulatoryComplianceAssessment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceAssessment. +func (r *RegulatoryComplianceAssessment) 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 "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + 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 RegulatoryComplianceAssessmentList. +func (r RegulatoryComplianceAssessmentList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceAssessmentList. +func (r *RegulatoryComplianceAssessmentList) 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 RegulatoryComplianceAssessmentProperties. +func (r RegulatoryComplianceAssessmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assessmentDetailsLink", r.AssessmentDetailsLink) + populate(objectMap, "assessmentType", r.AssessmentType) + populate(objectMap, "description", r.Description) + populate(objectMap, "failedResources", r.FailedResources) + populate(objectMap, "passedResources", r.PassedResources) + populate(objectMap, "skippedResources", r.SkippedResources) + populate(objectMap, "state", r.State) + populate(objectMap, "unsupportedResources", r.UnsupportedResources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceAssessmentProperties. +func (r *RegulatoryComplianceAssessmentProperties) 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 "assessmentDetailsLink": + err = unpopulate(val, "AssessmentDetailsLink", &r.AssessmentDetailsLink) + delete(rawMsg, key) + case "assessmentType": + err = unpopulate(val, "AssessmentType", &r.AssessmentType) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "failedResources": + err = unpopulate(val, "FailedResources", &r.FailedResources) + delete(rawMsg, key) + case "passedResources": + err = unpopulate(val, "PassedResources", &r.PassedResources) + delete(rawMsg, key) + case "skippedResources": + err = unpopulate(val, "SkippedResources", &r.SkippedResources) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &r.State) + delete(rawMsg, key) + case "unsupportedResources": + err = unpopulate(val, "UnsupportedResources", &r.UnsupportedResources) + 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 RegulatoryComplianceControl. +func (r RegulatoryComplianceControl) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceControl. +func (r *RegulatoryComplianceControl) 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 "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + 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 RegulatoryComplianceControlList. +func (r RegulatoryComplianceControlList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceControlList. +func (r *RegulatoryComplianceControlList) 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 RegulatoryComplianceControlProperties. +func (r RegulatoryComplianceControlProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", r.Description) + populate(objectMap, "failedAssessments", r.FailedAssessments) + populate(objectMap, "passedAssessments", r.PassedAssessments) + populate(objectMap, "skippedAssessments", r.SkippedAssessments) + populate(objectMap, "state", r.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceControlProperties. +func (r *RegulatoryComplianceControlProperties) 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 "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "failedAssessments": + err = unpopulate(val, "FailedAssessments", &r.FailedAssessments) + delete(rawMsg, key) + case "passedAssessments": + err = unpopulate(val, "PassedAssessments", &r.PassedAssessments) + delete(rawMsg, key) + case "skippedAssessments": + err = unpopulate(val, "SkippedAssessments", &r.SkippedAssessments) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &r.State) + 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 RegulatoryComplianceStandard. +func (r RegulatoryComplianceStandard) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceStandard. +func (r *RegulatoryComplianceStandard) 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 "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + 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 RegulatoryComplianceStandardList. +func (r RegulatoryComplianceStandardList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", r.NextLink) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceStandardList. +func (r *RegulatoryComplianceStandardList) 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 RegulatoryComplianceStandardProperties. +func (r RegulatoryComplianceStandardProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "failedControls", r.FailedControls) + populate(objectMap, "passedControls", r.PassedControls) + populate(objectMap, "skippedControls", r.SkippedControls) + populate(objectMap, "state", r.State) + populate(objectMap, "unsupportedControls", r.UnsupportedControls) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RegulatoryComplianceStandardProperties. +func (r *RegulatoryComplianceStandardProperties) 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 "failedControls": + err = unpopulate(val, "FailedControls", &r.FailedControls) + delete(rawMsg, key) + case "passedControls": + err = unpopulate(val, "PassedControls", &r.PassedControls) + delete(rawMsg, key) + case "skippedControls": + err = unpopulate(val, "SkippedControls", &r.SkippedControls) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &r.State) + delete(rawMsg, key) + case "unsupportedControls": + err = unpopulate(val, "UnsupportedControls", &r.UnsupportedControls) + 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 Remediation. +func (r Remediation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "automated", r.Automated) + populate(objectMap, "description", r.Description) + populate(objectMap, "portalLink", r.PortalLink) + populate(objectMap, "scripts", r.Scripts) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Remediation. +func (r *Remediation) 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 "automated": + err = unpopulate(val, "Automated", &r.Automated) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &r.Description) + delete(rawMsg, key) + case "portalLink": + err = unpopulate(val, "PortalLink", &r.PortalLink) + delete(rawMsg, key) + case "scripts": + err = unpopulate(val, "Scripts", &r.Scripts) + 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 RemediationEta. +func (r RemediationEta) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "eta", r.Eta) + populate(objectMap, "justification", r.Justification) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RemediationEta. +func (r *RemediationEta) 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 "eta": + err = unpopulateTimeRFC3339(val, "Eta", &r.Eta) + delete(rawMsg, key) + case "justification": + err = unpopulate(val, "Justification", &r.Justification) + 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 Resource. +func (r Resource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) 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 "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + 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 ResourceDetails. +func (r ResourceDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["source"] = r.Source + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceDetails. +func (r *ResourceDetails) 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 "source": + err = unpopulate(val, "Source", &r.Source) + 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 ResourceIdentifier. +func (r ResourceIdentifier) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["type"] = r.Type + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceIdentifier. +func (r *ResourceIdentifier) 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 "type": + err = unpopulate(val, "Type", &r.Type) + 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 Rule. +func (r Rule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinationPort", r.DestinationPort) + populate(objectMap, "direction", r.Direction) + populate(objectMap, "ipAddresses", r.IPAddresses) + populate(objectMap, "name", r.Name) + populate(objectMap, "protocols", r.Protocols) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Rule. +func (r *Rule) 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 "destinationPort": + err = unpopulate(val, "DestinationPort", &r.DestinationPort) + delete(rawMsg, key) + case "direction": + err = unpopulate(val, "Direction", &r.Direction) + delete(rawMsg, key) + case "ipAddresses": + err = unpopulate(val, "IPAddresses", &r.IPAddresses) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "protocols": + err = unpopulate(val, "Protocols", &r.Protocols) + 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 RuleResults. +func (r RuleResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", r.ID) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleResults. +func (r *RuleResults) 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 "id": + err = unpopulate(val, "ID", &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &r.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &r.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &r.Type) + 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 RuleResultsInput. +func (r RuleResultsInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "latestScan", r.LatestScan) + populate(objectMap, "results", r.Results) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleResultsInput. +func (r *RuleResultsInput) 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 "latestScan": + err = unpopulate(val, "LatestScan", &r.LatestScan) + delete(rawMsg, key) + case "results": + err = unpopulate(val, "Results", &r.Results) + 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 RuleResultsProperties. +func (r RuleResultsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "results", r.Results) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RuleResultsProperties. +func (r *RuleResultsProperties) 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 "results": + err = unpopulate(val, "Results", &r.Results) + 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 RulesResults. +func (r RulesResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", r.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RulesResults. +func (r *RulesResults) 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 "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 RulesResultsInput. +func (r RulesResultsInput) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "latestScan", r.LatestScan) + populate(objectMap, "results", r.Results) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type RulesResultsInput. +func (r *RulesResultsInput) 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 "latestScan": + err = unpopulate(val, "LatestScan", &r.LatestScan) + delete(rawMsg, key) + case "results": + err = unpopulate(val, "Results", &r.Results) + 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 SQLServerVulnerabilityProperties. +func (s SQLServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["assessedResourceType"] = AssessedResourceTypeSQLServerVulnerability + populate(objectMap, "query", s.Query) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerVulnerabilityProperties. +func (s *SQLServerVulnerabilityProperties) 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 "assessedResourceType": + err = unpopulate(val, "AssessedResourceType", &s.AssessedResourceType) + delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &s.Query) + 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 Scan. +func (s Scan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Scan. +func (s *Scan) 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 "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 "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 ScanProperties. +func (s ScanProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "database", s.Database) + populateTimeRFC3339(objectMap, "endTime", s.EndTime) + populate(objectMap, "highSeverityFailedRulesCount", s.HighSeverityFailedRulesCount) + populate(objectMap, "isBaselineApplied", s.IsBaselineApplied) + populate(objectMap, "lowSeverityFailedRulesCount", s.LowSeverityFailedRulesCount) + populate(objectMap, "mediumSeverityFailedRulesCount", s.MediumSeverityFailedRulesCount) + populate(objectMap, "sqlVersion", s.SQLVersion) + populate(objectMap, "server", s.Server) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) + populate(objectMap, "state", s.State) + populate(objectMap, "totalFailedRulesCount", s.TotalFailedRulesCount) + populate(objectMap, "totalPassedRulesCount", s.TotalPassedRulesCount) + populate(objectMap, "totalRulesCount", s.TotalRulesCount) + populate(objectMap, "triggerType", s.TriggerType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScanProperties. +func (s *ScanProperties) 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 "database": + err = unpopulate(val, "Database", &s.Database) + delete(rawMsg, key) + case "endTime": + err = unpopulateTimeRFC3339(val, "EndTime", &s.EndTime) + delete(rawMsg, key) + case "highSeverityFailedRulesCount": + err = unpopulate(val, "HighSeverityFailedRulesCount", &s.HighSeverityFailedRulesCount) + delete(rawMsg, key) + case "isBaselineApplied": + err = unpopulate(val, "IsBaselineApplied", &s.IsBaselineApplied) + delete(rawMsg, key) + case "lowSeverityFailedRulesCount": + err = unpopulate(val, "LowSeverityFailedRulesCount", &s.LowSeverityFailedRulesCount) + delete(rawMsg, key) + case "mediumSeverityFailedRulesCount": + err = unpopulate(val, "MediumSeverityFailedRulesCount", &s.MediumSeverityFailedRulesCount) + delete(rawMsg, key) + case "sqlVersion": + err = unpopulate(val, "SQLVersion", &s.SQLVersion) + delete(rawMsg, key) + case "server": + err = unpopulate(val, "Server", &s.Server) + delete(rawMsg, key) + case "startTime": + err = unpopulateTimeRFC3339(val, "StartTime", &s.StartTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &s.State) + delete(rawMsg, key) + case "totalFailedRulesCount": + err = unpopulate(val, "TotalFailedRulesCount", &s.TotalFailedRulesCount) + delete(rawMsg, key) + case "totalPassedRulesCount": + err = unpopulate(val, "TotalPassedRulesCount", &s.TotalPassedRulesCount) + delete(rawMsg, key) + case "totalRulesCount": + err = unpopulate(val, "TotalRulesCount", &s.TotalRulesCount) + delete(rawMsg, key) + case "triggerType": + err = unpopulate(val, "TriggerType", &s.TriggerType) + 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 ScanResult. +func (s ScanResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScanResult. +func (s *ScanResult) 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 "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 "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 ScanResultProperties. +func (s ScanResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "baselineAdjustedResult", s.BaselineAdjustedResult) + populate(objectMap, "isTrimmed", s.IsTrimmed) + populate(objectMap, "queryResults", s.QueryResults) + populate(objectMap, "remediation", s.Remediation) + populate(objectMap, "ruleId", s.RuleID) + populate(objectMap, "ruleMetadata", s.RuleMetadata) + populate(objectMap, "status", s.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScanResultProperties. +func (s *ScanResultProperties) 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 "baselineAdjustedResult": + err = unpopulate(val, "BaselineAdjustedResult", &s.BaselineAdjustedResult) + delete(rawMsg, key) + case "isTrimmed": + err = unpopulate(val, "IsTrimmed", &s.IsTrimmed) + delete(rawMsg, key) + case "queryResults": + err = unpopulate(val, "QueryResults", &s.QueryResults) + delete(rawMsg, key) + case "remediation": + err = unpopulate(val, "Remediation", &s.Remediation) + delete(rawMsg, key) + case "ruleId": + err = unpopulate(val, "RuleID", &s.RuleID) + delete(rawMsg, key) + case "ruleMetadata": + err = unpopulate(val, "RuleMetadata", &s.RuleMetadata) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + 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 ScanResults. +func (s ScanResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScanResults. +func (s *ScanResults) 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 Scans. +func (s Scans) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Scans. +func (s *Scans) 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 ScopeElement. +func (s ScopeElement) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "field", s.Field) + if s.AdditionalProperties != nil { + for key, val := range s.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeElement. +func (s *ScopeElement) 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 "field": + err = unpopulate(val, "Field", &s.Field) + delete(rawMsg, key) + default: + if s.AdditionalProperties == nil { + s.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + s.AdditionalProperties[key] = aux + } + 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 ScoreDetails. +func (s ScoreDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "current", s.Current) + populate(objectMap, "max", s.Max) + populate(objectMap, "percentage", s.Percentage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScoreDetails. +func (s *ScoreDetails) 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 "current": + err = unpopulate(val, "Current", &s.Current) + delete(rawMsg, key) + case "max": + err = unpopulate(val, "Max", &s.Max) + delete(rawMsg, key) + case "percentage": + err = unpopulate(val, "Percentage", &s.Percentage) + 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 SecureScoreControlDefinitionItem. +func (s SecureScoreControlDefinitionItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoreControlDefinitionItem. +func (s *SecureScoreControlDefinitionItem) 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 "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 "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 SecureScoreControlDefinitionItemProperties. +func (s SecureScoreControlDefinitionItemProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "assessmentDefinitions", s.AssessmentDefinitions) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "maxScore", s.MaxScore) + populate(objectMap, "source", s.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoreControlDefinitionItemProperties. +func (s *SecureScoreControlDefinitionItemProperties) 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 "assessmentDefinitions": + err = unpopulate(val, "AssessmentDefinitions", &s.AssessmentDefinitions) + 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 "maxScore": + err = unpopulate(val, "MaxScore", &s.MaxScore) + delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &s.Source) + 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 SecureScoreControlDefinitionList. +func (s SecureScoreControlDefinitionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoreControlDefinitionList. +func (s *SecureScoreControlDefinitionList) 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": + 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 SecureScoreControlDefinitionSource. +func (s SecureScoreControlDefinitionSource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "sourceType", s.SourceType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoreControlDefinitionSource. +func (s *SecureScoreControlDefinitionSource) 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 "sourceType": + err = unpopulate(val, "SourceType", &s.SourceType) + 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 SecureScoreControlDetails. +func (s SecureScoreControlDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoreControlDetails. +func (s *SecureScoreControlDetails) 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 "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 "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 SecureScoreControlList. +func (s SecureScoreControlList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoreControlList. +func (s *SecureScoreControlList) 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": + 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 SecureScoreControlScore. +func (s SecureScoreControlScore) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "current", s.Current) + populate(objectMap, "max", s.Max) + populate(objectMap, "percentage", s.Percentage) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoreControlScore. +func (s *SecureScoreControlScore) 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 "current": + err = unpopulate(val, "Current", &s.Current) + delete(rawMsg, key) + case "max": + err = unpopulate(val, "Max", &s.Max) + delete(rawMsg, key) + case "percentage": + err = unpopulate(val, "Percentage", &s.Percentage) + 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 SecureScoreControlScoreDetails. +func (s SecureScoreControlScoreDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "definition", s.Definition) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "healthyResourceCount", s.HealthyResourceCount) + populate(objectMap, "notApplicableResourceCount", s.NotApplicableResourceCount) + populate(objectMap, "score", s.Score) + populate(objectMap, "unhealthyResourceCount", s.UnhealthyResourceCount) + populate(objectMap, "weight", s.Weight) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoreControlScoreDetails. +func (s *SecureScoreControlScoreDetails) 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 "definition": + err = unpopulate(val, "Definition", &s.Definition) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "healthyResourceCount": + err = unpopulate(val, "HealthyResourceCount", &s.HealthyResourceCount) + delete(rawMsg, key) + case "notApplicableResourceCount": + err = unpopulate(val, "NotApplicableResourceCount", &s.NotApplicableResourceCount) + delete(rawMsg, key) + case "score": + err = unpopulate(val, "Score", &s.Score) + delete(rawMsg, key) + case "unhealthyResourceCount": + err = unpopulate(val, "UnhealthyResourceCount", &s.UnhealthyResourceCount) + delete(rawMsg, key) + case "weight": + err = unpopulate(val, "Weight", &s.Weight) + 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 SecureScoreItem. +func (s SecureScoreItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoreItem. +func (s *SecureScoreItem) 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 "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 "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 SecureScoreItemProperties. +func (s SecureScoreItemProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "score", s.Score) + populate(objectMap, "weight", s.Weight) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoreItemProperties. +func (s *SecureScoreItemProperties) 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 "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "score": + err = unpopulate(val, "Score", &s.Score) + delete(rawMsg, key) + case "weight": + err = unpopulate(val, "Weight", &s.Weight) + 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 SecureScoresList. +func (s SecureScoresList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecureScoresList. +func (s *SecureScoresList) 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": + 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 SensitivityLabel. +func (s SensitivityLabel) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "enabled", s.Enabled) + populate(objectMap, "order", s.Order) + populate(objectMap, "rank", s.Rank) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SensitivityLabel. +func (s *SensitivityLabel) 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 "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) + delete(rawMsg, key) + case "enabled": + err = unpopulate(val, "Enabled", &s.Enabled) + delete(rawMsg, key) + case "order": + err = unpopulate(val, "Order", &s.Order) + delete(rawMsg, key) + case "rank": + err = unpopulate(val, "Rank", &s.Rank) + 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 ServerVulnerabilityAssessment. +func (s ServerVulnerabilityAssessment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessment. +func (s *ServerVulnerabilityAssessment) 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 "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 "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 ServerVulnerabilityAssessmentProperties. +func (s ServerVulnerabilityAssessmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", s.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessmentProperties. +func (s *ServerVulnerabilityAssessmentProperties) 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 "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + 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 ServerVulnerabilityAssessmentsList. +func (s ServerVulnerabilityAssessmentsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessmentsList. +func (s *ServerVulnerabilityAssessmentsList) 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 ServerVulnerabilityProperties. +func (s ServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + objectMap["assessedResourceType"] = "ServerVulnerabilityAssessment" + populate(objectMap, "cve", s.Cve) + populate(objectMap, "cvss", s.Cvss) + populate(objectMap, "patchable", s.Patchable) + populateTimeRFC3339(objectMap, "publishedTime", s.PublishedTime) + populate(objectMap, "threat", s.Threat) + populate(objectMap, "type", s.Type) + populate(objectMap, "vendorReferences", s.VendorReferences) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityProperties. +func (s *ServerVulnerabilityProperties) 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 "assessedResourceType": + err = unpopulate(val, "AssessedResourceType", &s.AssessedResourceType) + delete(rawMsg, key) + case "cve": + err = unpopulate(val, "Cve", &s.Cve) + delete(rawMsg, key) + case "cvss": + err = unpopulate(val, "Cvss", &s.Cvss) + delete(rawMsg, key) + case "patchable": + err = unpopulate(val, "Patchable", &s.Patchable) + delete(rawMsg, key) + case "publishedTime": + err = unpopulateTimeRFC3339(val, "PublishedTime", &s.PublishedTime) + delete(rawMsg, key) + case "threat": + err = unpopulate(val, "Threat", &s.Threat) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + case "vendorReferences": + err = unpopulate(val, "VendorReferences", &s.VendorReferences) + 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 ServicePrincipalProperties. +func (s ServicePrincipalProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "applicationId", s.ApplicationID) + populate(objectMap, "secret", s.Secret) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServicePrincipalProperties. +func (s *ServicePrincipalProperties) 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 "applicationId": + err = unpopulate(val, "ApplicationID", &s.ApplicationID) + delete(rawMsg, key) + case "secret": + err = unpopulate(val, "Secret", &s.Secret) + 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 Setting. +func (s Setting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + objectMap["kind"] = s.Kind + populate(objectMap, "name", s.Name) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Setting. +func (s *Setting) 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 "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 "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 SettingsList. +func (s SettingsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SettingsList. +func (s *SettingsList) 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 = unmarshalSettingClassificationArray(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 Software. +func (s Software) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Software. +func (s *Software) 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 "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 "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 SoftwareProperties. +func (s SoftwareProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "deviceId", s.DeviceID) + populate(objectMap, "endOfSupportDate", s.EndOfSupportDate) + populate(objectMap, "endOfSupportStatus", s.EndOfSupportStatus) + populate(objectMap, "firstSeenAt", s.FirstSeenAt) + populate(objectMap, "numberOfKnownVulnerabilities", s.NumberOfKnownVulnerabilities) + populate(objectMap, "osPlatform", s.OSPlatform) + populate(objectMap, "softwareName", s.SoftwareName) + populate(objectMap, "vendor", s.Vendor) + populate(objectMap, "version", s.Version) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SoftwareProperties. +func (s *SoftwareProperties) 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 "deviceId": + err = unpopulate(val, "DeviceID", &s.DeviceID) + delete(rawMsg, key) + case "endOfSupportDate": + err = unpopulate(val, "EndOfSupportDate", &s.EndOfSupportDate) + delete(rawMsg, key) + case "endOfSupportStatus": + err = unpopulate(val, "EndOfSupportStatus", &s.EndOfSupportStatus) + delete(rawMsg, key) + case "firstSeenAt": + err = unpopulate(val, "FirstSeenAt", &s.FirstSeenAt) + delete(rawMsg, key) + case "numberOfKnownVulnerabilities": + err = unpopulate(val, "NumberOfKnownVulnerabilities", &s.NumberOfKnownVulnerabilities) + delete(rawMsg, key) + case "osPlatform": + err = unpopulate(val, "OSPlatform", &s.OSPlatform) + delete(rawMsg, key) + case "softwareName": + err = unpopulate(val, "SoftwareName", &s.SoftwareName) + delete(rawMsg, key) + case "vendor": + err = unpopulate(val, "Vendor", &s.Vendor) + delete(rawMsg, key) + case "version": + err = unpopulate(val, "Version", &s.Version) + 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 SoftwaresList. +func (s SoftwaresList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SoftwaresList. +func (s *SoftwaresList) 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": + 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 Solution. +func (s Solution) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Solution. +func (s *Solution) 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 "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + 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 "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 SolutionList. +func (s SolutionList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionList. +func (s *SolutionList) 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": + 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 SolutionProperties. +func (s SolutionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "protectionStatus", s.ProtectionStatus) + populate(objectMap, "provisioningState", s.ProvisioningState) + populate(objectMap, "securityFamily", s.SecurityFamily) + populate(objectMap, "template", s.Template) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionProperties. +func (s *SolutionProperties) 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 "protectionStatus": + err = unpopulate(val, "ProtectionStatus", &s.ProtectionStatus) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &s.ProvisioningState) + delete(rawMsg, key) + case "securityFamily": + err = unpopulate(val, "SecurityFamily", &s.SecurityFamily) + delete(rawMsg, key) + case "template": + err = unpopulate(val, "Template", &s.Template) + 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 SolutionsReferenceData. +func (s SolutionsReferenceData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionsReferenceData. +func (s *SolutionsReferenceData) 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 "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &s.Location) + 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 "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 SolutionsReferenceDataList. +func (s SolutionsReferenceDataList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionsReferenceDataList. +func (s *SolutionsReferenceDataList) 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 SolutionsReferenceDataProperties. +func (s SolutionsReferenceDataProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "alertVendorName", s.AlertVendorName) + populate(objectMap, "packageInfoUrl", s.PackageInfoURL) + populate(objectMap, "productName", s.ProductName) + populate(objectMap, "publisher", s.Publisher) + populate(objectMap, "publisherDisplayName", s.PublisherDisplayName) + populate(objectMap, "securityFamily", s.SecurityFamily) + populate(objectMap, "template", s.Template) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionsReferenceDataProperties. +func (s *SolutionsReferenceDataProperties) 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 "alertVendorName": + err = unpopulate(val, "AlertVendorName", &s.AlertVendorName) + delete(rawMsg, key) + case "packageInfoUrl": + err = unpopulate(val, "PackageInfoURL", &s.PackageInfoURL) + delete(rawMsg, key) + case "productName": + err = unpopulate(val, "ProductName", &s.ProductName) + delete(rawMsg, key) + case "publisher": + err = unpopulate(val, "Publisher", &s.Publisher) + delete(rawMsg, key) + case "publisherDisplayName": + err = unpopulate(val, "PublisherDisplayName", &s.PublisherDisplayName) + delete(rawMsg, key) + case "securityFamily": + err = unpopulate(val, "SecurityFamily", &s.SecurityFamily) + delete(rawMsg, key) + case "template": + err = unpopulate(val, "Template", &s.Template) + 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 SubAssessment. +func (s SubAssessment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubAssessment. +func (s *SubAssessment) 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 "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 "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 SubAssessmentList. +func (s SubAssessmentList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubAssessmentList. +func (s *SubAssessmentList) 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": + 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 SubAssessmentProperties. +func (s SubAssessmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalData", s.AdditionalData) + populate(objectMap, "category", s.Category) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "id", s.ID) + populate(objectMap, "impact", s.Impact) + populate(objectMap, "remediation", s.Remediation) + populate(objectMap, "resourceDetails", s.ResourceDetails) + populate(objectMap, "status", s.Status) + populateTimeRFC3339(objectMap, "timeGenerated", s.TimeGenerated) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubAssessmentProperties. +func (s *SubAssessmentProperties) 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": + s.AdditionalData, err = unmarshalAdditionalDataClassification(val) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &s.Category) + 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 "impact": + err = unpopulate(val, "Impact", &s.Impact) + delete(rawMsg, key) + case "remediation": + err = unpopulate(val, "Remediation", &s.Remediation) + delete(rawMsg, key) + case "resourceDetails": + s.ResourceDetails, err = unmarshalResourceDetailsClassification(val) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &s.Status) + delete(rawMsg, key) + case "timeGenerated": + err = unpopulateTimeRFC3339(val, "TimeGenerated", &s.TimeGenerated) + 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 SubAssessmentStatus. +func (s SubAssessmentStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cause", s.Cause) + populate(objectMap, "code", s.Code) + populate(objectMap, "description", s.Description) + populate(objectMap, "severity", s.Severity) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SubAssessmentStatus. +func (s *SubAssessmentStatus) 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 "cause": + err = unpopulate(val, "Cause", &s.Cause) + delete(rawMsg, key) + case "code": + err = unpopulate(val, "Code", &s.Code) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &s.Description) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &s.Severity) + 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 SuppressionAlertsScope. +func (s SuppressionAlertsScope) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "allOf", s.AllOf) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SuppressionAlertsScope. +func (s *SuppressionAlertsScope) 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 "allOf": + err = unpopulate(val, "AllOf", &s.AllOf) + 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 SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) 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 "createdAt": + err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, "CreatedByType", &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) + 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 Tags. +func (t Tags) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Tags. +func (t *Tags) 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 "tags": + err = unpopulate(val, "Tags", &t.Tags) + 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 TagsResource. +func (t TagsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "tags", t.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TagsResource. +func (t *TagsResource) 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 "tags": + err = unpopulate(val, "Tags", &t.Tags) + 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 Task. +func (t Task) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Task. +func (t *Task) 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 "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 "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 TaskList. +func (t TaskList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskList. +func (t *TaskList) 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 TaskParameters. +func (t TaskParameters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", t.Name) + if t.AdditionalProperties != nil { + for key, val := range t.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskParameters. +func (t *TaskParameters) 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 "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + default: + if t.AdditionalProperties == nil { + t.AdditionalProperties = map[string]interface{}{} + } + if val != nil { + var aux interface{} + err = json.Unmarshal(val, &aux) + t.AdditionalProperties[key] = aux + } + 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 TaskProperties. +func (t TaskProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "creationTimeUtc", t.CreationTimeUTC) + populateTimeRFC3339(objectMap, "lastStateChangeTimeUtc", t.LastStateChangeTimeUTC) + populate(objectMap, "securityTaskParameters", t.SecurityTaskParameters) + populate(objectMap, "state", t.State) + populate(objectMap, "subState", t.SubState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TaskProperties. +func (t *TaskProperties) 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 "creationTimeUtc": + err = unpopulateTimeRFC3339(val, "CreationTimeUTC", &t.CreationTimeUTC) + delete(rawMsg, key) + case "lastStateChangeTimeUtc": + err = unpopulateTimeRFC3339(val, "LastStateChangeTimeUTC", &t.LastStateChangeTimeUTC) + delete(rawMsg, key) + case "securityTaskParameters": + err = unpopulate(val, "SecurityTaskParameters", &t.SecurityTaskParameters) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &t.State) + delete(rawMsg, key) + case "subState": + err = unpopulate(val, "SubState", &t.SubState) + 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 ThresholdCustomAlertRule. +func (t ThresholdCustomAlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", t.Description) + populate(objectMap, "displayName", t.DisplayName) + populate(objectMap, "isEnabled", t.IsEnabled) + populate(objectMap, "maxThreshold", t.MaxThreshold) + populate(objectMap, "minThreshold", t.MinThreshold) + objectMap["ruleType"] = "ThresholdCustomAlertRule" + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ThresholdCustomAlertRule. +func (t *ThresholdCustomAlertRule) 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 "description": + err = unpopulate(val, "Description", &t.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &t.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &t.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &t.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &t.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &t.RuleType) + 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 TimeWindowCustomAlertRule. +func (t TimeWindowCustomAlertRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", t.Description) + populate(objectMap, "displayName", t.DisplayName) + populate(objectMap, "isEnabled", t.IsEnabled) + populate(objectMap, "maxThreshold", t.MaxThreshold) + populate(objectMap, "minThreshold", t.MinThreshold) + objectMap["ruleType"] = "TimeWindowCustomAlertRule" + populate(objectMap, "timeWindowSize", t.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TimeWindowCustomAlertRule. +func (t *TimeWindowCustomAlertRule) 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 "description": + err = unpopulate(val, "Description", &t.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &t.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &t.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &t.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &t.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &t.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &t.TimeWindowSize) + 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 TopologyList. +func (t TopologyList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TopologyList. +func (t *TopologyList) 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 TopologyResource. +func (t TopologyResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TopologyResource. +func (t *TopologyResource) 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 "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + 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 "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 TopologyResourceProperties. +func (t TopologyResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "calculatedDateTime", t.CalculatedDateTime) + populate(objectMap, "topologyResources", t.TopologyResources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TopologyResourceProperties. +func (t *TopologyResourceProperties) 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 "calculatedDateTime": + err = unpopulateTimeRFC3339(val, "CalculatedDateTime", &t.CalculatedDateTime) + delete(rawMsg, key) + case "topologyResources": + err = unpopulate(val, "TopologyResources", &t.TopologyResources) + 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 TopologySingleResource. +func (t TopologySingleResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "children", t.Children) + populate(objectMap, "location", t.Location) + populate(objectMap, "networkZones", t.NetworkZones) + populate(objectMap, "parents", t.Parents) + populate(objectMap, "recommendationsExist", t.RecommendationsExist) + populate(objectMap, "resourceId", t.ResourceID) + populate(objectMap, "severity", t.Severity) + populate(objectMap, "topologyScore", t.TopologyScore) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TopologySingleResource. +func (t *TopologySingleResource) 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 "children": + err = unpopulate(val, "Children", &t.Children) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "networkZones": + err = unpopulate(val, "NetworkZones", &t.NetworkZones) + delete(rawMsg, key) + case "parents": + err = unpopulate(val, "Parents", &t.Parents) + delete(rawMsg, key) + case "recommendationsExist": + err = unpopulate(val, "RecommendationsExist", &t.RecommendationsExist) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &t.ResourceID) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &t.Severity) + delete(rawMsg, key) + case "topologyScore": + err = unpopulate(val, "TopologyScore", &t.TopologyScore) + 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 TopologySingleResourceChild. +func (t TopologySingleResourceChild) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "resourceId", t.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TopologySingleResourceChild. +func (t *TopologySingleResourceChild) 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 "resourceId": + err = unpopulate(val, "ResourceID", &t.ResourceID) + 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 TopologySingleResourceParent. +func (t TopologySingleResourceParent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "resourceId", t.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TopologySingleResourceParent. +func (t *TopologySingleResourceParent) 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 "resourceId": + err = unpopulate(val, "ResourceID", &t.ResourceID) + 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 TrackedResource. +func (t TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "etag", t.Etag) + populate(objectMap, "id", t.ID) + populate(objectMap, "kind", t.Kind) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) 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 "kind": + err = unpopulate(val, "Kind", &t.Kind) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + 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 TwinUpdatesNotInAllowedRange. +func (t TwinUpdatesNotInAllowedRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", t.Description) + populate(objectMap, "displayName", t.DisplayName) + populate(objectMap, "isEnabled", t.IsEnabled) + populate(objectMap, "maxThreshold", t.MaxThreshold) + populate(objectMap, "minThreshold", t.MinThreshold) + objectMap["ruleType"] = "TwinUpdatesNotInAllowedRange" + populate(objectMap, "timeWindowSize", t.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TwinUpdatesNotInAllowedRange. +func (t *TwinUpdatesNotInAllowedRange) 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 "description": + err = unpopulate(val, "Description", &t.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &t.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &t.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &t.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &t.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &t.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &t.TimeWindowSize) + 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 UnauthorizedOperationsNotInAllowedRange. +func (u UnauthorizedOperationsNotInAllowedRange) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", u.Description) + populate(objectMap, "displayName", u.DisplayName) + populate(objectMap, "isEnabled", u.IsEnabled) + populate(objectMap, "maxThreshold", u.MaxThreshold) + populate(objectMap, "minThreshold", u.MinThreshold) + objectMap["ruleType"] = "UnauthorizedOperationsNotInAllowedRange" + populate(objectMap, "timeWindowSize", u.TimeWindowSize) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UnauthorizedOperationsNotInAllowedRange. +func (u *UnauthorizedOperationsNotInAllowedRange) 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", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, "Description", &u.Description) + delete(rawMsg, key) + case "displayName": + err = unpopulate(val, "DisplayName", &u.DisplayName) + delete(rawMsg, key) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &u.IsEnabled) + delete(rawMsg, key) + case "maxThreshold": + err = unpopulate(val, "MaxThreshold", &u.MaxThreshold) + delete(rawMsg, key) + case "minThreshold": + err = unpopulate(val, "MinThreshold", &u.MinThreshold) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &u.RuleType) + delete(rawMsg, key) + case "timeWindowSize": + err = unpopulate(val, "TimeWindowSize", &u.TimeWindowSize) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateIoTSecuritySolutionProperties. +func (u UpdateIoTSecuritySolutionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "recommendationsConfiguration", u.RecommendationsConfiguration) + populate(objectMap, "userDefinedResources", u.UserDefinedResources) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateIoTSecuritySolutionProperties. +func (u *UpdateIoTSecuritySolutionProperties) 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", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "recommendationsConfiguration": + err = unpopulate(val, "RecommendationsConfiguration", &u.RecommendationsConfiguration) + delete(rawMsg, key) + case "userDefinedResources": + err = unpopulate(val, "UserDefinedResources", &u.UserDefinedResources) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UpdateIotSecuritySolutionData. +func (u UpdateIotSecuritySolutionData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "properties", u.Properties) + populate(objectMap, "tags", u.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UpdateIotSecuritySolutionData. +func (u *UpdateIotSecuritySolutionData) 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", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, "Properties", &u.Properties) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &u.Tags) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserDefinedResourcesProperties. +func (u UserDefinedResourcesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "query", u.Query) + populate(objectMap, "querySubscriptions", u.QuerySubscriptions) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserDefinedResourcesProperties. +func (u *UserDefinedResourcesProperties) 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", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "query": + err = unpopulate(val, "Query", &u.Query) + delete(rawMsg, key) + case "querySubscriptions": + err = unpopulate(val, "QuerySubscriptions", &u.QuerySubscriptions) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type UserRecommendation. +func (u UserRecommendation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "recommendationAction", u.RecommendationAction) + populate(objectMap, "username", u.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type UserRecommendation. +func (u *UserRecommendation) 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", u, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "recommendationAction": + err = unpopulate(val, "RecommendationAction", &u.RecommendationAction) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &u.Username) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", u, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VMRecommendation. +func (v VMRecommendation) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "configurationStatus", v.ConfigurationStatus) + populate(objectMap, "enforcementSupport", v.EnforcementSupport) + populate(objectMap, "recommendationAction", v.RecommendationAction) + populate(objectMap, "resourceId", v.ResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VMRecommendation. +func (v *VMRecommendation) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "configurationStatus": + err = unpopulate(val, "ConfigurationStatus", &v.ConfigurationStatus) + delete(rawMsg, key) + case "enforcementSupport": + err = unpopulate(val, "EnforcementSupport", &v.EnforcementSupport) + delete(rawMsg, key) + case "recommendationAction": + err = unpopulate(val, "RecommendationAction", &v.RecommendationAction) + delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &v.ResourceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VaRule. +func (v VaRule) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "benchmarkReferences", v.BenchmarkReferences) + populate(objectMap, "category", v.Category) + populate(objectMap, "description", v.Description) + populate(objectMap, "queryCheck", v.QueryCheck) + populate(objectMap, "rationale", v.Rationale) + populate(objectMap, "ruleId", v.RuleID) + populate(objectMap, "ruleType", v.RuleType) + populate(objectMap, "severity", v.Severity) + populate(objectMap, "title", v.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VaRule. +func (v *VaRule) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "benchmarkReferences": + err = unpopulate(val, "BenchmarkReferences", &v.BenchmarkReferences) + delete(rawMsg, key) + case "category": + err = unpopulate(val, "Category", &v.Category) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &v.Description) + delete(rawMsg, key) + case "queryCheck": + err = unpopulate(val, "QueryCheck", &v.QueryCheck) + delete(rawMsg, key) + case "rationale": + err = unpopulate(val, "Rationale", &v.Rationale) + delete(rawMsg, key) + case "ruleId": + err = unpopulate(val, "RuleID", &v.RuleID) + delete(rawMsg, key) + case "ruleType": + err = unpopulate(val, "RuleType", &v.RuleType) + delete(rawMsg, key) + case "severity": + err = unpopulate(val, "Severity", &v.Severity) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &v.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type VendorReference. +func (v VendorReference) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "link", v.Link) + populate(objectMap, "title", v.Title) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type VendorReference. +func (v *VendorReference) 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", v, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "link": + err = unpopulate(val, "Link", &v.Link) + delete(rawMsg, key) + case "title": + err = unpopulate(val, "Title", &v.Title) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", v, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type WorkspaceSetting. +func (w WorkspaceSetting) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", w.ID) + populate(objectMap, "name", w.Name) + populate(objectMap, "properties", w.Properties) + populate(objectMap, "type", w.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkspaceSetting. +func (w *WorkspaceSetting) 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 "id": + err = unpopulate(val, "ID", &w.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &w.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &w.Properties) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &w.Type) + 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 WorkspaceSettingList. +func (w WorkspaceSettingList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", w.NextLink) + populate(objectMap, "value", w.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkspaceSettingList. +func (w *WorkspaceSettingList) 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 "nextLink": + err = unpopulate(val, "NextLink", &w.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &w.Value) + 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 WorkspaceSettingProperties. +func (w WorkspaceSettingProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "scope", w.Scope) + populate(objectMap, "workspaceId", w.WorkspaceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type WorkspaceSettingProperties. +func (w *WorkspaceSettingProperties) 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 "scope": + err = unpopulate(val, "Scope", &w.Scope) + delete(rawMsg, key) + case "workspaceId": + err = unpopulate(val, "WorkspaceID", &w.WorkspaceID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", w, err) + } + } + return nil +} + +func populate(m map[string]interface{}, k string, v interface{}) { + if v == nil { + return + } else if azcore.IsNullValue(v) { + m[k] = nil + } else if !reflect.ValueOf(v).IsNil() { + m[k] = v + } +} + +func populateByteArray(m map[string]interface{}, k string, b []byte, f runtime.Base64Encoding) { + if azcore.IsNullValue(b) { + m[k] = nil + } else if len(b) == 0 { + return + } else { + m[k] = runtime.EncodeByteArray(b, f) + } +} + +func unpopulate(data json.RawMessage, fn string, v interface{}) error { + if data == nil { + return nil + } + if err := json.Unmarshal(data, v); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + return nil +} diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_operations_client.go b/sdk/resourcemanager/security/armsecurity/operations_client.go similarity index 98% rename from sdk/resourcemanager/security/armsecurity/zz_generated_operations_client.go rename to sdk/resourcemanager/security/armsecurity/operations_client.go index b311c64228c7..08143882dd00 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_operations_client.go +++ b/sdk/resourcemanager/security/armsecurity/operations_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -49,7 +50,6 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO } // NewListPager - Exposes all available operations for discovery purposes. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2015-06-01-preview // options - OperationsClientListOptions contains the optional parameters for the OperationsClient.List method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/security/armsecurity/polymorphic_helpers.go similarity index 84% rename from sdk/resourcemanager/security/armsecurity/zz_generated_polymorphic_helpers.go rename to sdk/resourcemanager/security/armsecurity/polymorphic_helpers.go index 372f3358de9e..98ba8838666b 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/security/armsecurity/polymorphic_helpers.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -156,6 +157,26 @@ func unmarshalAutomationActionClassificationArray(rawMsg json.RawMessage) ([]Aut return fArray, nil } +func unmarshalAwsOrganizationalDataClassification(rawMsg json.RawMessage) (AwsOrganizationalDataClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b AwsOrganizationalDataClassification + switch m["organizationMembershipType"] { + case string(OrganizationMembershipTypeMember): + b = &AwsOrganizationalDataMember{} + case string(OrganizationMembershipTypeOrganization): + b = &AwsOrganizationalDataMaster{} + default: + b = &AwsOrganizationalData{} + } + return b, json.Unmarshal(rawMsg, b) +} + func unmarshalCloudOfferingClassification(rawMsg json.RawMessage) (CloudOfferingClassification, error) { if rawMsg == nil { return nil, nil @@ -168,10 +189,24 @@ func unmarshalCloudOfferingClassification(rawMsg json.RawMessage) (CloudOffering switch m["offeringType"] { case string(OfferingTypeCspmMonitorAws): b = &CspmMonitorAwsOffering{} + case string(OfferingTypeCspmMonitorAzureDevOps): + b = &CspmMonitorAzureDevOpsOffering{} + case string(OfferingTypeCspmMonitorGcp): + b = &CspmMonitorGcpOffering{} + case string(OfferingTypeCspmMonitorGithub): + b = &CspmMonitorGithubOffering{} case string(OfferingTypeDefenderForContainersAws): b = &DefenderForContainersAwsOffering{} + case string(OfferingTypeDefenderForContainersGcp): + b = &DefenderForContainersGcpOffering{} + case string(OfferingTypeDefenderForDatabasesAws): + b = &DefenderFoDatabasesAwsOffering{} + case string(OfferingTypeDefenderForDatabasesGcp): + b = &DefenderForDatabasesGcpOffering{} case string(OfferingTypeDefenderForServersAws): b = &DefenderForServersAwsOffering{} + case string(OfferingTypeDefenderForServersGcp): + b = &DefenderForServersGcpOffering{} case string(OfferingTypeInformationProtectionAws): b = &InformationProtectionAwsOffering{} default: @@ -199,6 +234,50 @@ func unmarshalCloudOfferingClassificationArray(rawMsg json.RawMessage) ([]CloudO return fArray, nil } +func unmarshalEnvironmentDataClassification(rawMsg json.RawMessage) (EnvironmentDataClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b EnvironmentDataClassification + switch m["environmentType"] { + case string(EnvironmentTypeAwsAccount): + b = &AWSEnvironmentData{} + case string(EnvironmentTypeAzureDevOpsScope): + b = &AzureDevOpsScopeEnvironmentData{} + case string(EnvironmentTypeGcpProject): + b = &GcpProjectEnvironmentData{} + case string(EnvironmentTypeGithubScope): + b = &GithubScopeEnvironmentData{} + default: + b = &EnvironmentData{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalGcpOrganizationalDataClassification(rawMsg json.RawMessage) (GcpOrganizationalDataClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b GcpOrganizationalDataClassification + switch m["organizationMembershipType"] { + case string(OrganizationMembershipTypeMember): + b = &GcpOrganizationalDataMember{} + case string(OrganizationMembershipTypeOrganization): + b = &GcpOrganizationalDataOrganization{} + default: + b = &GcpOrganizationalData{} + } + return b, json.Unmarshal(rawMsg, b) +} + func unmarshalResourceDetailsClassification(rawMsg json.RawMessage) (ResourceDetailsClassification, error) { if rawMsg == nil { return nil, nil diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_pricings_client.go b/sdk/resourcemanager/security/armsecurity/pricings_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_pricings_client.go rename to sdk/resourcemanager/security/armsecurity/pricings_client.go index 33863f1a810c..a0a17165cdbe 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_pricings_client.go +++ b/sdk/resourcemanager/security/armsecurity/pricings_client.go @@ -5,6 +5,7 @@ // 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 armsecurity diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycomplianceassessments_client.go b/sdk/resourcemanager/security/armsecurity/regulatorycomplianceassessments_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycomplianceassessments_client.go rename to sdk/resourcemanager/security/armsecurity/regulatorycomplianceassessments_client.go index 09fe061e6796..c7f6c9831394 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycomplianceassessments_client.go +++ b/sdk/resourcemanager/security/armsecurity/regulatorycomplianceassessments_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -117,7 +118,6 @@ func (client *RegulatoryComplianceAssessmentsClient) getHandleResponse(resp *htt } // NewListPager - Details and state of assessments mapped to selected regulatory compliance control -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-01-01-preview // regulatoryComplianceStandardName - Name of the regulatory compliance standard object // regulatoryComplianceControlName - Name of the regulatory compliance control object diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycompliancecontrols_client.go b/sdk/resourcemanager/security/armsecurity/regulatorycompliancecontrols_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycompliancecontrols_client.go rename to sdk/resourcemanager/security/armsecurity/regulatorycompliancecontrols_client.go index 5c319b24505a..87ae599a8b87 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycompliancecontrols_client.go +++ b/sdk/resourcemanager/security/armsecurity/regulatorycompliancecontrols_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -112,7 +113,6 @@ func (client *RegulatoryComplianceControlsClient) getHandleResponse(resp *http.R } // NewListPager - All supported regulatory compliance controls details and state for selected standard -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-01-01-preview // regulatoryComplianceStandardName - Name of the regulatory compliance standard object // options - RegulatoryComplianceControlsClientListOptions contains the optional parameters for the RegulatoryComplianceControlsClient.List diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycompliancestandards_client.go b/sdk/resourcemanager/security/armsecurity/regulatorycompliancestandards_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycompliancestandards_client.go rename to sdk/resourcemanager/security/armsecurity/regulatorycompliancestandards_client.go index 539b4895d1a3..a5a30a27489b 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycompliancestandards_client.go +++ b/sdk/resourcemanager/security/armsecurity/regulatorycompliancestandards_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -107,7 +108,6 @@ func (client *RegulatoryComplianceStandardsClient) getHandleResponse(resp *http. } // NewListPager - Supported regulatory compliance standards details and state -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-01-01-preview // options - RegulatoryComplianceStandardsClientListOptions contains the optional parameters for the RegulatoryComplianceStandardsClient.List // method. diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_response_types.go b/sdk/resourcemanager/security/armsecurity/response_types.go similarity index 87% rename from sdk/resourcemanager/security/armsecurity/zz_generated_response_types.go rename to sdk/resourcemanager/security/armsecurity/response_types.go index 79c1db9bef95..963f079a26de 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_response_types.go +++ b/sdk/resourcemanager/security/armsecurity/response_types.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -118,6 +119,11 @@ type AlertsClientUpdateResourceGroupLevelStateToDismissResponse struct { // placeholder for future response values } +// AlertsClientUpdateResourceGroupLevelStateToInProgressResponse contains the response from method AlertsClient.UpdateResourceGroupLevelStateToInProgress. +type AlertsClientUpdateResourceGroupLevelStateToInProgressResponse struct { + // placeholder for future response values +} + // AlertsClientUpdateResourceGroupLevelStateToResolveResponse contains the response from method AlertsClient.UpdateResourceGroupLevelStateToResolve. type AlertsClientUpdateResourceGroupLevelStateToResolveResponse struct { // placeholder for future response values @@ -133,6 +139,11 @@ type AlertsClientUpdateSubscriptionLevelStateToDismissResponse struct { // placeholder for future response values } +// AlertsClientUpdateSubscriptionLevelStateToInProgressResponse contains the response from method AlertsClient.UpdateSubscriptionLevelStateToInProgress. +type AlertsClientUpdateSubscriptionLevelStateToInProgressResponse struct { + // placeholder for future response values +} + // AlertsClientUpdateSubscriptionLevelStateToResolveResponse contains the response from method AlertsClient.UpdateSubscriptionLevelStateToResolve. type AlertsClientUpdateSubscriptionLevelStateToResolveResponse struct { // placeholder for future response values @@ -173,6 +184,26 @@ type AllowedConnectionsClientListResponse struct { AllowedConnectionsList } +// ApplicationClientCreateOrUpdateResponse contains the response from method ApplicationClient.CreateOrUpdate. +type ApplicationClientCreateOrUpdateResponse struct { + Application +} + +// ApplicationClientDeleteResponse contains the response from method ApplicationClient.Delete. +type ApplicationClientDeleteResponse struct { + // placeholder for future response values +} + +// ApplicationClientGetResponse contains the response from method ApplicationClient.Get. +type ApplicationClientGetResponse struct { + Application +} + +// ApplicationsClientListResponse contains the response from method ApplicationsClient.List. +type ApplicationsClientListResponse struct { + ApplicationsList +} + // AssessmentsClientCreateOrUpdateResponse contains the response from method AssessmentsClient.CreateOrUpdate. type AssessmentsClientCreateOrUpdateResponse struct { AssessmentResponse @@ -288,6 +319,51 @@ type CompliancesClientListResponse struct { ComplianceList } +// ConnectorApplicationClientCreateOrUpdateResponse contains the response from method ConnectorApplicationClient.CreateOrUpdate. +type ConnectorApplicationClientCreateOrUpdateResponse struct { + Application +} + +// ConnectorApplicationClientDeleteResponse contains the response from method ConnectorApplicationClient.Delete. +type ConnectorApplicationClientDeleteResponse struct { + // placeholder for future response values +} + +// ConnectorApplicationClientGetResponse contains the response from method ConnectorApplicationClient.Get. +type ConnectorApplicationClientGetResponse struct { + Application +} + +// ConnectorApplicationsClientListResponse contains the response from method ConnectorApplicationsClient.List. +type ConnectorApplicationsClientListResponse struct { + ApplicationsList +} + +// ConnectorGovernanceRuleClientListResponse contains the response from method ConnectorGovernanceRuleClient.List. +type ConnectorGovernanceRuleClientListResponse struct { + GovernanceRuleList +} + +// ConnectorGovernanceRulesClientCreateOrUpdateResponse contains the response from method ConnectorGovernanceRulesClient.CreateOrUpdate. +type ConnectorGovernanceRulesClientCreateOrUpdateResponse struct { + GovernanceRule +} + +// ConnectorGovernanceRulesClientDeleteResponse contains the response from method ConnectorGovernanceRulesClient.Delete. +type ConnectorGovernanceRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// ConnectorGovernanceRulesClientGetResponse contains the response from method ConnectorGovernanceRulesClient.Get. +type ConnectorGovernanceRulesClientGetResponse struct { + GovernanceRule +} + +// ConnectorGovernanceRulesExecuteStatusClientGetResponse contains the response from method ConnectorGovernanceRulesExecuteStatusClient.Get. +type ConnectorGovernanceRulesExecuteStatusClientGetResponse struct { + ExecuteRuleStatus +} + // ConnectorsClientCreateOrUpdateResponse contains the response from method ConnectorsClient.CreateOrUpdate. type ConnectorsClientCreateOrUpdateResponse struct { Connector @@ -338,11 +414,6 @@ type ContactsClientListResponse struct { ContactList } -// ContactsClientUpdateResponse contains the response from method ContactsClient.Update. -type ContactsClientUpdateResponse struct { - Contact -} - // CustomAssessmentAutomationsClientCreateResponse contains the response from method CustomAssessmentAutomationsClient.Create. type CustomAssessmentAutomationsClientCreateResponse struct { CustomAssessmentAutomation @@ -443,6 +514,56 @@ type ExternalSecuritySolutionsClientListResponse struct { ExternalSecuritySolutionList } +// GovernanceAssignmentsClientCreateOrUpdateResponse contains the response from method GovernanceAssignmentsClient.CreateOrUpdate. +type GovernanceAssignmentsClientCreateOrUpdateResponse struct { + GovernanceAssignment +} + +// GovernanceAssignmentsClientDeleteResponse contains the response from method GovernanceAssignmentsClient.Delete. +type GovernanceAssignmentsClientDeleteResponse struct { + // placeholder for future response values +} + +// GovernanceAssignmentsClientGetResponse contains the response from method GovernanceAssignmentsClient.Get. +type GovernanceAssignmentsClientGetResponse struct { + GovernanceAssignment +} + +// GovernanceAssignmentsClientListResponse contains the response from method GovernanceAssignmentsClient.List. +type GovernanceAssignmentsClientListResponse struct { + GovernanceAssignmentsList +} + +// GovernanceRuleClientListResponse contains the response from method GovernanceRuleClient.List. +type GovernanceRuleClientListResponse struct { + GovernanceRuleList +} + +// GovernanceRulesClientCreateOrUpdateResponse contains the response from method GovernanceRulesClient.CreateOrUpdate. +type GovernanceRulesClientCreateOrUpdateResponse struct { + GovernanceRule +} + +// GovernanceRulesClientDeleteResponse contains the response from method GovernanceRulesClient.Delete. +type GovernanceRulesClientDeleteResponse struct { + // placeholder for future response values +} + +// GovernanceRulesClientGetResponse contains the response from method GovernanceRulesClient.Get. +type GovernanceRulesClientGetResponse struct { + GovernanceRule +} + +// GovernanceRulesClientRuleIDExecuteSingleSecurityConnectorResponse contains the response from method GovernanceRulesClient.RuleIDExecuteSingleSecurityConnector. +type GovernanceRulesClientRuleIDExecuteSingleSecurityConnectorResponse struct { + // placeholder for future response values +} + +// GovernanceRulesClientRuleIDExecuteSingleSubscriptionResponse contains the response from method GovernanceRulesClient.RuleIDExecuteSingleSubscription. +type GovernanceRulesClientRuleIDExecuteSingleSubscriptionResponse struct { + // placeholder for future response values +} + // InformationProtectionPoliciesClientCreateOrUpdateResponse contains the response from method InformationProtectionPoliciesClient.CreateOrUpdate. type InformationProtectionPoliciesClientCreateOrUpdateResponse struct { InformationProtectionPolicy @@ -843,6 +964,11 @@ type SubAssessmentsClientListResponse struct { SubAssessmentList } +// SubscriptionGovernanceRulesExecuteStatusClientGetResponse contains the response from method SubscriptionGovernanceRulesExecuteStatusClient.Get. +type SubscriptionGovernanceRulesExecuteStatusClientGetResponse struct { + ExecuteRuleStatus +} + // TasksClientGetResourceGroupLevelTaskResponse contains the response from method TasksClient.GetResourceGroupLevelTask. type TasksClientGetResourceGroupLevelTaskResponse struct { Task diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_securescorecontroldefinitions_client.go b/sdk/resourcemanager/security/armsecurity/securescorecontroldefinitions_client.go similarity index 98% rename from sdk/resourcemanager/security/armsecurity/zz_generated_securescorecontroldefinitions_client.go rename to sdk/resourcemanager/security/armsecurity/securescorecontroldefinitions_client.go index 3e25a7d339d0..a7fbfbc1bd78 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_securescorecontroldefinitions_client.go +++ b/sdk/resourcemanager/security/armsecurity/securescorecontroldefinitions_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -55,7 +56,6 @@ func NewSecureScoreControlDefinitionsClient(subscriptionID string, credential az } // NewListPager - List the available security controls, their assessments, and the max score -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // options - SecureScoreControlDefinitionsClientListOptions contains the optional parameters for the SecureScoreControlDefinitionsClient.List // method. @@ -112,7 +112,6 @@ func (client *SecureScoreControlDefinitionsClient) listHandleResponse(resp *http // NewListBySubscriptionPager - For a specified subscription, list the available security controls, their assessments, and // the max score -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // options - SecureScoreControlDefinitionsClientListBySubscriptionOptions contains the optional parameters for the SecureScoreControlDefinitionsClient.ListBySubscription // method. diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_securescorecontrols_client.go b/sdk/resourcemanager/security/armsecurity/securescorecontrols_client.go similarity index 98% rename from sdk/resourcemanager/security/armsecurity/zz_generated_securescorecontrols_client.go rename to sdk/resourcemanager/security/armsecurity/securescorecontrols_client.go index f4d320a9559a..10a012481b94 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_securescorecontrols_client.go +++ b/sdk/resourcemanager/security/armsecurity/securescorecontrols_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -55,7 +56,6 @@ func NewSecureScoreControlsClient(subscriptionID string, credential azcore.Token } // NewListPager - Get all security controls within a scope -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // options - SecureScoreControlsClientListOptions contains the optional parameters for the SecureScoreControlsClient.List // method. @@ -118,7 +118,6 @@ func (client *SecureScoreControlsClient) listHandleResponse(resp *http.Response) } // NewListBySecureScorePager - Get all security controls for a specific initiative within a scope -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // secureScoreName - The initiative name. For the ASC Default initiative, use 'ascScore' as in the sample request below. // options - SecureScoreControlsClientListBySecureScoreOptions contains the optional parameters for the SecureScoreControlsClient.ListBySecureScore diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_securescores_client.go b/sdk/resourcemanager/security/armsecurity/securescores_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_securescores_client.go rename to sdk/resourcemanager/security/armsecurity/securescores_client.go index c8405d25d30a..ea9cc67328a8 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_securescores_client.go +++ b/sdk/resourcemanager/security/armsecurity/securescores_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -107,7 +108,6 @@ func (client *SecureScoresClient) getHandleResponse(resp *http.Response) (Secure } // NewListPager - List secure scores for all your Microsoft Defender for Cloud initiatives within your current scope. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // options - SecureScoresClientListOptions contains the optional parameters for the SecureScoresClient.List method. func (client *SecureScoresClient) NewListPager(options *SecureScoresClientListOptions) *runtime.Pager[SecureScoresClientListResponse] { diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_servervulnerabilityassessment_client.go b/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessment_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_servervulnerabilityassessment_client.go rename to sdk/resourcemanager/security/armsecurity/servervulnerabilityassessment_client.go index a27bc4b0e224..6552c0d8711c 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_servervulnerabilityassessment_client.go +++ b/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessment_client.go @@ -5,6 +5,7 @@ // 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 armsecurity diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_settings_client.go b/sdk/resourcemanager/security/armsecurity/settings_client.go similarity index 96% rename from sdk/resourcemanager/security/armsecurity/zz_generated_settings_client.go rename to sdk/resourcemanager/security/armsecurity/settings_client.go index d6d6884487eb..8642ee568ed1 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_settings_client.go +++ b/sdk/resourcemanager/security/armsecurity/settings_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -56,7 +57,7 @@ func NewSettingsClient(subscriptionID string, credential azcore.TokenCredential, // Get - Settings of different configurations in Microsoft Defender for Cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-01 +// Generated from API version 2022-05-01 // settingName - The name of the setting // options - SettingsClientGetOptions contains the optional parameters for the SettingsClient.Get method. func (client *SettingsClient) Get(ctx context.Context, settingName SettingName, options *SettingsClientGetOptions) (SettingsClientGetResponse, error) { @@ -90,7 +91,7 @@ func (client *SettingsClient) getCreateRequest(ctx context.Context, settingName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -106,8 +107,7 @@ func (client *SettingsClient) getHandleResponse(resp *http.Response) (SettingsCl } // NewListPager - Settings about different configurations in Microsoft Defender for Cloud -// If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-01 +// Generated from API version 2022-05-01 // options - SettingsClientListOptions contains the optional parameters for the SettingsClient.List method. func (client *SettingsClient) NewListPager(options *SettingsClientListOptions) *runtime.Pager[SettingsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SettingsClientListResponse]{ @@ -149,7 +149,7 @@ func (client *SettingsClient) listCreateRequest(ctx context.Context, options *Se return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -166,7 +166,7 @@ func (client *SettingsClient) listHandleResponse(resp *http.Response) (SettingsC // Update - updating settings about different configurations in Microsoft Defender for Cloud // If the operation fails it returns an *azcore.ResponseError type. -// Generated from API version 2021-07-01 +// Generated from API version 2022-05-01 // settingName - The name of the setting // setting - Setting object // options - SettingsClientUpdateOptions contains the optional parameters for the SettingsClient.Update method. @@ -201,7 +201,7 @@ func (client *SettingsClient) updateCreateRequest(ctx context.Context, settingNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01") + reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, runtime.MarshalAsJSON(req, setting) diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_softwareinventories_client.go b/sdk/resourcemanager/security/armsecurity/softwareinventories_client.go similarity index 98% rename from sdk/resourcemanager/security/armsecurity/zz_generated_softwareinventories_client.go rename to sdk/resourcemanager/security/armsecurity/softwareinventories_client.go index c8dd960eb9ab..f485c28ea71e 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_softwareinventories_client.go +++ b/sdk/resourcemanager/security/armsecurity/softwareinventories_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -126,7 +127,6 @@ func (client *SoftwareInventoriesClient) getHandleResponse(resp *http.Response) } // NewListByExtendedResourcePager - Gets the software inventory of the virtual machine. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2021-05-01-preview // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // resourceNamespace - The namespace of the resource. @@ -206,7 +206,6 @@ func (client *SoftwareInventoriesClient) listByExtendedResourceHandleResponse(re } // NewListBySubscriptionPager - Gets the software inventory of all virtual machines in the subscriptions. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2021-05-01-preview // options - SoftwareInventoriesClientListBySubscriptionOptions contains the optional parameters for the SoftwareInventoriesClient.ListBySubscription // method. diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_solutions_client.go b/sdk/resourcemanager/security/armsecurity/solutions_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_solutions_client.go rename to sdk/resourcemanager/security/armsecurity/solutions_client.go index e4847247b505..590829c14c93 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_solutions_client.go +++ b/sdk/resourcemanager/security/armsecurity/solutions_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -116,7 +117,6 @@ func (client *SolutionsClient) getHandleResponse(resp *http.Response) (Solutions } // NewListPager - Gets a list of Security Solutions for the subscription. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // options - SolutionsClientListOptions contains the optional parameters for the SolutionsClient.List method. func (client *SolutionsClient) NewListPager(options *SolutionsClientListOptions) *runtime.Pager[SolutionsClientListResponse] { diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_solutionsreferencedata_client.go b/sdk/resourcemanager/security/armsecurity/solutionsreferencedata_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_solutionsreferencedata_client.go rename to sdk/resourcemanager/security/armsecurity/solutionsreferencedata_client.go index eeaa68a917b4..6b87b007d8fb 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_solutionsreferencedata_client.go +++ b/sdk/resourcemanager/security/armsecurity/solutionsreferencedata_client.go @@ -5,6 +5,7 @@ // 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 armsecurity diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentbaselinerules_client.go b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentbaselinerules_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentbaselinerules_client.go rename to sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentbaselinerules_client.go index ba8a14fdd6ae..a1763526a948 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentbaselinerules_client.go +++ b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentbaselinerules_client.go @@ -5,6 +5,7 @@ // 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 armsecurity diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentscanresults_client.go b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscanresults_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentscanresults_client.go rename to sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscanresults_client.go index 36fed9a65555..cfe79a9f6c49 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentscanresults_client.go +++ b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscanresults_client.go @@ -5,6 +5,7 @@ // 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 armsecurity diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentscans_client.go b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscans_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentscans_client.go rename to sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscans_client.go index 74697cfe2954..901be98f3029 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentscans_client.go +++ b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscans_client.go @@ -5,6 +5,7 @@ // 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 armsecurity diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_subassessments_client.go b/sdk/resourcemanager/security/armsecurity/subassessments_client.go similarity index 98% rename from sdk/resourcemanager/security/armsecurity/zz_generated_subassessments_client.go rename to sdk/resourcemanager/security/armsecurity/subassessments_client.go index 4680ebd96497..d258b9b39e79 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_subassessments_client.go +++ b/sdk/resourcemanager/security/armsecurity/subassessments_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -107,7 +108,6 @@ func (client *SubAssessmentsClient) getHandleResponse(resp *http.Response) (SubA } // NewListPager - Get security sub-assessments on all your scanned resources inside a scope -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-01-01-preview // scope - Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group // (/providers/Microsoft.Management/managementGroups/mgName). @@ -170,7 +170,6 @@ func (client *SubAssessmentsClient) listHandleResponse(resp *http.Response) (Sub } // NewListAllPager - Get security sub-assessments on all your scanned resources inside a subscription scope -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2019-01-01-preview // scope - Scope of the query, can be subscription (/subscriptions/0b06d9ea-afe6-4779-bd59-30e5c2d9d13f) or management group // (/providers/Microsoft.Management/managementGroups/mgName). diff --git a/sdk/resourcemanager/security/armsecurity/subscriptiongovernancerulesexecutestatus_client.go b/sdk/resourcemanager/security/armsecurity/subscriptiongovernancerulesexecutestatus_client.go new file mode 100644 index 000000000000..c1910b6103fd --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/subscriptiongovernancerulesexecutestatus_client.go @@ -0,0 +1,119 @@ +//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 armsecurity + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/cloud" + "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" +) + +// SubscriptionGovernanceRulesExecuteStatusClient contains the methods for the SubscriptionGovernanceRulesExecuteStatus group. +// Don't use this type directly, use NewSubscriptionGovernanceRulesExecuteStatusClient() instead. +type SubscriptionGovernanceRulesExecuteStatusClient struct { + host string + subscriptionID string + pl runtime.Pipeline +} + +// NewSubscriptionGovernanceRulesExecuteStatusClient creates a new instance of SubscriptionGovernanceRulesExecuteStatusClient with the specified values. +// subscriptionID - Azure subscription ID +// credential - used to authorize requests. Usually a credential from azidentity. +// options - pass nil to accept the default values. +func NewSubscriptionGovernanceRulesExecuteStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SubscriptionGovernanceRulesExecuteStatusClient, error) { + if options == nil { + options = &arm.ClientOptions{} + } + ep := cloud.AzurePublic.Services[cloud.ResourceManager].Endpoint + if c, ok := options.Cloud.Services[cloud.ResourceManager]; ok { + ep = c.Endpoint + } + pl, err := armruntime.NewPipeline(moduleName, moduleVersion, credential, runtime.PipelineOptions{}, options) + if err != nil { + return nil, err + } + client := &SubscriptionGovernanceRulesExecuteStatusClient{ + subscriptionID: subscriptionID, + host: ep, + pl: pl, + } + return client, nil +} + +// BeginGet - Get a specific governanceRule execution status for the requested scope by ruleId and operationId +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +// ruleID - The security GovernanceRule key - unique key for the standard GovernanceRule +// operationID - The security GovernanceRule execution key - unique key for the execution of GovernanceRule +// options - SubscriptionGovernanceRulesExecuteStatusClientBeginGetOptions contains the optional parameters for the SubscriptionGovernanceRulesExecuteStatusClient.BeginGet +// method. +func (client *SubscriptionGovernanceRulesExecuteStatusClient) BeginGet(ctx context.Context, ruleID string, operationID string, options *SubscriptionGovernanceRulesExecuteStatusClientBeginGetOptions) (*runtime.Poller[SubscriptionGovernanceRulesExecuteStatusClientGetResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.get(ctx, ruleID, operationID, options) + if err != nil { + return nil, err + } + return runtime.NewPoller[SubscriptionGovernanceRulesExecuteStatusClientGetResponse](resp, client.pl, nil) + } else { + return runtime.NewPollerFromResumeToken[SubscriptionGovernanceRulesExecuteStatusClientGetResponse](options.ResumeToken, client.pl, nil) + } +} + +// Get - Get a specific governanceRule execution status for the requested scope by ruleId and operationId +// If the operation fails it returns an *azcore.ResponseError type. +// Generated from API version 2022-01-01-preview +func (client *SubscriptionGovernanceRulesExecuteStatusClient) get(ctx context.Context, ruleID string, operationID string, options *SubscriptionGovernanceRulesExecuteStatusClientBeginGetOptions) (*http.Response, error) { + req, err := client.getCreateRequest(ctx, ruleID, operationID, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, runtime.NewResponseError(resp) + } + return resp, nil +} + +// getCreateRequest creates the Get request. +func (client *SubscriptionGovernanceRulesExecuteStatusClient) getCreateRequest(ctx context.Context, ruleID string, operationID string, options *SubscriptionGovernanceRulesExecuteStatusClientBeginGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if ruleID == "" { + return nil, errors.New("parameter ruleID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) + if operationID == "" { + return nil, errors.New("parameter operationID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{operationId}", url.PathEscape(operationID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.host, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2022-01-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_tasks_client.go b/sdk/resourcemanager/security/armsecurity/tasks_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_tasks_client.go rename to sdk/resourcemanager/security/armsecurity/tasks_client.go index 1a5f2ca1cc6c..a63c83694ac1 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_tasks_client.go +++ b/sdk/resourcemanager/security/armsecurity/tasks_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -174,7 +175,6 @@ func (client *TasksClient) getSubscriptionLevelTaskHandleResponse(resp *http.Res } // NewListPager - Recommended tasks that will help improve the security of the subscription proactively -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2015-06-01-preview // options - TasksClientListOptions contains the optional parameters for the TasksClient.List method. func (client *TasksClient) NewListPager(options *TasksClientListOptions) *runtime.Pager[TasksClientListResponse] { @@ -236,7 +236,6 @@ func (client *TasksClient) listHandleResponse(resp *http.Response) (TasksClientL } // NewListByHomeRegionPager - Recommended tasks that will help improve the security of the subscription proactively -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2015-06-01-preview // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // options - TasksClientListByHomeRegionOptions contains the optional parameters for the TasksClient.ListByHomeRegion method. @@ -303,7 +302,6 @@ func (client *TasksClient) listByHomeRegionHandleResponse(resp *http.Response) ( } // NewListByResourceGroupPager - Recommended tasks that will help improve the security of the subscription proactively -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2015-06-01-preview // resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_time_rfc3339.go b/sdk/resourcemanager/security/armsecurity/time_rfc3339.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_time_rfc3339.go rename to sdk/resourcemanager/security/armsecurity/time_rfc3339.go index 292a4953a824..b848c8724164 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/security/armsecurity/time_rfc3339.go @@ -5,6 +5,7 @@ // 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 armsecurity diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_topology_client.go b/sdk/resourcemanager/security/armsecurity/topology_client.go similarity index 98% rename from sdk/resourcemanager/security/armsecurity/zz_generated_topology_client.go rename to sdk/resourcemanager/security/armsecurity/topology_client.go index 1f99db6cb410..4a14bd0604d3 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_topology_client.go +++ b/sdk/resourcemanager/security/armsecurity/topology_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -116,7 +117,6 @@ func (client *TopologyClient) getHandleResponse(resp *http.Response) (TopologyCl } // NewListPager - Gets a list that allows to build a topology view of a subscription. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // options - TopologyClientListOptions contains the optional parameters for the TopologyClient.List method. func (client *TopologyClient) NewListPager(options *TopologyClientListOptions) *runtime.Pager[TopologyClientListResponse] { @@ -175,7 +175,6 @@ func (client *TopologyClient) listHandleResponse(resp *http.Response) (TopologyC } // NewListByHomeRegionPager - Gets a list that allows to build a topology view of a subscription and location. -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2020-01-01 // ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // options - TopologyClientListByHomeRegionOptions contains the optional parameters for the TopologyClient.ListByHomeRegion diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_workspacesettings_client.go b/sdk/resourcemanager/security/armsecurity/workspacesettings_client.go similarity index 99% rename from sdk/resourcemanager/security/armsecurity/zz_generated_workspacesettings_client.go rename to sdk/resourcemanager/security/armsecurity/workspacesettings_client.go index 5c393c65ee8b..b7308ef3042b 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_workspacesettings_client.go +++ b/sdk/resourcemanager/security/armsecurity/workspacesettings_client.go @@ -5,6 +5,7 @@ // 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 armsecurity @@ -204,7 +205,6 @@ func (client *WorkspaceSettingsClient) getHandleResponse(resp *http.Response) (W // NewListPager - Settings about where we should store your security data and logs. If the result is empty, it means that // no custom-workspace configuration was set -// If the operation fails it returns an *azcore.ResponseError type. // Generated from API version 2017-08-01-preview // options - WorkspaceSettingsClientListOptions contains the optional parameters for the WorkspaceSettingsClient.List method. func (client *WorkspaceSettingsClient) NewListPager(options *WorkspaceSettingsClientListOptions) *runtime.Pager[WorkspaceSettingsClientListResponse] { diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_accountconnectors_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_accountconnectors_client_test.go deleted file mode 100644 index d1b43b10fc94..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_accountconnectors_client_test.go +++ /dev/null @@ -1,125 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/GetListConnectorSubscription_example.json -func ExampleAccountConnectorsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAccountConnectorsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/GetConnectorSubscription_example.json -func ExampleAccountConnectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAccountConnectorsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "aws_dev1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/CreateUpdateAwsAssumeRoleConnectorSubscription_example.json -func ExampleAccountConnectorsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAccountConnectorsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "aws_dev2", - armsecurity.ConnectorSetting{ - Properties: &armsecurity.ConnectorSettingProperties{ - AuthenticationDetails: &armsecurity.AwAssumeRoleAuthenticationDetailsProperties{ - AuthenticationType: to.Ptr(armsecurity.AuthenticationTypeAwsAssumeRole), - AwsAssumeRoleArn: to.Ptr("arn:aws:iam::81231569658:role/AscConnector"), - AwsExternalID: to.Ptr("20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - }, - HybridComputeSettings: &armsecurity.HybridComputeSettingsProperties{ - AutoProvision: to.Ptr(armsecurity.AutoProvisionOn), - ProxyServer: &armsecurity.ProxyServerProperties{ - IP: to.Ptr("167.220.197.140"), - Port: to.Ptr("34"), - }, - Region: to.Ptr("West US 2"), - ResourceGroupName: to.Ptr("AwsConnectorRG"), - ServicePrincipal: &armsecurity.ServicePrincipalProperties{ - ApplicationID: to.Ptr("ad9bcd79-be9c-45ab-abd8-80ca1654a7d1"), - Secret: to.Ptr(""), - }, - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/DeleteConnectorSubscription_example.json -func ExampleAccountConnectorsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAccountConnectorsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "aws_dev1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_adaptiveapplicationcontrols_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_adaptiveapplicationcontrols_client_test.go deleted file mode 100644 index ad9d1c5cd93b..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_adaptiveapplicationcontrols_client_test.go +++ /dev/null @@ -1,197 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ApplicationWhitelistings/GetAdaptiveApplicationControlsSubscription_example.json -func ExampleAdaptiveApplicationControlsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAdaptiveApplicationControlsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - &armsecurity.AdaptiveApplicationControlsClientListOptions{IncludePathRecommendations: to.Ptr(true), - Summary: to.Ptr(false), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ApplicationWhitelistings/GetAdaptiveApplicationControlsGroup_example.json -func ExampleAdaptiveApplicationControlsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAdaptiveApplicationControlsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "centralus", - "ERELGROUP1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ApplicationWhitelistings/PutAdaptiveApplicationControls_example.json -func ExampleAdaptiveApplicationControlsClient_Put() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAdaptiveApplicationControlsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Put(ctx, - "centralus", - "ERELGROUP1", - armsecurity.AdaptiveApplicationControlGroup{ - Properties: &armsecurity.AdaptiveApplicationControlGroupData{ - EnforcementMode: to.Ptr(armsecurity.EnforcementModeAudit), - PathRecommendations: []*armsecurity.PathRecommendation{ - { - Type: to.Ptr(armsecurity.RecommendationType("PublisherSignature")), - Path: to.Ptr("[Exe] O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US\\*\\*\\0.0.0.0"), - Action: to.Ptr(armsecurity.RecommendationActionRecommended), - Common: to.Ptr(true), - ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - FileType: to.Ptr(armsecurity.FileTypeExe), - PublisherInfo: &armsecurity.PublisherInfo{ - BinaryName: to.Ptr("*"), - ProductName: to.Ptr("*"), - PublisherName: to.Ptr("O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US"), - Version: to.Ptr("0.0.0.0"), - }, - UserSids: []*string{ - to.Ptr("S-1-1-0")}, - Usernames: []*armsecurity.UserRecommendation{ - { - RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - Username: to.Ptr("Everyone"), - }}, - }, - { - Type: to.Ptr(armsecurity.RecommendationType("ProductSignature")), - Path: to.Ptr("%OSDRIVE%\\WINDOWSAZURE\\SECAGENT\\WASECAGENTPROV.EXE"), - Action: to.Ptr(armsecurity.RecommendationActionRecommended), - Common: to.Ptr(true), - ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - FileType: to.Ptr(armsecurity.FileTypeExe), - PublisherInfo: &armsecurity.PublisherInfo{ - BinaryName: to.Ptr("*"), - ProductName: to.Ptr("MICROSOFT® COREXT"), - PublisherName: to.Ptr("CN=MICROSOFT AZURE DEPENDENCY CODE SIGN"), - Version: to.Ptr("0.0.0.0"), - }, - UserSids: []*string{ - to.Ptr("S-1-1-0")}, - Usernames: []*armsecurity.UserRecommendation{ - { - RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - Username: to.Ptr("NT AUTHORITY\\SYSTEM"), - }}, - }, - { - Type: to.Ptr(armsecurity.RecommendationType("PublisherSignature")), - Path: to.Ptr("%OSDRIVE%\\WINDOWSAZURE\\PACKAGES_201973_7415\\COLLECTGUESTLOGS.EXE"), - Action: to.Ptr(armsecurity.RecommendationActionRecommended), - Common: to.Ptr(true), - ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - FileType: to.Ptr(armsecurity.FileTypeExe), - PublisherInfo: &armsecurity.PublisherInfo{ - BinaryName: to.Ptr("*"), - ProductName: to.Ptr("*"), - PublisherName: to.Ptr("CN=MICROSOFT AZURE DEPENDENCY CODE SIGN"), - Version: to.Ptr("0.0.0.0"), - }, - UserSids: []*string{ - to.Ptr("S-1-1-0")}, - Usernames: []*armsecurity.UserRecommendation{ - { - RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - Username: to.Ptr("NT AUTHORITY\\SYSTEM"), - }}, - }, - { - Type: to.Ptr(armsecurity.RecommendationType("File")), - Path: to.Ptr("C:\\directory\\file.exe"), - Action: to.Ptr(armsecurity.RecommendationActionAdd), - Common: to.Ptr(true), - }}, - ProtectionMode: &armsecurity.ProtectionMode{ - Exe: to.Ptr(armsecurity.EnforcementModeAudit), - Msi: to.Ptr(armsecurity.EnforcementModeNone), - Script: to.Ptr(armsecurity.EnforcementModeNone), - }, - VMRecommendations: []*armsecurity.VMRecommendation{ - { - ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - EnforcementSupport: to.Ptr(armsecurity.EnforcementSupportSupported), - RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - ResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/erelh-stable/providers/microsoft.compute/virtualmachines/erelh-16090"), - }, - { - ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - EnforcementSupport: to.Ptr(armsecurity.EnforcementSupportSupported), - RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - ResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/matanvs/providers/microsoft.compute/virtualmachines/matanvs19"), - }}, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ApplicationWhitelistings/DeleteAdaptiveApplicationControls_example.json -func ExampleAdaptiveApplicationControlsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAdaptiveApplicationControlsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "centralus", - "GROUP1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_adaptivenetworkhardenings_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_adaptivenetworkhardenings_client_test.go deleted file mode 100644 index 180b394dbe6a..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_adaptivenetworkhardenings_client_test.go +++ /dev/null @@ -1,123 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AdaptiveNetworkHardenings/ListByExtendedResourceAdaptiveNetworkHardenings_example.json -func ExampleAdaptiveNetworkHardeningsClient_NewListByExtendedResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAdaptiveNetworkHardeningsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByExtendedResourcePager("rg1", - "Microsoft.Compute", - "virtualMachines", - "vm1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AdaptiveNetworkHardenings/GetAdaptiveNetworkHardening_example.json -func ExampleAdaptiveNetworkHardeningsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAdaptiveNetworkHardeningsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "Microsoft.Compute", - "virtualMachines", - "vm1", - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AdaptiveNetworkHardenings/EnforceAdaptiveNetworkHardeningRules_example.json -func ExampleAdaptiveNetworkHardeningsClient_BeginEnforce() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAdaptiveNetworkHardeningsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginEnforce(ctx, - "rg1", - "Microsoft.Compute", - "virtualMachines", - "vm1", - "default", - armsecurity.AdaptiveNetworkHardeningEnforceRequest{ - NetworkSecurityGroups: []*string{ - to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nsg1"), - to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/rg2/providers/Microsoft.Network/networkSecurityGroups/nsg2")}, - Rules: []*armsecurity.Rule{ - { - Name: to.Ptr("rule1"), - DestinationPort: to.Ptr[int32](3389), - Direction: to.Ptr(armsecurity.DirectionInbound), - IPAddresses: []*string{ - to.Ptr("100.10.1.1"), - to.Ptr("200.20.2.2"), - to.Ptr("81.199.3.0/24")}, - Protocols: []*armsecurity.TransportProtocol{ - to.Ptr(armsecurity.TransportProtocolTCP)}, - }, - { - Name: to.Ptr("rule2"), - DestinationPort: to.Ptr[int32](22), - Direction: to.Ptr(armsecurity.DirectionInbound), - IPAddresses: []*string{}, - Protocols: []*armsecurity.TransportProtocol{ - to.Ptr(armsecurity.TransportProtocolTCP)}, - }}, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_advancedthreatprotection_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_advancedthreatprotection_client_test.go deleted file mode 100644 index 2696c2f31dee..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_advancedthreatprotection_client_test.go +++ /dev/null @@ -1,68 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-01-01/examples/AdvancedThreatProtection/GetAdvancedThreatProtectionSettings_example.json -func ExampleAdvancedThreatProtectionClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAdvancedThreatProtectionClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-01-01/examples/AdvancedThreatProtection/PutAdvancedThreatProtectionSettings_example.json -func ExampleAdvancedThreatProtectionClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAdvancedThreatProtectionClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount", - armsecurity.AdvancedThreatProtectionSetting{ - Name: to.Ptr("current"), - Type: to.Ptr("Microsoft.Security/advancedThreatProtectionSettings"), - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Storage/storageAccounts/samplestorageaccount/providers/Microsoft.Security/advancedThreatProtectionSettings/current"), - Properties: &armsecurity.AdvancedThreatProtectionProperties{ - IsEnabled: to.Ptr(true), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_alerts_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_alerts_client_test.go deleted file mode 100644 index 7d5a85f003f1..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_alerts_client_test.go +++ /dev/null @@ -1,319 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-11-01/examples/Alerts/GetAlertsSubscription_example.json -func ExampleAlertsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-11-01/examples/Alerts/GetAlertsResourceGroup_example.json -func ExampleAlertsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myRg1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-11-01/examples/Alerts/GetAlertsSubscriptionsLocation_example.json -func ExampleAlertsClient_NewListSubscriptionLevelByRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListSubscriptionLevelByRegionPager("westeurope", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-11-01/examples/Alerts/GetAlertsResourceGroupLocation_example.json -func ExampleAlertsClient_NewListResourceGroupLevelByRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListResourceGroupLevelByRegionPager("westeurope", - "myRg1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-11-01/examples/Alerts/GetAlertSubscriptionLocation_example.json -func ExampleAlertsClient_GetSubscriptionLevel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetSubscriptionLevel(ctx, - "westeurope", - "2518770965529163669_F144EE95-A3E5-42DA-A279-967D115809AA", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-11-01/examples/Alerts/GetAlertResourceGroupLocation_example.json -func ExampleAlertsClient_GetResourceGroupLevel() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetResourceGroupLevel(ctx, - "westeurope", - "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", - "myRg1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-11-01/examples/Alerts/UpdateAlertSubscriptionLocation_example.json -func ExampleAlertsClient_UpdateSubscriptionLevelStateToDismiss() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.UpdateSubscriptionLevelStateToDismiss(ctx, - "westeurope", - "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", - 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/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-11-01/examples/Alerts/UpdateAlertSubscriptionLocation_resolve_example.json -func ExampleAlertsClient_UpdateSubscriptionLevelStateToResolve() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.UpdateSubscriptionLevelStateToResolve(ctx, - "westeurope", - "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", - 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/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-11-01/examples/Alerts/UpdateAlertSubscriptionLocation_example.json -func ExampleAlertsClient_UpdateSubscriptionLevelStateToActivate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.UpdateSubscriptionLevelStateToActivate(ctx, - "westeurope", - "2518298467986649999_4d25bfef-2d77-4a08-adc0-3e35715cc92a", - 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/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-11-01/examples/Alerts/UpdateAlertResourceGroupLocation_resolve_example.json -func ExampleAlertsClient_UpdateResourceGroupLevelStateToResolve() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.UpdateResourceGroupLevelStateToResolve(ctx, - "westeurope", - "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", - "myRg2", - 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/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-11-01/examples/Alerts/UpdateAlertResourceGroupLocation_example.json -func ExampleAlertsClient_UpdateResourceGroupLevelStateToDismiss() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.UpdateResourceGroupLevelStateToDismiss(ctx, - "westeurope", - "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", - "myRg2", - 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/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-11-01/examples/Alerts/UpdateAlertResourceGroupLocation_example.json -func ExampleAlertsClient_UpdateResourceGroupLevelStateToActivate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.UpdateResourceGroupLevelStateToActivate(ctx, - "westeurope", - "2518765996949954086_2325cf9e-42a2-4f72-ae7f-9b863cba2d22", - "myRg2", - 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/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-11-01/examples/Alerts/SimulateAlerts_example.json -func ExampleAlertsClient_Simulate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Simulate(ctx, - "centralus", - armsecurity.AlertSimulatorRequestBody{ - Properties: &armsecurity.AlertSimulatorBundlesRequestProperties{ - Kind: to.Ptr(armsecurity.KindBundles), - Bundles: []*armsecurity.BundleType{ - to.Ptr(armsecurity.BundleTypeAppServices), - to.Ptr(armsecurity.BundleTypeDNS), - to.Ptr(armsecurity.BundleTypeKeyVaults), - to.Ptr(armsecurity.BundleTypeKubernetesService), - to.Ptr(armsecurity.BundleTypeResourceManager), - to.Ptr(armsecurity.BundleTypeSQLServers), - to.Ptr(armsecurity.BundleTypeStorageAccounts), - to.Ptr(armsecurity.BundleTypeVirtualMachines)}, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_alertssuppressionrules_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_alertssuppressionrules_client_test.go deleted file mode 100644 index 5bd71b562ea2..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_alertssuppressionrules_client_test.go +++ /dev/null @@ -1,132 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/AlertsSuppressionRules/GetAlertsSuppressionRulesWithAlertType_example.json -func ExampleAlertsSuppressionRulesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsSuppressionRulesClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armsecurity.AlertsSuppressionRulesClientListOptions{AlertType: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/AlertsSuppressionRules/GetAlertsSuppressionRule_example.json -func ExampleAlertsSuppressionRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsSuppressionRulesClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "dismissIpAnomalyAlerts", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/AlertsSuppressionRules/PutAlertsSuppressionRule_example.json -func ExampleAlertsSuppressionRulesClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsSuppressionRulesClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "dismissIpAnomalyAlerts", - armsecurity.AlertsSuppressionRule{ - Properties: &armsecurity.AlertsSuppressionRuleProperties{ - AlertType: to.Ptr("IpAnomaly"), - Comment: to.Ptr("Test VM"), - ExpirationDateUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2019-12-01T19:50:47.083633Z"); return t }()), - Reason: to.Ptr("FalsePositive"), - State: to.Ptr(armsecurity.RuleStateEnabled), - SuppressionAlertsScope: &armsecurity.SuppressionAlertsScope{ - AllOf: []*armsecurity.ScopeElement{ - { - AdditionalProperties: map[string]interface{}{ - "in": []interface{}{ - "104.215.95.187", - "52.164.206.56", - }, - }, - Field: to.Ptr("entities.ip.address"), - }, - { - AdditionalProperties: map[string]interface{}{ - "contains": "POWERSHELL.EXE", - }, - Field: to.Ptr("entities.process.commandline"), - }}, - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/AlertsSuppressionRules/DeleteAlertsSuppressionRule_example.json -func ExampleAlertsSuppressionRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAlertsSuppressionRulesClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "dismissIpAnomalyAlerts", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_allowedconnections_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_allowedconnections_client_test.go deleted file mode 100644 index 2f052675e1f5..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_allowedconnections_client_test.go +++ /dev/null @@ -1,89 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AllowedConnections/GetAllowedConnectionsSubscription_example.json -func ExampleAllowedConnectionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAllowedConnectionsClient("3eeab341-f466-499c-a8be-85427e154bad", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AllowedConnections/GetAllowedConnectionsSubscriptionLocation_example.json -func ExampleAllowedConnectionsClient_NewListByHomeRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAllowedConnectionsClient("3eeab341-f466-499c-a8be-85427e154bad", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByHomeRegionPager("centralus", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/AllowedConnections/GetAllowedConnections_example.json -func ExampleAllowedConnectionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAllowedConnectionsClient("3eeab341-f466-499c-a8be-85427e154bad", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myResourceGroup", - "centralus", - armsecurity.ConnectionTypeInternal, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_assessments_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_assessments_client_test.go deleted file mode 100644 index 288b5e03d09f..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_assessments_client_test.go +++ /dev/null @@ -1,117 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/ListAssessments_example.json -func ExampleAssessmentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAssessmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/GetAssessment_example.json -func ExampleAssessmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAssessmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", - "21300918-b2e3-0346-785f-c77ff57d243b", - &armsecurity.AssessmentsClientGetOptions{Expand: nil}) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/PutAssessment_example.json -func ExampleAssessmentsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAssessmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", - "8bb8be0a-6010-4789-812f-e4d661c4ed0e", - armsecurity.Assessment{ - Properties: &armsecurity.AssessmentProperties{ - ResourceDetails: &armsecurity.AzureResourceDetails{ - Source: to.Ptr(armsecurity.SourceAzure), - }, - Status: &armsecurity.AssessmentStatus{ - Code: to.Ptr(armsecurity.AssessmentStatusCodeHealthy), - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/Assessments/DeleteAssessment_example.json -func ExampleAssessmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAssessmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.Compute/virtualMachineScaleSets/vmss2", - "8bb8be0a-6010-4789-812f-e4d661c4ed0e", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_assessmentsmetadata_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_assessmentsmetadata_client_test.go deleted file mode 100644 index df05b03b9c68..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_assessmentsmetadata_client_test.go +++ /dev/null @@ -1,165 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ListAssessmentsMetadata_example.json -func ExampleAssessmentsMetadataClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAssessmentsMetadataClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/GetAssessmentsMetadata_example.json -func ExampleAssessmentsMetadataClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAssessmentsMetadataClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "21300918-b2e3-0346-785f-c77ff57d243b", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/ListAssessmentsMetadata_subscription_example.json -func ExampleAssessmentsMetadataClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAssessmentsMetadataClient("0980887d-03d6-408c-9566-532f3456804e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/GetAssessmentsMetadata_subscription_example.json -func ExampleAssessmentsMetadataClient_GetInSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAssessmentsMetadataClient("0980887d-03d6-408c-9566-532f3456804e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetInSubscription(ctx, - "21300918-b2e3-0346-785f-c77ff57d243b", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/CreateAssessmentsMetadata_subscription_example.json -func ExampleAssessmentsMetadataClient_CreateInSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAssessmentsMetadataClient("0980887d-03d6-408c-9566-532f3456804e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateInSubscription(ctx, - "ca039e75-a276-4175-aebc-bcd41e4b14b7", - armsecurity.AssessmentMetadataResponse{ - Properties: &armsecurity.AssessmentMetadataPropertiesResponse{ - Description: to.Ptr("Install an endpoint protection solution on your virtual machines scale sets, to protect them from threats and vulnerabilities."), - AssessmentType: to.Ptr(armsecurity.AssessmentTypeCustomerManaged), - Categories: []*armsecurity.Categories{ - to.Ptr(armsecurity.CategoriesCompute)}, - DisplayName: to.Ptr("Install endpoint protection solution on virtual machine scale sets"), - ImplementationEffort: to.Ptr(armsecurity.ImplementationEffortLow), - RemediationDescription: to.Ptr("To install an endpoint protection solution: 1. Follow the instructions in How do I turn on antimalware in my virtual machine scale set"), - Severity: to.Ptr(armsecurity.SeverityMedium), - Threats: []*armsecurity.Threats{ - to.Ptr(armsecurity.ThreatsDataExfiltration), - to.Ptr(armsecurity.ThreatsDataSpillage), - to.Ptr(armsecurity.ThreatsMaliciousInsider)}, - UserImpact: to.Ptr(armsecurity.UserImpactLow), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-06-01/examples/AssessmentsMetadata/DeleteAssessmentsMetadata_subscription_example.json -func ExampleAssessmentsMetadataClient_DeleteInSubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAssessmentsMetadataClient("0980887d-03d6-408c-9566-532f3456804e", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.DeleteInSubscription(ctx, - "ca039e75-a276-4175-aebc-bcd41e4b14b7", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_automations_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_automations_client_test.go deleted file mode 100644 index e554fe471a1f..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_automations_client_test.go +++ /dev/null @@ -1,210 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/Automations/GetAutomationsSubscription_example.json -func ExampleAutomationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAutomationsClient("a5caac9c-5c04-49af-b3d0-e204f40345d5", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/Automations/GetAutomationsResourceGroup_example.json -func ExampleAutomationsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAutomationsClient("a5caac9c-5c04-49af-b3d0-e204f40345d5", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("exampleResourceGroup", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/Automations/GetAutomationResourceGroup_example.json -func ExampleAutomationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAutomationsClient("a5caac9c-5c04-49af-b3d0-e204f40345d5", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "exampleResourceGroup", - "exampleAutomation", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/Automations/PutAutomationAllAssessments_example.json -func ExampleAutomationsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAutomationsClient("a5caac9c-5c04-49af-b3d0-e204f40345d5", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "exampleResourceGroup", - "exampleAutomation", - armsecurity.Automation{ - Location: to.Ptr("Central US"), - Etag: to.Ptr("etag value (must be supplied for update)"), - Tags: map[string]*string{}, - Properties: &armsecurity.AutomationProperties{ - Description: to.Ptr("An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment"), - Actions: []armsecurity.AutomationActionClassification{ - &armsecurity.AutomationActionLogicApp{ - ActionType: to.Ptr(armsecurity.ActionTypeLogicApp), - LogicAppResourceID: to.Ptr("/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1"), - URI: to.Ptr("https://exampleTriggerUri1.com"), - }}, - IsEnabled: to.Ptr(true), - Scopes: []*armsecurity.AutomationScope{ - { - Description: to.Ptr("A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5"), - ScopePath: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"), - }}, - Sources: []*armsecurity.AutomationSource{ - { - EventSource: to.Ptr(armsecurity.EventSourceAssessments), - }}, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/Automations/DeleteAutomation_example.json -func ExampleAutomationsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAutomationsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "myRg", - "myAutomationName", - 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/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/Automations/ValidateAutomation_example.json -func ExampleAutomationsClient_Validate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAutomationsClient("a5caac9c-5c04-49af-b3d0-e204f40345d5", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Validate(ctx, - "exampleResourceGroup", - "exampleAutomation", - armsecurity.Automation{ - Location: to.Ptr("Central US"), - Tags: map[string]*string{}, - Properties: &armsecurity.AutomationProperties{ - Description: to.Ptr("An example of a security automation that triggers one LogicApp resource (myTest1) on any security assessment of type customAssessment"), - Actions: []armsecurity.AutomationActionClassification{ - &armsecurity.AutomationActionLogicApp{ - ActionType: to.Ptr(armsecurity.ActionTypeLogicApp), - LogicAppResourceID: to.Ptr("/subscriptions/e54a4a18-5b94-4f90-9471-bd3decad8a2e/resourceGroups/sample/providers/Microsoft.Logic/workflows/MyTest1"), - URI: to.Ptr("https://exampleTriggerUri1.com"), - }}, - IsEnabled: to.Ptr(true), - Scopes: []*armsecurity.AutomationScope{ - { - Description: to.Ptr("A description that helps to identify this scope - for example: security assessments that relate to the resource group myResourceGroup within the subscription a5caac9c-5c04-49af-b3d0-e204f40345d5"), - ScopePath: to.Ptr("/subscriptions/a5caac9c-5c04-49af-b3d0-e204f40345d5/resourceGroups/myResourceGroup"), - }}, - Sources: []*armsecurity.AutomationSource{ - { - EventSource: to.Ptr(armsecurity.EventSourceAssessments), - RuleSets: []*armsecurity.AutomationRuleSet{ - { - Rules: []*armsecurity.AutomationTriggeringRule{ - { - ExpectedValue: to.Ptr("customAssessment"), - Operator: to.Ptr(armsecurity.OperatorEquals), - PropertyJPath: to.Ptr("$.Entity.AssessmentType"), - PropertyType: to.Ptr(armsecurity.PropertyTypeString), - }}, - }}, - }}, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_autoprovisioningsettings_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_autoprovisioningsettings_client_test.go deleted file mode 100644 index 6e038b3d780e..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_autoprovisioningsettings_client_test.go +++ /dev/null @@ -1,92 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/AutoProvisioningSettings/GetAutoProvisioningSettingsSubscription_example.json -func ExampleAutoProvisioningSettingsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAutoProvisioningSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/AutoProvisioningSettings/GetAutoProvisioningSettingSubscription_example.json -func ExampleAutoProvisioningSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAutoProvisioningSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/AutoProvisioningSettings/CreateAutoProvisioningSettingsSubscription_example.json -func ExampleAutoProvisioningSettingsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewAutoProvisioningSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "default", - armsecurity.AutoProvisioningSetting{ - Name: to.Ptr("default"), - Type: to.Ptr("Microsoft.Security/autoProvisioningSettings"), - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/autoProvisioningSettings/default"), - Properties: &armsecurity.AutoProvisioningSettingProperties{ - AutoProvision: to.Ptr(armsecurity.AutoProvisionOn), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_complianceresults_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_complianceresults_client_test.go deleted file mode 100644 index deef7521cf83..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_complianceresults_client_test.go +++ /dev/null @@ -1,64 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2017-08-01/examples/ComplianceResults/ListComplianceResults_example.json -func ExampleComplianceResultsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewComplianceResultsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2017-08-01/examples/ComplianceResults/GetComplianceResults_example.json -func ExampleComplianceResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewComplianceResultsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", - "DesignateMoreThanOneOwner", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_compliances_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_compliances_client_test.go deleted file mode 100644 index 5197b8d47a51..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_compliances_client_test.go +++ /dev/null @@ -1,64 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/Compliances/GetCompliances_example.json -func ExampleCompliancesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewCompliancesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/Compliances/GetCompliance_example.json -func ExampleCompliancesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewCompliancesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", - "2018-01-01Z", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_customassessmentautomations_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_customassessmentautomations_client_test.go deleted file mode 100644 index 560c8815dcf9..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_customassessmentautomations_client_test.go +++ /dev/null @@ -1,141 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomAssessmentAutomations/customAssessmentAutomationGet_example.json -func ExampleCustomAssessmentAutomationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewCustomAssessmentAutomationsClient("e5d1b86c-3051-44d5-8802-aa65d45a279b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "TestResourceGroup", - "MyCustomAssessmentAutomation", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomAssessmentAutomations/customAssessmentAutomationCreate_example.json -func ExampleCustomAssessmentAutomationsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewCustomAssessmentAutomationsClient("e5d1b86c-3051-44d5-8802-aa65d45a279b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "TestResourceGroup", - "MyCustomAssessmentAutomation", - armsecurity.CustomAssessmentAutomationRequest{ - Properties: &armsecurity.CustomAssessmentAutomationRequestProperties{ - Description: to.Ptr("Data should be encrypted"), - CompressedQuery: to.Ptr("DQAKAEkAYQBtAF8ARwByAG8AdQBwAA0ACgB8ACAAZQB4AHQAZQBuAGQAIABIAGUAYQBsAHQAaABTAHQAYQB0AHUAcwAgAD0AIABpAGYAZgAoAHQAbwBzAHQAcgBpAG4AZwAoAFIAZQBjAG8AcgBkAC4AVQBzAGUAcgBOAGEAbQBlACkAIABjAG8AbgB0AGEAaQBuAHMAIAAnAHUAcwBlAHIAJwAsACAAJwBVAE4ASABFAEEATABUAEgAWQAnACwAIAAnAEgARQBBAEwAVABIAFkAJwApAA0ACgA="), - DisplayName: to.Ptr("Password Policy"), - RemediationDescription: to.Ptr("Encrypt store by..."), - Severity: to.Ptr(armsecurity.SeverityEnumMedium), - SupportedCloud: to.Ptr(armsecurity.SupportedCloudEnumAWS), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomAssessmentAutomations/customAssessmentAutomationDelete_example.json -func ExampleCustomAssessmentAutomationsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewCustomAssessmentAutomationsClient("e5d1b86c-3051-44d5-8802-aa65d45a279b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "TestResourceGroup", - "MyCustomAssessmentAutomation", - 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/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomAssessmentAutomations/customAssessmentAutomationListByResourceGroup_example.json -func ExampleCustomAssessmentAutomationsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewCustomAssessmentAutomationsClient("e5d1b86c-3051-44d5-8802-aa65d45a279b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("TestResourceGroup", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomAssessmentAutomations/customAssessmentAutomationListBySubscription_example.json -func ExampleCustomAssessmentAutomationsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewCustomAssessmentAutomationsClient("e5d1b86c-3051-44d5-8802-aa65d45a279b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_customentitystoreassignments_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_customentitystoreassignments_client_test.go deleted file mode 100644 index 3784d5e5e1cf..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_customentitystoreassignments_client_test.go +++ /dev/null @@ -1,136 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomEntityStoreAssignments/customEntityStoreAssignmentGet_example.json -func ExampleCustomEntityStoreAssignmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewCustomEntityStoreAssignmentsClient("e5d1b86c-3051-44d5-8802-aa65d45a279b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "TestResourceGroup", - "33e7cc6e-a139-4723-a0e5-76993aee0771", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomEntityStoreAssignments/customEntityStoreAssignmentCreate_example.json -func ExampleCustomEntityStoreAssignmentsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewCustomEntityStoreAssignmentsClient("e5d1b86c-3051-44d5-8802-aa65d45a279b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "TestResourceGroup", - "33e7cc6e-a139-4723-a0e5-76993aee0771", - armsecurity.CustomEntityStoreAssignmentRequest{ - Properties: &armsecurity.CustomEntityStoreAssignmentRequestProperties{ - Principal: to.Ptr("aaduser=f3923a3e-ad57-4752-b1a9-fbf3c8e5e082;72f988bf-86f1-41af-91ab-2d7cd011db47"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomEntityStoreAssignments/customEntityStoreAssignmentDelete_example.json -func ExampleCustomEntityStoreAssignmentsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewCustomEntityStoreAssignmentsClient("e5d1b86c-3051-44d5-8802-aa65d45a279b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "TestResourceGroup", - "33e7cc6e-a139-4723-a0e5-76993aee0771", - 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/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomEntityStoreAssignments/customEntityStoreAssignmentListByResourceGroup_example.json -func ExampleCustomEntityStoreAssignmentsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewCustomEntityStoreAssignmentsClient("e5d1b86c-3051-44d5-8802-aa65d45a279b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("TestResourceGroup", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/CustomEntityStoreAssignments/customEntityStoreAssignmentListBySubscription_example.json -func ExampleCustomEntityStoreAssignmentsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewCustomEntityStoreAssignmentsClient("e5d1b86c-3051-44d5-8802-aa65d45a279b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_devicesecuritygroups_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_devicesecuritygroups_client_test.go deleted file mode 100644 index 9025f66f4871..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_devicesecuritygroups_client_test.go +++ /dev/null @@ -1,119 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/ListDeviceSecurityGroups_example.json -func ExampleDeviceSecurityGroupsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewDeviceSecurityGroupsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/GetDeviceSecurityGroups_example.json -func ExampleDeviceSecurityGroupsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewDeviceSecurityGroupsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", - "samplesecuritygroup", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/PutDeviceSecurityGroups_example.json -func ExampleDeviceSecurityGroupsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewDeviceSecurityGroupsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", - "samplesecuritygroup", - armsecurity.DeviceSecurityGroup{ - Properties: &armsecurity.DeviceSecurityGroupProperties{ - TimeWindowRules: []armsecurity.TimeWindowCustomAlertRuleClassification{ - &armsecurity.ActiveConnectionsNotInAllowedRange{ - IsEnabled: to.Ptr(true), - RuleType: to.Ptr("ActiveConnectionsNotInAllowedRange"), - MaxThreshold: to.Ptr[int32](30), - MinThreshold: to.Ptr[int32](0), - TimeWindowSize: to.Ptr("PT05M"), - }}, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/DeviceSecurityGroups/DeleteDeviceSecurityGroups_example.json -func ExampleDeviceSecurityGroupsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewDeviceSecurityGroupsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/SampleRG/providers/Microsoft.Devices/iotHubs/sampleiothub", - "samplesecuritygroup", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_discoveredsecuritysolutions_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_discoveredsecuritysolutions_client_test.go deleted file mode 100644 index e38845062040..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_discoveredsecuritysolutions_client_test.go +++ /dev/null @@ -1,89 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/DiscoveredSecuritySolutions/GetDiscoveredSecuritySolutionsSubscription_example.json -func ExampleDiscoveredSecuritySolutionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewDiscoveredSecuritySolutionsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/DiscoveredSecuritySolutions/GetDiscoveredSecuritySolutionsSubscriptionLocation_example.json -func ExampleDiscoveredSecuritySolutionsClient_NewListByHomeRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewDiscoveredSecuritySolutionsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByHomeRegionPager("centralus", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/DiscoveredSecuritySolutions/GetDiscoveredSecuritySolutionResourceGroupLocation_example.json -func ExampleDiscoveredSecuritySolutionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewDiscoveredSecuritySolutionsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myRg2", - "centralus", - "paloalto7", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_externalsecuritysolutions_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_externalsecuritysolutions_client_test.go deleted file mode 100644 index 6eff88523e3a..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_externalsecuritysolutions_client_test.go +++ /dev/null @@ -1,89 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ExternalSecuritySolutions/GetExternalSecuritySolutionsSubscription_example.json -func ExampleExternalSecuritySolutionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewExternalSecuritySolutionsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ExternalSecuritySolutions/GetExternalSecuritySolutionsSubscriptionLocation_example.json -func ExampleExternalSecuritySolutionsClient_NewListByHomeRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewExternalSecuritySolutionsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByHomeRegionPager("centralus", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ExternalSecuritySolutions/GetExternalSecuritySolution_example.json -func ExampleExternalSecuritySolutionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewExternalSecuritySolutionsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "defaultresourcegroup-eus", - "centralus", - "aad_defaultworkspace-20ff7fc3-e762-44dd-bd96-b71116dcdc23-eus", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_informationprotectionpolicies_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_informationprotectionpolicies_client_test.go deleted file mode 100644 index bf589f0dd794..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_informationprotectionpolicies_client_test.go +++ /dev/null @@ -1,136 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/InformationProtectionPolicies/GetCustomInformationProtectionPolicy_example.json -func ExampleInformationProtectionPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewInformationProtectionPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", - armsecurity.InformationProtectionPolicyNameCustom, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/InformationProtectionPolicies/CreateOrUpdateInformationProtectionPolicy_example.json -func ExampleInformationProtectionPoliciesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewInformationProtectionPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", - armsecurity.InformationProtectionPolicyNameCustom, - armsecurity.InformationProtectionPolicy{ - Properties: &armsecurity.InformationProtectionPolicyProperties{ - InformationTypes: map[string]*armsecurity.InformationType{ - "3bf35491-99b8-41f2-86d5-c1200a7df658": { - Custom: to.Ptr(true), - DisplayName: to.Ptr("Custom"), - Enabled: to.Ptr(true), - Keywords: []*armsecurity.InformationProtectionKeyword{ - { - CanBeNumeric: to.Ptr(true), - Custom: to.Ptr(true), - Pattern: to.Ptr("%custom%"), - }}, - Order: to.Ptr[int32](1400), - RecommendedLabelID: to.Ptr("7aa516c7-5a53-4857-bc6e-6808c6acd542"), - }, - "7fb9419d-2473-4ad8-8e11-b25cc8cf6a07": { - Custom: to.Ptr(false), - DisplayName: to.Ptr("Networking"), - Enabled: to.Ptr(true), - Keywords: []*armsecurity.InformationProtectionKeyword{ - { - CanBeNumeric: to.Ptr(false), - Custom: to.Ptr(true), - Pattern: to.Ptr("%networking%"), - }}, - Order: to.Ptr[int32](100), - RecommendedLabelID: to.Ptr("575739d2-3d53-4df0-9042-4c7772d5c7b1"), - }, - }, - Labels: map[string]*armsecurity.SensitivityLabel{ - "1345da73-bc5a-4a8f-b7dd-3820eb713da8": { - DisplayName: to.Ptr("Public"), - Enabled: to.Ptr(true), - Order: to.Ptr[int32](100), - }, - "575739d2-3d53-4df0-9042-4c7772d5c7b1": { - DisplayName: to.Ptr("Confidential"), - Enabled: to.Ptr(true), - Order: to.Ptr[int32](300), - }, - "7aa516c7-5a53-4857-bc6e-6808c6acd542": { - DisplayName: to.Ptr("General"), - Enabled: to.Ptr(true), - Order: to.Ptr[int32](200), - }, - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/InformationProtectionPolicies/ListInformationProtectionPolicies_example.json -func ExampleInformationProtectionPoliciesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewInformationProtectionPoliciesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("providers/Microsoft.Management/managementGroups/148059f7-faf3-49a6-ba35-85122112291e", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_ingestionsettings_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_ingestionsettings_client_test.go deleted file mode 100644 index f8d615815338..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_ingestionsettings_client_test.go +++ /dev/null @@ -1,145 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/GetIngestionSettings_example.json -func ExampleIngestionSettingsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIngestionSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/GetIngestionSetting_example.json -func ExampleIngestionSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIngestionSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/CreateIngestionSetting_example.json -func ExampleIngestionSettingsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIngestionSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "default", - armsecurity.IngestionSetting{}, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/DeleteIngestionSetting_example.json -func ExampleIngestionSettingsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIngestionSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "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/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/ListTokensIngestionSetting_example.json -func ExampleIngestionSettingsClient_ListTokens() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIngestionSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListTokens(ctx, - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-01-15-preview/examples/IngestionSettings/ListConnectionStrings_example.json -func ExampleIngestionSettingsClient_ListConnectionStrings() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIngestionSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListConnectionStrings(ctx, - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_iotsecuritysolution_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_iotsecuritysolution_client_test.go deleted file mode 100644 index 5284cd554472..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_iotsecuritysolution_client_test.go +++ /dev/null @@ -1,202 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/GetIoTSecuritySolutionsListByIotHub.json -func ExampleIotSecuritySolutionClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIotSecuritySolutionClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(&armsecurity.IotSecuritySolutionClientListBySubscriptionOptions{Filter: to.Ptr("properties.iotHubs/any(i eq \"/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub\")")}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/GetIoTSecuritySolutionsListByRg.json -func ExampleIotSecuritySolutionClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIotSecuritySolutionClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("MyGroup", - &armsecurity.IotSecuritySolutionClientListByResourceGroupOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/GetIoTSecuritySolution.json -func ExampleIotSecuritySolutionClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIotSecuritySolutionClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "MyGroup", - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/CreateIoTSecuritySolution.json -func ExampleIotSecuritySolutionClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIotSecuritySolutionClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "MyGroup", - "default", - armsecurity.IoTSecuritySolutionModel{ - Tags: map[string]*string{}, - Location: to.Ptr("East Us"), - Properties: &armsecurity.IoTSecuritySolutionProperties{ - DisabledDataSources: []*armsecurity.DataSource{}, - DisplayName: to.Ptr("Solution Default"), - Export: []*armsecurity.ExportData{}, - IotHubs: []*string{ - to.Ptr("/subscriptions/075423e9-7d33-4166-8bdf-3920b04e3735/resourceGroups/myRg/providers/Microsoft.Devices/IotHubs/FirstIotHub")}, - RecommendationsConfiguration: []*armsecurity.RecommendationConfigurationProperties{ - { - RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTOpenPorts), - Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - }, - { - RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTSharedCredentials), - Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - }}, - Status: to.Ptr(armsecurity.SecuritySolutionStatusEnabled), - UnmaskedIPLoggingStatus: to.Ptr(armsecurity.UnmaskedIPLoggingStatusEnabled), - UserDefinedResources: &armsecurity.UserDefinedResourcesProperties{ - Query: to.Ptr("where type != \"microsoft.devices/iothubs\" | where name contains \"iot\""), - QuerySubscriptions: []*string{ - to.Ptr("075423e9-7d33-4166-8bdf-3920b04e3735")}, - }, - Workspace: to.Ptr("/subscriptions/c4930e90-cd72-4aa5-93e9-2d081d129569/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace1"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/UpdateIoTSecuritySolution.json -func ExampleIotSecuritySolutionClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIotSecuritySolutionClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "myRg", - "default", - armsecurity.UpdateIotSecuritySolutionData{ - Tags: map[string]*string{ - "foo": to.Ptr("bar"), - }, - Properties: &armsecurity.UpdateIoTSecuritySolutionProperties{ - RecommendationsConfiguration: []*armsecurity.RecommendationConfigurationProperties{ - { - RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTOpenPorts), - Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - }, - { - RecommendationType: to.Ptr(armsecurity.RecommendationTypeIoTSharedCredentials), - Status: to.Ptr(armsecurity.RecommendationConfigStatusDisabled), - }}, - UserDefinedResources: &armsecurity.UserDefinedResourcesProperties{ - Query: to.Ptr("where type != \"microsoft.devices/iothubs\" | where name contains \"v2\""), - QuerySubscriptions: []*string{ - to.Ptr("075423e9-7d33-4166-8bdf-3920b04e3735")}, - }, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutions/DeleteIoTSecuritySolution.json -func ExampleIotSecuritySolutionClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIotSecuritySolutionClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "MyGroup", - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_iotsecuritysolutionanalytics_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_iotsecuritysolutionanalytics_client_test.go deleted file mode 100644 index 4b26bda0cd05..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_iotsecuritysolutionanalytics_client_test.go +++ /dev/null @@ -1,61 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAnalyticsList.json -func ExampleIotSecuritySolutionAnalyticsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIotSecuritySolutionAnalyticsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - "MyGroup", - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAnalytics.json -func ExampleIotSecuritySolutionAnalyticsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIotSecuritySolutionAnalyticsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "MyGroup", - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_iotsecuritysolutionsanalyticsaggregatedalert_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_iotsecuritysolutionsanalyticsaggregatedalert_client_test.go deleted file mode 100644 index 010a56325672..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_iotsecuritysolutionsanalyticsaggregatedalert_client_test.go +++ /dev/null @@ -1,87 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAggregatedAlertList.json -func ExampleIotSecuritySolutionsAnalyticsAggregatedAlertClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIotSecuritySolutionsAnalyticsAggregatedAlertClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("MyGroup", - "default", - &armsecurity.IotSecuritySolutionsAnalyticsAggregatedAlertClientListOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityAggregatedAlert.json -func ExampleIotSecuritySolutionsAnalyticsAggregatedAlertClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIotSecuritySolutionsAnalyticsAggregatedAlertClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "MyGroup", - "default", - "IoT_Bruteforce_Fail/2019-02-02", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/PostIoTSecuritySolutionsSecurityAggregatedAlertDismiss.json -func ExampleIotSecuritySolutionsAnalyticsAggregatedAlertClient_Dismiss() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIotSecuritySolutionsAnalyticsAggregatedAlertClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Dismiss(ctx, - "IoTEdgeResources", - "default", - "IoT_Bruteforce_Fail/2019-02-02/dismiss", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_iotsecuritysolutionsanalyticsrecommendation_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_iotsecuritysolutionsanalyticsrecommendation_client_test.go deleted file mode 100644 index 914b9b0566d0..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_iotsecuritysolutionsanalyticsrecommendation_client_test.go +++ /dev/null @@ -1,66 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityRecommendation.json -func ExampleIotSecuritySolutionsAnalyticsRecommendationClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIotSecuritySolutionsAnalyticsRecommendationClient("075423e9-7d33-4166-8bdf-3920b04e3735", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "IoTEdgeResources", - "default", - "OpenPortsOnDevice", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2019-08-01/examples/IoTSecuritySolutionsAnalytics/GetIoTSecuritySolutionsSecurityRecommendationList.json -func ExampleIotSecuritySolutionsAnalyticsRecommendationClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewIotSecuritySolutionsAnalyticsRecommendationClient("075423e9-7d33-4166-8bdf-3920b04e3735", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("IoTEdgeResources", - "default", - &armsecurity.IotSecuritySolutionsAnalyticsRecommendationClientListOptions{Top: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_jitnetworkaccesspolicies_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_jitnetworkaccesspolicies_client_test.go deleted file mode 100644 index 9fe27eb058ac..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_jitnetworkaccesspolicies_client_test.go +++ /dev/null @@ -1,264 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/GetJitNetworkAccessPoliciesSubscription_example.json -func ExampleJitNetworkAccessPoliciesClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewJitNetworkAccessPoliciesClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/GetJitNetworkAccessPoliciesSubscriptionLocation_example.json -func ExampleJitNetworkAccessPoliciesClient_NewListByRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewJitNetworkAccessPoliciesClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByRegionPager("westeurope", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/GetJitNetworkAccessPoliciesResourceGroup_example.json -func ExampleJitNetworkAccessPoliciesClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewJitNetworkAccessPoliciesClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myRg1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/GetJitNetworkAccessPoliciesResourceGroupLocation_example.json -func ExampleJitNetworkAccessPoliciesClient_NewListByResourceGroupAndRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewJitNetworkAccessPoliciesClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupAndRegionPager("myRg1", - "westeurope", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/GetJitNetworkAccessPolicy_example.json -func ExampleJitNetworkAccessPoliciesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewJitNetworkAccessPoliciesClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myRg1", - "westeurope", - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/CreateJitNetworkAccessPolicy_example.json -func ExampleJitNetworkAccessPoliciesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewJitNetworkAccessPoliciesClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "myRg1", - "westeurope", - "default", - armsecurity.JitNetworkAccessPolicy{ - Kind: to.Ptr("Basic"), - Location: to.Ptr("westeurope"), - Name: to.Ptr("default"), - Type: to.Ptr("Microsoft.Security/locations/jitNetworkAccessPolicies"), - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Security/locations/westeurope/jitNetworkAccessPolicies/default"), - Properties: &armsecurity.JitNetworkAccessPolicyProperties{ - ProvisioningState: to.Ptr("Succeeded"), - Requests: []*armsecurity.JitNetworkAccessRequest{ - { - Requestor: to.Ptr("barbara@contoso.com"), - StartTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T08:06:45.5691611Z"); return t }()), - VirtualMachines: []*armsecurity.JitNetworkAccessRequestVirtualMachine{ - { - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - Ports: []*armsecurity.JitNetworkAccessRequestPort{ - { - AllowedSourceAddressPrefix: to.Ptr("192.127.0.2"), - EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T09:06:45.5691611Z"); return t }()), - Number: to.Ptr[int32](3389), - Status: to.Ptr(armsecurity.StatusInitiated), - StatusReason: to.Ptr(armsecurity.StatusReasonUserRequested), - }}, - }}, - }}, - VirtualMachines: []*armsecurity.JitNetworkAccessPolicyVirtualMachine{ - { - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - Ports: []*armsecurity.JitNetworkAccessPortRule{ - { - AllowedSourceAddressPrefix: to.Ptr("*"), - MaxRequestAccessDuration: to.Ptr("PT3H"), - Number: to.Ptr[int32](22), - Protocol: to.Ptr(armsecurity.ProtocolAll), - }, - { - AllowedSourceAddressPrefix: to.Ptr("*"), - MaxRequestAccessDuration: to.Ptr("PT3H"), - Number: to.Ptr[int32](3389), - Protocol: to.Ptr(armsecurity.ProtocolAll), - }}, - }}, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/DeleteJitNetworkAccessPolicy_example.json -func ExampleJitNetworkAccessPoliciesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewJitNetworkAccessPoliciesClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "myRg1", - "westeurope", - "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/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/JitNetworkAccessPolicies/InitiateJitNetworkAccessPolicy_example.json -func ExampleJitNetworkAccessPoliciesClient_Initiate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewJitNetworkAccessPoliciesClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Initiate(ctx, - "myRg1", - "westeurope", - "default", - armsecurity.JitNetworkAccessPolicyInitiateRequest{ - Justification: to.Ptr("testing a new version of the product"), - VirtualMachines: []*armsecurity.JitNetworkAccessPolicyInitiateVirtualMachine{ - { - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg1/providers/Microsoft.Compute/virtualMachines/vm1"), - Ports: []*armsecurity.JitNetworkAccessPolicyInitiatePort{ - { - AllowedSourceAddressPrefix: to.Ptr("192.127.0.2"), - Number: to.Ptr[int32](3389), - }}, - }}, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_locations_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_locations_client_test.go deleted file mode 100644 index 217721cc738a..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_locations_client_test.go +++ /dev/null @@ -1,62 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Locations/GetLocations_example.json -func ExampleLocationsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewLocationsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Locations/GetLocation_example.json -func ExampleLocationsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewLocationsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "centralus", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_mdeonboardings_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_mdeonboardings_client_test.go deleted file mode 100644 index e77e088a85cf..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_mdeonboardings_client_test.go +++ /dev/null @@ -1,57 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-10-01-preview/examples/MdeOnboardings/ListMdeOnboardings_example.json -func ExampleMdeOnboardingsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewMdeOnboardingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-10-01-preview/examples/MdeOnboardings/GetMdeOnboardings_example.json -func ExampleMdeOnboardingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewMdeOnboardingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_pricings_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_pricings_client_test.go deleted file mode 100644 index a8041b80bade..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_pricings_client_test.go +++ /dev/null @@ -1,86 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2022-03-01/examples/Pricings/ListPricings_example.json -func ExamplePricingsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewPricingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2022-03-01/examples/Pricings/GetPricingByName_example.json -func ExamplePricingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewPricingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "VirtualMachines", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2022-03-01/examples/Pricings/PutPricingByName_example.json -func ExamplePricingsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewPricingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "VirtualMachines", - armsecurity.Pricing{ - Properties: &armsecurity.PricingProperties{ - PricingTier: to.Ptr(armsecurity.PricingTierStandard), - SubPlan: to.Ptr("P2"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_regulatorycomplianceassessments_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_regulatorycomplianceassessments_client_test.go deleted file mode 100644 index d55e4782e3f9..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_regulatorycomplianceassessments_client_test.go +++ /dev/null @@ -1,66 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceAssessmentList_example.json -func ExampleRegulatoryComplianceAssessmentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewRegulatoryComplianceAssessmentsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("PCI-DSS-3.2", - "1.1", - &armsecurity.RegulatoryComplianceAssessmentsClientListOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceAssessment_example.json -func ExampleRegulatoryComplianceAssessmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewRegulatoryComplianceAssessmentsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "PCI-DSS-3.2", - "1.1", - "968548cb-02b3-8cd2-11f8-0cf64ab1a347", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_regulatorycompliancecontrols_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_regulatorycompliancecontrols_client_test.go deleted file mode 100644 index e47cad213c89..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_regulatorycompliancecontrols_client_test.go +++ /dev/null @@ -1,64 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceControlList_example.json -func ExampleRegulatoryComplianceControlsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewRegulatoryComplianceControlsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("PCI-DSS-3.2", - &armsecurity.RegulatoryComplianceControlsClientListOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceControl_example.json -func ExampleRegulatoryComplianceControlsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewRegulatoryComplianceControlsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "PCI-DSS-3.2", - "1.1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_regulatorycompliancestandards_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_regulatorycompliancestandards_client_test.go deleted file mode 100644 index a2a52dbc1c03..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_regulatorycompliancestandards_client_test.go +++ /dev/null @@ -1,62 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceStandardList_example.json -func ExampleRegulatoryComplianceStandardsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewRegulatoryComplianceStandardsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armsecurity.RegulatoryComplianceStandardsClientListOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/RegulatoryCompliance/getRegulatoryComplianceStandard_example.json -func ExampleRegulatoryComplianceStandardsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewRegulatoryComplianceStandardsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "PCI-DSS-3.2", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_securescorecontroldefinitions_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_securescorecontroldefinitions_client_test.go deleted file mode 100644 index 3e0d0f8a5be8..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_securescorecontroldefinitions_client_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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScoreControlDefinitions/ListSecureScoreControlDefinitions_example.json -func ExampleSecureScoreControlDefinitionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSecureScoreControlDefinitionsClient("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScoreControlDefinitions/ListSecureScoreControlDefinitions_subscription_example.json -func ExampleSecureScoreControlDefinitionsClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSecureScoreControlDefinitionsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_securescorecontrols_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_securescorecontrols_client_test.go deleted file mode 100644 index 25a349d6d91f..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_securescorecontrols_client_test.go +++ /dev/null @@ -1,66 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ListSecureScoreControlsForName_builtin_example.json -func ExampleSecureScoreControlsClient_NewListBySecureScorePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSecureScoreControlsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySecureScorePager("ascScore", - &armsecurity.SecureScoreControlsClientListBySecureScoreOptions{Expand: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ListSecureScoreControls_example.json -func ExampleSecureScoreControlsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSecureScoreControlsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armsecurity.SecureScoreControlsClientListOptions{Expand: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_securescores_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_securescores_client_test.go deleted file mode 100644 index c099019348c4..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_securescores_client_test.go +++ /dev/null @@ -1,62 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/ListSecureScores_example.json -func ExampleSecureScoresClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSecureScoresClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/secureScores/GetSecureScoresSingle_example.json -func ExampleSecureScoresClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSecureScoresClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "ascScore", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_securityconnectors_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_securityconnectors_client_test.go deleted file mode 100644 index 0a8ccb7564b0..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_securityconnectors_client_test.go +++ /dev/null @@ -1,185 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/SecurityConnectors/GetSecurityConnectorsSubscription_example.json -func ExampleConnectorsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewConnectorsClient("a5caac9c-5c04-49af-b3d0-e204f40345d5", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/SecurityConnectors/GetSecurityConnectorsResourceGroup_example.json -func ExampleConnectorsClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewConnectorsClient("a5caac9c-5c04-49af-b3d0-e204f40345d5", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("exampleResourceGroup", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/SecurityConnectors/GetSecurityConnectorResourceGroup_example.json -func ExampleConnectorsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewConnectorsClient("a5caac9c-5c04-49af-b3d0-e204f40345d5", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "exampleResourceGroup", - "exampleSecurityConnectorName", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/SecurityConnectors/PutSecurityConnector_example.json -func ExampleConnectorsClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewConnectorsClient("a5caac9c-5c04-49af-b3d0-e204f40345d5", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "exampleResourceGroup", - "exampleSecurityConnectorName", - armsecurity.Connector{ - Location: to.Ptr("Central US"), - Etag: to.Ptr("etag value (must be supplied for update)"), - Tags: map[string]*string{}, - Properties: &armsecurity.ConnectorProperties{ - CloudName: to.Ptr(armsecurity.CloudNameAWS), - HierarchyIdentifier: to.Ptr("exampleHierarchyId"), - Offerings: []armsecurity.CloudOfferingClassification{ - &armsecurity.CspmMonitorAwsOffering{ - OfferingType: to.Ptr(armsecurity.OfferingTypeCspmMonitorAws), - NativeCloudConnection: &armsecurity.CspmMonitorAwsOfferingNativeCloudConnection{ - CloudRoleArn: to.Ptr("arn:aws:iam::00000000:role/ASCMonitor"), - }, - }}, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/SecurityConnectors/PatchSecurityConnector_example.json -func ExampleConnectorsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewConnectorsClient("a5caac9c-5c04-49af-b3d0-e204f40345d5", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "exampleResourceGroup", - "exampleSecurityConnectorName", - armsecurity.Connector{ - Location: to.Ptr("Central US"), - Etag: to.Ptr("etag value (must be supplied for update)"), - Tags: map[string]*string{}, - Properties: &armsecurity.ConnectorProperties{ - CloudName: to.Ptr(armsecurity.CloudNameAWS), - HierarchyIdentifier: to.Ptr("exampleHierarchyId"), - Offerings: []armsecurity.CloudOfferingClassification{ - &armsecurity.CspmMonitorAwsOffering{ - OfferingType: to.Ptr(armsecurity.OfferingTypeCspmMonitorAws), - NativeCloudConnection: &armsecurity.CspmMonitorAwsOfferingNativeCloudConnection{ - CloudRoleArn: to.Ptr("arn:aws:iam::00000000:role/ASCMonitor"), - }, - }}, - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-07-01-preview/examples/SecurityConnectors/DeleteSecurityConnector_example.json -func ExampleConnectorsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewConnectorsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "myRg", - "mySecurityConnectorName", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_securitycontacts_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_securitycontacts_client_test.go deleted file mode 100644 index 9d8812f8da51..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_securitycontacts_client_test.go +++ /dev/null @@ -1,144 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/SecurityContacts/GetSecurityContactsSubscription_full_example.json -func ExampleContactsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewContactsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/SecurityContacts/GetSecurityContact_full_example.json -func ExampleContactsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewContactsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "default1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/SecurityContacts/CreateSecurityContact_full_example.json -func ExampleContactsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewContactsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "default1", - armsecurity.Contact{ - Name: to.Ptr("default1"), - Type: to.Ptr("Microsoft.Security/securityContacts"), - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/securityContacts/default1"), - Properties: &armsecurity.ContactProperties{ - AlertNotifications: to.Ptr(armsecurity.AlertNotificationsOn), - AlertsToAdmins: to.Ptr(armsecurity.AlertsToAdminsOn), - Email: to.Ptr("john@contoso.com"), - Phone: to.Ptr("(214)275-4038"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/SecurityContacts/DeleteSecurityContact_example.json -func ExampleContactsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewContactsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "default1", - 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/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/SecurityContacts/UpdateSecurityContact_full_example.json -func ExampleContactsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewContactsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "john", - armsecurity.Contact{ - Name: to.Ptr("default1"), - Type: to.Ptr("Microsoft.Security/securityContacts"), - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/securityContacts/default1"), - Properties: &armsecurity.ContactProperties{ - AlertNotifications: to.Ptr(armsecurity.AlertNotificationsOn), - Phone: to.Ptr("(214)275-4038"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_securitysolutions_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_securitysolutions_client_test.go deleted file mode 100644 index d93d63102338..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_securitysolutions_client_test.go +++ /dev/null @@ -1,64 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutions/GetSecuritySolutionsSubscription_example.json -func ExampleSolutionsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSolutionsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutions/GetSecuritySolutionsResourceGroupLocation_example.json -func ExampleSolutionsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSolutionsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myRg2", - "centralus", - "paloalto7", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_securitysolutionsreferencedata_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_securitysolutionsreferencedata_client_test.go deleted file mode 100644 index 6d1788b4b846..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_securitysolutionsreferencedata_client_test.go +++ /dev/null @@ -1,58 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutionsReferenceData/GetSecuritySolutionsReferenceDataSubscription_example.json -func ExampleSolutionsReferenceDataClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSolutionsReferenceDataClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/SecuritySolutionsReferenceData/GetSecuritySolutionsReferenceDataSubscriptionLocation_example.json -func ExampleSolutionsReferenceDataClient_ListByHomeRegion() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSolutionsReferenceDataClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListByHomeRegion(ctx, - "westcentralus", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_servervulnerabilityassessment_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_servervulnerabilityassessment_client_test.go deleted file mode 100644 index a7ec23aaec0e..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_servervulnerabilityassessment_client_test.go +++ /dev/null @@ -1,113 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ServerVulnerabilityAssessments/ListByExtendedResourceServerVulnerabilityAssessments_example.json -func ExampleServerVulnerabilityAssessmentClient_ListByExtendedResource() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewServerVulnerabilityAssessmentClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.ListByExtendedResource(ctx, - "rg1", - "Microsoft.Compute", - "virtualMachines", - "vm1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ServerVulnerabilityAssessments/GetServerVulnerabilityAssessments_example.json -func ExampleServerVulnerabilityAssessmentClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewServerVulnerabilityAssessmentClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "rg1", - "Microsoft.Compute", - "virtualMachines", - "vm1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ServerVulnerabilityAssessments/CreateServerVulnerabilityAssessments_example.json -func ExampleServerVulnerabilityAssessmentClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewServerVulnerabilityAssessmentClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.CreateOrUpdate(ctx, - "rg1", - "Microsoft.Compute", - "virtualMachines", - "vm1", - 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/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/ServerVulnerabilityAssessments/DeleteServerVulnerabilityAssessments_example.json -func ExampleServerVulnerabilityAssessmentClient_BeginDelete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewServerVulnerabilityAssessmentClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := client.BeginDelete(ctx, - "rg1", - "Microsoft.Compute", - "virtualMachines", - "vm1", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - _, err = poller.PollUntilDone(ctx, nil) - if err != nil { - log.Fatalf("failed to pull the result: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_settings_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_settings_client_test.go deleted file mode 100644 index ea8f301e2ef4..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_settings_client_test.go +++ /dev/null @@ -1,90 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-07-01/examples/Settings/GetSettings_example.json -func ExampleSettingsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-07-01/examples/Settings/GetSetting_example.json -func ExampleSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - armsecurity.SettingNameMCAS, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2021-07-01/examples/Settings/UpdateSetting_example.json -func ExampleSettingsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - armsecurity.SettingNameMCAS, - &armsecurity.DataExportSettings{ - Kind: to.Ptr(armsecurity.SettingKindDataExportSettings), - Properties: &armsecurity.DataExportSettingProperties{ - Enabled: to.Ptr(true), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_softwareinventories_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_softwareinventories_client_test.go deleted file mode 100644 index 9bc86e4f2efe..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_softwareinventories_client_test.go +++ /dev/null @@ -1,94 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-05-01-preview/examples/SoftwareInventories/ListByExtendedResourceSoftwareInventories_example.json -func ExampleSoftwareInventoriesClient_NewListByExtendedResourcePager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSoftwareInventoriesClient("e5d1b86c-3051-44d5-8802-aa65d45a279b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByExtendedResourcePager("EITAN-TESTS", - "Microsoft.Compute", - "virtualMachines", - "Eitan-Test1", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-05-01-preview/examples/SoftwareInventories/ListBySubscriptionSoftwareInventories_example.json -func ExampleSoftwareInventoriesClient_NewListBySubscriptionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSoftwareInventoriesClient("e5d1b86c-3051-44d5-8802-aa65d45a279b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListBySubscriptionPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2021-05-01-preview/examples/SoftwareInventories/GetSoftware_example.json -func ExampleSoftwareInventoriesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSoftwareInventoriesClient("e5d1b86c-3051-44d5-8802-aa65d45a279b", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "EITAN-TESTS", - "Microsoft.Compute", - "virtualMachines", - "Eitan-Test1", - "outlook_16.0.10371.20060", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_sqlvulnerabilityassessmentbaselinerules_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_sqlvulnerabilityassessmentbaselinerules_client_test.go deleted file mode 100644 index b5b55a6b79d7..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_sqlvulnerabilityassessmentbaselinerules_client_test.go +++ /dev/null @@ -1,156 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2020-07-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Put.json -func ExampleSQLVulnerabilityAssessmentBaselineRulesClient_CreateOrUpdate() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSQLVulnerabilityAssessmentBaselineRulesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.CreateOrUpdate(ctx, - "VA1234", - "55555555-6666-7777-8888-999999999999", - "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", - &armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions{Body: &armsecurity.RuleResultsInput{ - LatestScan: to.Ptr(false), - Results: [][]*string{ - { - to.Ptr("userA"), - to.Ptr("SELECT")}, - { - to.Ptr("userB"), - to.Ptr("SELECT")}}, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2020-07-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Get.json -func ExampleSQLVulnerabilityAssessmentBaselineRulesClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSQLVulnerabilityAssessmentBaselineRulesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "VA1234", - "55555555-6666-7777-8888-999999999999", - "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2020-07-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Delete.json -func ExampleSQLVulnerabilityAssessmentBaselineRulesClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSQLVulnerabilityAssessmentBaselineRulesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "VA1234", - "55555555-6666-7777-8888-999999999999", - "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", - 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/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2020-07-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_List.json -func ExampleSQLVulnerabilityAssessmentBaselineRulesClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSQLVulnerabilityAssessmentBaselineRulesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - "55555555-6666-7777-8888-999999999999", - "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2020-07-01-preview/examples/sqlVulnerabilityAssessmentsBaselineRuleOperations/ArcMachineBaselineRules_Add.json -func ExampleSQLVulnerabilityAssessmentBaselineRulesClient_Add() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSQLVulnerabilityAssessmentBaselineRulesClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Add(ctx, - "55555555-6666-7777-8888-999999999999", - "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", - &armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientAddOptions{Body: &armsecurity.RulesResultsInput{ - LatestScan: to.Ptr(false), - Results: map[string][][]*string{ - "VA1234": { - { - to.Ptr("userA"), - to.Ptr("SELECT")}, - { - to.Ptr("userB"), - to.Ptr("SELECT")}}, - "VA5678": { - { - to.Ptr("Test"), - to.Ptr("0.0.0.0"), - to.Ptr("125.125.125.125")}}, - }, - }, - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_sqlvulnerabilityassessmentscanresults_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_sqlvulnerabilityassessmentscanresults_client_test.go deleted file mode 100644 index c536cf93f287..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_sqlvulnerabilityassessmentscanresults_client_test.go +++ /dev/null @@ -1,64 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2020-07-01-preview/examples/sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_Get.json -func ExampleSQLVulnerabilityAssessmentScanResultsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSQLVulnerabilityAssessmentScanResultsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "Scheduled-20200623", - "VA2063", - "55555555-6666-7777-8888-999999999999", - "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2020-07-01-preview/examples/sqlVulnerabilityAssessmentsScanResultsOperations/ArcMachineScanResults_List.json -func ExampleSQLVulnerabilityAssessmentScanResultsClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSQLVulnerabilityAssessmentScanResultsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - "Scheduled-20200623", - "55555555-6666-7777-8888-999999999999", - "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_sqlvulnerabilityassessmentscans_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_sqlvulnerabilityassessmentscans_client_test.go deleted file mode 100644 index 9bbb3a895541..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_sqlvulnerabilityassessmentscans_client_test.go +++ /dev/null @@ -1,62 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2020-07-01-preview/examples/sqlVulnerabilityAssessmentScanOperations/ArcMachineScans_Get.json -func ExampleSQLVulnerabilityAssessmentScansClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSQLVulnerabilityAssessmentScansClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "Scheduled-20200623", - "55555555-6666-7777-8888-999999999999", - "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2020-07-01-preview/examples/sqlVulnerabilityAssessmentScanOperations/ArcMachineScans_List.json -func ExampleSQLVulnerabilityAssessmentScansClient_List() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSQLVulnerabilityAssessmentScansClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.List(ctx, - "55555555-6666-7777-8888-999999999999", - "subscriptions/00000000-1111-2222-3333-444444444444/resourceGroups/Rg/providers/Microsoft.HybridCompute/machines/MyMachine/sqlServers/server1/databases/master", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_subassessments_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_subassessments_client_test.go deleted file mode 100644 index 35e50ddfab13..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_subassessments_client_test.go +++ /dev/null @@ -1,91 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/SubAssessments/ListSubscriptionSubAssessments_example.json -func ExampleSubAssessmentsClient_NewListAllPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSubAssessmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListAllPager("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/SubAssessments/ListSubAssessments_example.json -func ExampleSubAssessmentsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSubAssessmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager("subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23", - "82e20e14-edc5-4373-bfc4-f13121257c37", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2019-01-01-preview/examples/SubAssessments/GetSubAssessment_example.json -func ExampleSubAssessmentsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewSubAssessmentsClient(cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "subscriptions/212f9889-769e-45ae-ab43-6da33674bd26/resourceGroups/DEMORG/providers/Microsoft.Compute/virtualMachines/vm2", - "1195afff-c881-495e-9bc5-1486211ae03f", - "95f7da9c-a2a4-1322-0758-fcd24ef09b85", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_tasks_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_tasks_client_test.go deleted file mode 100644 index 308655206eaf..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_tasks_client_test.go +++ /dev/null @@ -1,180 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTasksSubscription_example.json -func ExampleTasksClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewTasksClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(&armsecurity.TasksClientListOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTasksSubscriptionLocation_example.json -func ExampleTasksClient_NewListByHomeRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewTasksClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByHomeRegionPager("westeurope", - &armsecurity.TasksClientListByHomeRegionOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTaskSubscriptionLocation_example.json -func ExampleTasksClient_GetSubscriptionLevelTask() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewTasksClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetSubscriptionLevelTask(ctx, - "westeurope", - "62609ee7-d0a5-8616-9fe4-1df5cca7758d", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/UpdateTaskSubscriptionLocation_example.json -func ExampleTasksClient_UpdateSubscriptionLevelTaskState() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewTasksClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.UpdateSubscriptionLevelTaskState(ctx, - "westeurope", - "62609ee7-d0a5-8616-9fe4-1df5cca7758d", - armsecurity.TaskUpdateActionTypeDismiss, - 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/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTasksResourceGroupLocation_example.json -func ExampleTasksClient_NewListByResourceGroupPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewTasksClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByResourceGroupPager("myRg", - "westeurope", - &armsecurity.TasksClientListByResourceGroupOptions{Filter: nil}) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/GetTaskResourceGroupLocation_example.json -func ExampleTasksClient_GetResourceGroupLevelTask() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewTasksClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.GetResourceGroupLevelTask(ctx, - "myRg", - "westeurope", - "d55b4dc0-779c-c66c-33e5-d7bce24c4222", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2015-06-01-preview/examples/Tasks/UpdateTaskResourceGroupLocation_example.json -func ExampleTasksClient_UpdateResourceGroupLevelTaskState() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewTasksClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.UpdateResourceGroupLevelTaskState(ctx, - "myRg", - "westeurope", - "d55b4dc0-779c-c66c-33e5-d7bce24c4222", - armsecurity.TaskUpdateActionTypeDismiss, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_topology_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_topology_client_test.go deleted file mode 100644 index 991974dc1917..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_topology_client_test.go +++ /dev/null @@ -1,89 +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. - -package armsecurity_test - -import ( - "context" - "log" - - "github.com/Azure/azure-sdk-for-go/sdk/azidentity" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/Topology/GetTopologySubscription_example.json -func ExampleTopologyClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewTopologyClient("3eeab341-f466-499c-a8be-85427e154bad", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/Topology/GetTopologySubscriptionLocation_example.json -func ExampleTopologyClient_NewListByHomeRegionPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewTopologyClient("3eeab341-f466-499c-a8be-85427e154bad", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListByHomeRegionPager("centralus", - nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/stable/2020-01-01/examples/Topology/GetTopology_example.json -func ExampleTopologyClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewTopologyClient("3eeab341-f466-499c-a8be-85427e154bad", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "myservers", - "centralus", - "vnets", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} diff --git a/sdk/resourcemanager/security/armsecurity/ze_generated_example_workspacesettings_client_test.go b/sdk/resourcemanager/security/armsecurity/ze_generated_example_workspacesettings_client_test.go deleted file mode 100644 index 96213a849d80..000000000000 --- a/sdk/resourcemanager/security/armsecurity/ze_generated_example_workspacesettings_client_test.go +++ /dev/null @@ -1,141 +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. - -package armsecurity_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/security/armsecurity" -) - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/GetWorkspaceSettings_example.json -func ExampleWorkspaceSettingsClient_NewListPager() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewWorkspaceSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := client.NewListPager(nil) - for pager.More() { - nextResult, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range nextResult.Value { - // TODO: use page item - _ = v - } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/GetWorkspaceSetting_example.json -func ExampleWorkspaceSettingsClient_Get() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewWorkspaceSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Get(ctx, - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/CreateWorkspaceSetting_example.json -func ExampleWorkspaceSettingsClient_Create() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewWorkspaceSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Create(ctx, - "default", - armsecurity.WorkspaceSetting{ - Name: to.Ptr("default"), - Type: to.Ptr("Microsoft.Security/workspaceSettings"), - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/workspaceSettings/default"), - Properties: &armsecurity.WorkspaceSettingProperties{ - Scope: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23"), - WorkspaceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/UpdateWorkspaceSetting_example.json -func ExampleWorkspaceSettingsClient_Update() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewWorkspaceSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := client.Update(ctx, - "default", - armsecurity.WorkspaceSetting{ - Name: to.Ptr("default"), - Type: to.Ptr("Microsoft.Security/workspaceSettings"), - ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/workspaceSettings/default"), - Properties: &armsecurity.WorkspaceSettingProperties{ - WorkspaceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/myRg/providers/Microsoft.OperationalInsights/workspaces/myWorkspace"), - }, - }, - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // TODO: use response item - _ = res -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/tree/main/specification/security/resource-manager/Microsoft.Security/preview/2017-08-01-preview/examples/WorkspaceSettings/DeleteWorkspaceSetting_example.json -func ExampleWorkspaceSettingsClient_Delete() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - client, err := armsecurity.NewWorkspaceSettingsClient("20ff7fc3-e762-44dd-bd96-b71116dcdc23", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = client.Delete(ctx, - "default", - nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_models_serde.go b/sdk/resourcemanager/security/armsecurity/zz_generated_models_serde.go deleted file mode 100644 index a0d561ab221c..000000000000 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_models_serde.go +++ /dev/null @@ -1,4475 +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. - -package armsecurity - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "reflect" -) - -// MarshalJSON implements the json.Marshaller interface for type AADExternalSecuritySolution. -func (a AADExternalSecuritySolution) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "kind", a.Kind) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AADExternalSecuritySolution. -func (a *AADExternalSecuritySolution) 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 "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - 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 "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 AADSolutionProperties. -func (a AADSolutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "connectivityState", a.ConnectivityState) - populate(objectMap, "deviceType", a.DeviceType) - populate(objectMap, "deviceVendor", a.DeviceVendor) - populate(objectMap, "workspace", a.Workspace) - if a.AdditionalProperties != nil { - for key, val := range a.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AADSolutionProperties. -func (a *AADSolutionProperties) 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 "connectivityState": - err = unpopulate(val, "ConnectivityState", &a.ConnectivityState) - delete(rawMsg, key) - case "deviceType": - err = unpopulate(val, "DeviceType", &a.DeviceType) - delete(rawMsg, key) - case "deviceVendor": - err = unpopulate(val, "DeviceVendor", &a.DeviceVendor) - delete(rawMsg, key) - case "workspace": - err = unpopulate(val, "Workspace", &a.Workspace) - delete(rawMsg, key) - default: - if a.AdditionalProperties == nil { - a.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - a.AdditionalProperties[key] = aux - } - 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 ActiveConnectionsNotInAllowedRange. -func (a ActiveConnectionsNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "isEnabled", a.IsEnabled) - populate(objectMap, "maxThreshold", a.MaxThreshold) - populate(objectMap, "minThreshold", a.MinThreshold) - objectMap["ruleType"] = "ActiveConnectionsNotInAllowedRange" - populate(objectMap, "timeWindowSize", a.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ActiveConnectionsNotInAllowedRange. -func (a *ActiveConnectionsNotInAllowedRange) 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 "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &a.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &a.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &a.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &a.TimeWindowSize) - 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 AdaptiveApplicationControlGroupData. -func (a AdaptiveApplicationControlGroupData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "configurationStatus", a.ConfigurationStatus) - populate(objectMap, "enforcementMode", a.EnforcementMode) - populate(objectMap, "issues", a.Issues) - populate(objectMap, "pathRecommendations", a.PathRecommendations) - populate(objectMap, "protectionMode", a.ProtectionMode) - populate(objectMap, "recommendationStatus", a.RecommendationStatus) - populate(objectMap, "sourceSystem", a.SourceSystem) - populate(objectMap, "vmRecommendations", a.VMRecommendations) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AdaptiveNetworkHardeningEnforceRequest. -func (a AdaptiveNetworkHardeningEnforceRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "networkSecurityGroups", a.NetworkSecurityGroups) - populate(objectMap, "rules", a.Rules) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AdaptiveNetworkHardeningProperties. -func (a AdaptiveNetworkHardeningProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "effectiveNetworkSecurityGroups", a.EffectiveNetworkSecurityGroups) - populate(objectMap, "rules", a.Rules) - populateTimeRFC3339(objectMap, "rulesCalculationTime", a.RulesCalculationTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveNetworkHardeningProperties. -func (a *AdaptiveNetworkHardeningProperties) 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 "effectiveNetworkSecurityGroups": - err = unpopulate(val, "EffectiveNetworkSecurityGroups", &a.EffectiveNetworkSecurityGroups) - delete(rawMsg, key) - case "rules": - err = unpopulate(val, "Rules", &a.Rules) - delete(rawMsg, key) - case "rulesCalculationTime": - err = unpopulateTimeRFC3339(val, "RulesCalculationTime", &a.RulesCalculationTime) - 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 AdditionalWorkspacesProperties. -func (a AdditionalWorkspacesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "dataTypes", a.DataTypes) - populate(objectMap, "type", a.Type) - populate(objectMap, "workspace", a.Workspace) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AlertEntity. -func (a AlertEntity) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "type", a.Type) - if a.AdditionalProperties != nil { - for key, val := range a.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertEntity. -func (a *AlertEntity) 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 "type": - err = unpopulate(val, "Type", &a.Type) - delete(rawMsg, key) - default: - if a.AdditionalProperties == nil { - a.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - a.AdditionalProperties[key] = aux - } - 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 AlertProperties. -func (a AlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertDisplayName", a.AlertDisplayName) - populate(objectMap, "alertType", a.AlertType) - populate(objectMap, "alertUri", a.AlertURI) - populate(objectMap, "compromisedEntity", a.CompromisedEntity) - populate(objectMap, "correlationKey", a.CorrelationKey) - populate(objectMap, "description", a.Description) - populateTimeRFC3339(objectMap, "endTimeUtc", a.EndTimeUTC) - populate(objectMap, "entities", a.Entities) - populate(objectMap, "extendedLinks", a.ExtendedLinks) - populate(objectMap, "extendedProperties", a.ExtendedProperties) - populate(objectMap, "intent", a.Intent) - populate(objectMap, "isIncident", a.IsIncident) - populateTimeRFC3339(objectMap, "processingEndTimeUtc", a.ProcessingEndTimeUTC) - populate(objectMap, "productComponentName", a.ProductComponentName) - populate(objectMap, "productName", a.ProductName) - populate(objectMap, "remediationSteps", a.RemediationSteps) - populate(objectMap, "resourceIdentifiers", a.ResourceIdentifiers) - populate(objectMap, "severity", a.Severity) - populateTimeRFC3339(objectMap, "startTimeUtc", a.StartTimeUTC) - populate(objectMap, "status", a.Status) - populate(objectMap, "systemAlertId", a.SystemAlertID) - populateTimeRFC3339(objectMap, "timeGeneratedUtc", a.TimeGeneratedUTC) - populate(objectMap, "vendorName", a.VendorName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertProperties. -func (a *AlertProperties) 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 "alertDisplayName": - err = unpopulate(val, "AlertDisplayName", &a.AlertDisplayName) - delete(rawMsg, key) - case "alertType": - err = unpopulate(val, "AlertType", &a.AlertType) - delete(rawMsg, key) - case "alertUri": - err = unpopulate(val, "AlertURI", &a.AlertURI) - delete(rawMsg, key) - case "compromisedEntity": - err = unpopulate(val, "CompromisedEntity", &a.CompromisedEntity) - delete(rawMsg, key) - case "correlationKey": - err = unpopulate(val, "CorrelationKey", &a.CorrelationKey) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "endTimeUtc": - err = unpopulateTimeRFC3339(val, "EndTimeUTC", &a.EndTimeUTC) - delete(rawMsg, key) - case "entities": - err = unpopulate(val, "Entities", &a.Entities) - delete(rawMsg, key) - case "extendedLinks": - err = unpopulate(val, "ExtendedLinks", &a.ExtendedLinks) - delete(rawMsg, key) - case "extendedProperties": - err = unpopulate(val, "ExtendedProperties", &a.ExtendedProperties) - delete(rawMsg, key) - case "intent": - err = unpopulate(val, "Intent", &a.Intent) - delete(rawMsg, key) - case "isIncident": - err = unpopulate(val, "IsIncident", &a.IsIncident) - delete(rawMsg, key) - case "processingEndTimeUtc": - err = unpopulateTimeRFC3339(val, "ProcessingEndTimeUTC", &a.ProcessingEndTimeUTC) - delete(rawMsg, key) - case "productComponentName": - err = unpopulate(val, "ProductComponentName", &a.ProductComponentName) - delete(rawMsg, key) - case "productName": - err = unpopulate(val, "ProductName", &a.ProductName) - delete(rawMsg, key) - case "remediationSteps": - err = unpopulate(val, "RemediationSteps", &a.RemediationSteps) - delete(rawMsg, key) - case "resourceIdentifiers": - a.ResourceIdentifiers, err = unmarshalResourceIdentifierClassificationArray(val) - delete(rawMsg, key) - case "severity": - err = unpopulate(val, "Severity", &a.Severity) - delete(rawMsg, key) - case "startTimeUtc": - err = unpopulateTimeRFC3339(val, "StartTimeUTC", &a.StartTimeUTC) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &a.Status) - delete(rawMsg, key) - case "systemAlertId": - err = unpopulate(val, "SystemAlertID", &a.SystemAlertID) - delete(rawMsg, key) - case "timeGeneratedUtc": - err = unpopulateTimeRFC3339(val, "TimeGeneratedUTC", &a.TimeGeneratedUTC) - delete(rawMsg, key) - case "vendorName": - err = unpopulate(val, "VendorName", &a.VendorName) - 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 AlertSimulatorBundlesRequestProperties. -func (a AlertSimulatorBundlesRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "bundles", a.Bundles) - objectMap["kind"] = KindBundles - if a.AdditionalProperties != nil { - for key, val := range a.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertSimulatorBundlesRequestProperties. -func (a *AlertSimulatorBundlesRequestProperties) 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 "bundles": - err = unpopulate(val, "Bundles", &a.Bundles) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - default: - if a.AdditionalProperties == nil { - a.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - a.AdditionalProperties[key] = aux - } - 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 AlertSimulatorRequestBody. -func (a AlertSimulatorRequestBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", a.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertSimulatorRequestBody. -func (a *AlertSimulatorRequestBody) 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 "properties": - a.Properties, err = unmarshalAlertSimulatorRequestPropertiesClassification(val) - 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 AlertSimulatorRequestProperties. -func (a AlertSimulatorRequestProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["kind"] = a.Kind - if a.AdditionalProperties != nil { - for key, val := range a.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertSimulatorRequestProperties. -func (a *AlertSimulatorRequestProperties) 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 "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - default: - if a.AdditionalProperties == nil { - a.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - a.AdditionalProperties[key] = aux - } - 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 AlertSyncSettings. -func (a AlertSyncSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - objectMap["kind"] = SettingKindAlertSyncSettings - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertSyncSettings. -func (a *AlertSyncSettings) 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 "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 "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 AlertsSuppressionRuleProperties. -func (a AlertsSuppressionRuleProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "alertType", a.AlertType) - populate(objectMap, "comment", a.Comment) - populateTimeRFC3339(objectMap, "expirationDateUtc", a.ExpirationDateUTC) - populateTimeRFC3339(objectMap, "lastModifiedUtc", a.LastModifiedUTC) - populate(objectMap, "reason", a.Reason) - populate(objectMap, "state", a.State) - populate(objectMap, "suppressionAlertsScope", a.SuppressionAlertsScope) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AlertsSuppressionRuleProperties. -func (a *AlertsSuppressionRuleProperties) 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 "alertType": - err = unpopulate(val, "AlertType", &a.AlertType) - delete(rawMsg, key) - case "comment": - err = unpopulate(val, "Comment", &a.Comment) - delete(rawMsg, key) - case "expirationDateUtc": - err = unpopulateTimeRFC3339(val, "ExpirationDateUTC", &a.ExpirationDateUTC) - delete(rawMsg, key) - case "lastModifiedUtc": - err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &a.LastModifiedUTC) - delete(rawMsg, key) - case "reason": - err = unpopulate(val, "Reason", &a.Reason) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &a.State) - delete(rawMsg, key) - case "suppressionAlertsScope": - err = unpopulate(val, "SuppressionAlertsScope", &a.SuppressionAlertsScope) - 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 AllowedConnectionsResourceProperties. -func (a AllowedConnectionsResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "calculatedDateTime", a.CalculatedDateTime) - populate(objectMap, "connectableResources", a.ConnectableResources) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AllowedConnectionsResourceProperties. -func (a *AllowedConnectionsResourceProperties) 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 "calculatedDateTime": - err = unpopulateTimeRFC3339(val, "CalculatedDateTime", &a.CalculatedDateTime) - delete(rawMsg, key) - case "connectableResources": - err = unpopulate(val, "ConnectableResources", &a.ConnectableResources) - 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 AllowlistCustomAlertRule. -func (a AllowlistCustomAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowlistValues", a.AllowlistValues) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "isEnabled", a.IsEnabled) - objectMap["ruleType"] = "AllowlistCustomAlertRule" - populate(objectMap, "valueType", a.ValueType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AllowlistCustomAlertRule. -func (a *AllowlistCustomAlertRule) 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 "allowlistValues": - err = unpopulate(val, "AllowlistValues", &a.AllowlistValues) - 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 "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &a.RuleType) - delete(rawMsg, key) - case "valueType": - err = unpopulate(val, "ValueType", &a.ValueType) - 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 AmqpC2DMessagesNotInAllowedRange. -func (a AmqpC2DMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "isEnabled", a.IsEnabled) - populate(objectMap, "maxThreshold", a.MaxThreshold) - populate(objectMap, "minThreshold", a.MinThreshold) - objectMap["ruleType"] = "AmqpC2DMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", a.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AmqpC2DMessagesNotInAllowedRange. -func (a *AmqpC2DMessagesNotInAllowedRange) 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 "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &a.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &a.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &a.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &a.TimeWindowSize) - 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 AmqpC2DRejectedMessagesNotInAllowedRange. -func (a AmqpC2DRejectedMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "isEnabled", a.IsEnabled) - populate(objectMap, "maxThreshold", a.MaxThreshold) - populate(objectMap, "minThreshold", a.MinThreshold) - objectMap["ruleType"] = "AmqpC2DRejectedMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", a.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AmqpC2DRejectedMessagesNotInAllowedRange. -func (a *AmqpC2DRejectedMessagesNotInAllowedRange) 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 "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &a.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &a.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &a.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &a.TimeWindowSize) - 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 AmqpD2CMessagesNotInAllowedRange. -func (a AmqpD2CMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "isEnabled", a.IsEnabled) - populate(objectMap, "maxThreshold", a.MaxThreshold) - populate(objectMap, "minThreshold", a.MinThreshold) - objectMap["ruleType"] = "AmqpD2CMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", a.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AmqpD2CMessagesNotInAllowedRange. -func (a *AmqpD2CMessagesNotInAllowedRange) 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 "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &a.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &a.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &a.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &a.TimeWindowSize) - 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 AssessmentMetadataProperties. -func (a AssessmentMetadataProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "assessmentType", a.AssessmentType) - populate(objectMap, "categories", a.Categories) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "implementationEffort", a.ImplementationEffort) - populate(objectMap, "partnerData", a.PartnerData) - populate(objectMap, "policyDefinitionId", a.PolicyDefinitionID) - populate(objectMap, "preview", a.Preview) - populate(objectMap, "remediationDescription", a.RemediationDescription) - populate(objectMap, "severity", a.Severity) - populate(objectMap, "threats", a.Threats) - populate(objectMap, "userImpact", a.UserImpact) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentMetadataPropertiesResponse. -func (a AssessmentMetadataPropertiesResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "assessmentType", a.AssessmentType) - populate(objectMap, "categories", a.Categories) - populate(objectMap, "description", a.Description) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "implementationEffort", a.ImplementationEffort) - populate(objectMap, "partnerData", a.PartnerData) - populate(objectMap, "plannedDeprecationDate", a.PlannedDeprecationDate) - populate(objectMap, "policyDefinitionId", a.PolicyDefinitionID) - populate(objectMap, "preview", a.Preview) - populate(objectMap, "publishDates", a.PublishDates) - populate(objectMap, "remediationDescription", a.RemediationDescription) - populate(objectMap, "severity", a.Severity) - populate(objectMap, "tactics", a.Tactics) - populate(objectMap, "techniques", a.Techniques) - populate(objectMap, "threats", a.Threats) - populate(objectMap, "userImpact", a.UserImpact) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AssessmentProperties. -func (a AssessmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", a.AdditionalData) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "links", a.Links) - populate(objectMap, "metadata", a.Metadata) - populate(objectMap, "partnersData", a.PartnersData) - populate(objectMap, "resourceDetails", a.ResourceDetails) - populate(objectMap, "status", a.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentProperties. -func (a *AssessmentProperties) 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 "additionalData": - err = unpopulate(val, "AdditionalData", &a.AdditionalData) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "links": - err = unpopulate(val, "Links", &a.Links) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &a.Metadata) - delete(rawMsg, key) - case "partnersData": - err = unpopulate(val, "PartnersData", &a.PartnersData) - delete(rawMsg, key) - case "resourceDetails": - a.ResourceDetails, err = unmarshalResourceDetailsClassification(val) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &a.Status) - 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 AssessmentPropertiesBase. -func (a AssessmentPropertiesBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", a.AdditionalData) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "links", a.Links) - populate(objectMap, "metadata", a.Metadata) - populate(objectMap, "partnersData", a.PartnersData) - populate(objectMap, "resourceDetails", a.ResourceDetails) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentPropertiesBase. -func (a *AssessmentPropertiesBase) 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 "additionalData": - err = unpopulate(val, "AdditionalData", &a.AdditionalData) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "links": - err = unpopulate(val, "Links", &a.Links) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &a.Metadata) - delete(rawMsg, key) - case "partnersData": - err = unpopulate(val, "PartnersData", &a.PartnersData) - delete(rawMsg, key) - case "resourceDetails": - a.ResourceDetails, err = unmarshalResourceDetailsClassification(val) - 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 AssessmentPropertiesResponse. -func (a AssessmentPropertiesResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", a.AdditionalData) - populate(objectMap, "displayName", a.DisplayName) - populate(objectMap, "links", a.Links) - populate(objectMap, "metadata", a.Metadata) - populate(objectMap, "partnersData", a.PartnersData) - populate(objectMap, "resourceDetails", a.ResourceDetails) - populate(objectMap, "status", a.Status) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentPropertiesResponse. -func (a *AssessmentPropertiesResponse) 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 "additionalData": - err = unpopulate(val, "AdditionalData", &a.AdditionalData) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) - delete(rawMsg, key) - case "links": - err = unpopulate(val, "Links", &a.Links) - delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &a.Metadata) - delete(rawMsg, key) - case "partnersData": - err = unpopulate(val, "PartnersData", &a.PartnersData) - delete(rawMsg, key) - case "resourceDetails": - a.ResourceDetails, err = unmarshalResourceDetailsClassification(val) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &a.Status) - 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 AssessmentStatusResponse. -func (a AssessmentStatusResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "cause", a.Cause) - populate(objectMap, "code", a.Code) - populate(objectMap, "description", a.Description) - populateTimeRFC3339(objectMap, "firstEvaluationDate", a.FirstEvaluationDate) - populateTimeRFC3339(objectMap, "statusChangeDate", a.StatusChangeDate) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentStatusResponse. -func (a *AssessmentStatusResponse) 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 "cause": - err = unpopulate(val, "Cause", &a.Cause) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &a.Code) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "firstEvaluationDate": - err = unpopulateTimeRFC3339(val, "FirstEvaluationDate", &a.FirstEvaluationDate) - delete(rawMsg, key) - case "statusChangeDate": - err = unpopulateTimeRFC3339(val, "StatusChangeDate", &a.StatusChangeDate) - 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 AtaExternalSecuritySolution. -func (a AtaExternalSecuritySolution) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - populate(objectMap, "kind", a.Kind) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AtaExternalSecuritySolution. -func (a *AtaExternalSecuritySolution) 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 "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &a.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &a.Location) - 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 "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 AtaSolutionProperties. -func (a AtaSolutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "deviceType", a.DeviceType) - populate(objectMap, "deviceVendor", a.DeviceVendor) - populate(objectMap, "lastEventReceived", a.LastEventReceived) - populate(objectMap, "workspace", a.Workspace) - if a.AdditionalProperties != nil { - for key, val := range a.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AtaSolutionProperties. -func (a *AtaSolutionProperties) 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 "deviceType": - err = unpopulate(val, "DeviceType", &a.DeviceType) - delete(rawMsg, key) - case "deviceVendor": - err = unpopulate(val, "DeviceVendor", &a.DeviceVendor) - delete(rawMsg, key) - case "lastEventReceived": - err = unpopulate(val, "LastEventReceived", &a.LastEventReceived) - delete(rawMsg, key) - case "workspace": - err = unpopulate(val, "Workspace", &a.Workspace) - delete(rawMsg, key) - default: - if a.AdditionalProperties == nil { - a.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - a.AdditionalProperties[key] = aux - } - 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 AuthenticationDetailsProperties. -func (a AuthenticationDetailsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "authenticationProvisioningState", a.AuthenticationProvisioningState) - objectMap["authenticationType"] = a.AuthenticationType - populate(objectMap, "grantedPermissions", a.GrantedPermissions) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Automation. -func (a Automation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", a.Etag) - populate(objectMap, "id", a.ID) - populate(objectMap, "kind", a.Kind) - populate(objectMap, "location", a.Location) - populate(objectMap, "name", a.Name) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "tags", a.Tags) - populate(objectMap, "type", a.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationActionEventHub. -func (a AutomationActionEventHub) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["actionType"] = ActionTypeEventHub - populate(objectMap, "connectionString", a.ConnectionString) - populate(objectMap, "eventHubResourceId", a.EventHubResourceID) - populate(objectMap, "sasPolicyName", a.SasPolicyName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationActionEventHub. -func (a *AutomationActionEventHub) 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 "actionType": - err = unpopulate(val, "ActionType", &a.ActionType) - delete(rawMsg, key) - case "connectionString": - err = unpopulate(val, "ConnectionString", &a.ConnectionString) - delete(rawMsg, key) - case "eventHubResourceId": - err = unpopulate(val, "EventHubResourceID", &a.EventHubResourceID) - delete(rawMsg, key) - case "sasPolicyName": - err = unpopulate(val, "SasPolicyName", &a.SasPolicyName) - 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 AutomationActionLogicApp. -func (a AutomationActionLogicApp) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["actionType"] = ActionTypeLogicApp - populate(objectMap, "logicAppResourceId", a.LogicAppResourceID) - populate(objectMap, "uri", a.URI) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationActionLogicApp. -func (a *AutomationActionLogicApp) 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 "actionType": - err = unpopulate(val, "ActionType", &a.ActionType) - delete(rawMsg, key) - case "logicAppResourceId": - err = unpopulate(val, "LogicAppResourceID", &a.LogicAppResourceID) - delete(rawMsg, key) - case "uri": - err = unpopulate(val, "URI", &a.URI) - 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 AutomationActionWorkspace. -func (a AutomationActionWorkspace) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["actionType"] = ActionTypeWorkspace - populate(objectMap, "workspaceResourceId", a.WorkspaceResourceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationActionWorkspace. -func (a *AutomationActionWorkspace) 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 "actionType": - err = unpopulate(val, "ActionType", &a.ActionType) - delete(rawMsg, key) - case "workspaceResourceId": - err = unpopulate(val, "WorkspaceResourceID", &a.WorkspaceResourceID) - 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 AutomationProperties. -func (a AutomationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actions", a.Actions) - populate(objectMap, "description", a.Description) - populate(objectMap, "isEnabled", a.IsEnabled) - populate(objectMap, "scopes", a.Scopes) - populate(objectMap, "sources", a.Sources) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AutomationProperties. -func (a *AutomationProperties) 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 "actions": - a.Actions, err = unmarshalAutomationActionClassificationArray(val) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &a.Description) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &a.IsEnabled) - delete(rawMsg, key) - case "scopes": - err = unpopulate(val, "Scopes", &a.Scopes) - delete(rawMsg, key) - case "sources": - err = unpopulate(val, "Sources", &a.Sources) - 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 AutomationRuleSet. -func (a AutomationRuleSet) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "rules", a.Rules) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AutomationSource. -func (a AutomationSource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "eventSource", a.EventSource) - populate(objectMap, "ruleSets", a.RuleSets) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type AwAssumeRoleAuthenticationDetailsProperties. -func (a AwAssumeRoleAuthenticationDetailsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accountId", a.AccountID) - populate(objectMap, "authenticationProvisioningState", a.AuthenticationProvisioningState) - objectMap["authenticationType"] = AuthenticationTypeAwsAssumeRole - populate(objectMap, "awsAssumeRoleArn", a.AwsAssumeRoleArn) - populate(objectMap, "awsExternalId", a.AwsExternalID) - populate(objectMap, "grantedPermissions", a.GrantedPermissions) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AwAssumeRoleAuthenticationDetailsProperties. -func (a *AwAssumeRoleAuthenticationDetailsProperties) 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 "accountId": - err = unpopulate(val, "AccountID", &a.AccountID) - delete(rawMsg, key) - case "authenticationProvisioningState": - err = unpopulate(val, "AuthenticationProvisioningState", &a.AuthenticationProvisioningState) - delete(rawMsg, key) - case "authenticationType": - err = unpopulate(val, "AuthenticationType", &a.AuthenticationType) - delete(rawMsg, key) - case "awsAssumeRoleArn": - err = unpopulate(val, "AwsAssumeRoleArn", &a.AwsAssumeRoleArn) - delete(rawMsg, key) - case "awsExternalId": - err = unpopulate(val, "AwsExternalID", &a.AwsExternalID) - delete(rawMsg, key) - case "grantedPermissions": - err = unpopulate(val, "GrantedPermissions", &a.GrantedPermissions) - 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 AwsCredsAuthenticationDetailsProperties. -func (a AwsCredsAuthenticationDetailsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "accountId", a.AccountID) - populate(objectMap, "authenticationProvisioningState", a.AuthenticationProvisioningState) - objectMap["authenticationType"] = AuthenticationTypeAwsCreds - populate(objectMap, "awsAccessKeyId", a.AwsAccessKeyID) - populate(objectMap, "awsSecretAccessKey", a.AwsSecretAccessKey) - populate(objectMap, "grantedPermissions", a.GrantedPermissions) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AwsCredsAuthenticationDetailsProperties. -func (a *AwsCredsAuthenticationDetailsProperties) 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 "accountId": - err = unpopulate(val, "AccountID", &a.AccountID) - delete(rawMsg, key) - case "authenticationProvisioningState": - err = unpopulate(val, "AuthenticationProvisioningState", &a.AuthenticationProvisioningState) - delete(rawMsg, key) - case "authenticationType": - err = unpopulate(val, "AuthenticationType", &a.AuthenticationType) - delete(rawMsg, key) - case "awsAccessKeyId": - err = unpopulate(val, "AwsAccessKeyID", &a.AwsAccessKeyID) - delete(rawMsg, key) - case "awsSecretAccessKey": - err = unpopulate(val, "AwsSecretAccessKey", &a.AwsSecretAccessKey) - delete(rawMsg, key) - case "grantedPermissions": - err = unpopulate(val, "GrantedPermissions", &a.GrantedPermissions) - 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 AzureResourceDetails. -func (a AzureResourceDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", a.ID) - objectMap["source"] = SourceAzure - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceDetails. -func (a *AzureResourceDetails) 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 "id": - err = unpopulate(val, "ID", &a.ID) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &a.Source) - 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 AzureResourceIdentifier. -func (a AzureResourceIdentifier) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "azureResourceId", a.AzureResourceID) - objectMap["type"] = ResourceIdentifierTypeAzureResource - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureResourceIdentifier. -func (a *AzureResourceIdentifier) 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 "azureResourceId": - err = unpopulate(val, "AzureResourceID", &a.AzureResourceID) - 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 Baseline. -func (b Baseline) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "expectedResults", b.ExpectedResults) - populateTimeRFC3339(objectMap, "updatedTime", b.UpdatedTime) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Baseline. -func (b *Baseline) 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", b, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "expectedResults": - err = unpopulate(val, "ExpectedResults", &b.ExpectedResults) - delete(rawMsg, key) - case "updatedTime": - err = unpopulateTimeRFC3339(val, "UpdatedTime", &b.UpdatedTime) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", b, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type BaselineAdjustedResult. -func (b BaselineAdjustedResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "baseline", b.Baseline) - populate(objectMap, "resultsNotInBaseline", b.ResultsNotInBaseline) - populate(objectMap, "resultsOnlyInBaseline", b.ResultsOnlyInBaseline) - populate(objectMap, "status", b.Status) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type CefExternalSecuritySolution. -func (c CefExternalSecuritySolution) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", c.ID) - populate(objectMap, "kind", c.Kind) - populate(objectMap, "location", c.Location) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CefExternalSecuritySolution. -func (c *CefExternalSecuritySolution) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, "ID", &c.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &c.Kind) - delete(rawMsg, key) - case "location": - err = unpopulate(val, "Location", &c.Location) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &c.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &c.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CefSolutionProperties. -func (c CefSolutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "agent", c.Agent) - populate(objectMap, "deviceType", c.DeviceType) - populate(objectMap, "deviceVendor", c.DeviceVendor) - populate(objectMap, "hostname", c.Hostname) - populate(objectMap, "lastEventReceived", c.LastEventReceived) - populate(objectMap, "workspace", c.Workspace) - if c.AdditionalProperties != nil { - for key, val := range c.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CefSolutionProperties. -func (c *CefSolutionProperties) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "agent": - err = unpopulate(val, "Agent", &c.Agent) - delete(rawMsg, key) - case "deviceType": - err = unpopulate(val, "DeviceType", &c.DeviceType) - delete(rawMsg, key) - case "deviceVendor": - err = unpopulate(val, "DeviceVendor", &c.DeviceVendor) - delete(rawMsg, key) - case "hostname": - err = unpopulate(val, "Hostname", &c.Hostname) - delete(rawMsg, key) - case "lastEventReceived": - err = unpopulate(val, "LastEventReceived", &c.LastEventReceived) - delete(rawMsg, key) - case "workspace": - err = unpopulate(val, "Workspace", &c.Workspace) - delete(rawMsg, key) - default: - if c.AdditionalProperties == nil { - c.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - c.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ComplianceProperties. -func (c ComplianceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "assessmentResult", c.AssessmentResult) - populateTimeRFC3339(objectMap, "assessmentTimestampUtcDate", c.AssessmentTimestampUTCDate) - populate(objectMap, "resourceCount", c.ResourceCount) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ComplianceProperties. -func (c *ComplianceProperties) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assessmentResult": - err = unpopulate(val, "AssessmentResult", &c.AssessmentResult) - delete(rawMsg, key) - case "assessmentTimestampUtcDate": - err = unpopulateTimeRFC3339(val, "AssessmentTimestampUTCDate", &c.AssessmentTimestampUTCDate) - delete(rawMsg, key) - case "resourceCount": - err = unpopulate(val, "ResourceCount", &c.ResourceCount) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectableResource. -func (c ConnectableResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", c.ID) - populate(objectMap, "inboundConnectedResources", c.InboundConnectedResources) - populate(objectMap, "outboundConnectedResources", c.OutboundConnectedResources) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectionFromIPNotAllowed. -func (c ConnectionFromIPNotAllowed) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowlistValues", c.AllowlistValues) - populate(objectMap, "description", c.Description) - populate(objectMap, "displayName", c.DisplayName) - populate(objectMap, "isEnabled", c.IsEnabled) - objectMap["ruleType"] = "ConnectionFromIpNotAllowed" - populate(objectMap, "valueType", c.ValueType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionFromIPNotAllowed. -func (c *ConnectionFromIPNotAllowed) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allowlistValues": - err = unpopulate(val, "AllowlistValues", &c.AllowlistValues) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &c.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &c.IsEnabled) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &c.RuleType) - delete(rawMsg, key) - case "valueType": - err = unpopulate(val, "ValueType", &c.ValueType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectionToIPNotAllowed. -func (c ConnectionToIPNotAllowed) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowlistValues", c.AllowlistValues) - populate(objectMap, "description", c.Description) - populate(objectMap, "displayName", c.DisplayName) - populate(objectMap, "isEnabled", c.IsEnabled) - objectMap["ruleType"] = "ConnectionToIpNotAllowed" - populate(objectMap, "valueType", c.ValueType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectionToIPNotAllowed. -func (c *ConnectionToIPNotAllowed) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allowlistValues": - err = unpopulate(val, "AllowlistValues", &c.AllowlistValues) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &c.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &c.IsEnabled) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &c.RuleType) - delete(rawMsg, key) - case "valueType": - err = unpopulate(val, "ValueType", &c.ValueType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Connector. -func (c Connector) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", c.Etag) - populate(objectMap, "id", c.ID) - populate(objectMap, "kind", c.Kind) - populate(objectMap, "location", c.Location) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - populate(objectMap, "tags", c.Tags) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectorProperties. -func (c ConnectorProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "cloudName", c.CloudName) - populate(objectMap, "hierarchyIdentifier", c.HierarchyIdentifier) - populate(objectMap, "offerings", c.Offerings) - populate(objectMap, "organizationalData", c.OrganizationalData) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectorProperties. -func (c *ConnectorProperties) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "cloudName": - err = unpopulate(val, "CloudName", &c.CloudName) - delete(rawMsg, key) - case "hierarchyIdentifier": - err = unpopulate(val, "HierarchyIdentifier", &c.HierarchyIdentifier) - delete(rawMsg, key) - case "offerings": - c.Offerings, err = unmarshalCloudOfferingClassificationArray(val) - delete(rawMsg, key) - case "organizationalData": - err = unpopulate(val, "OrganizationalData", &c.OrganizationalData) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectorPropertiesOrganizationalData. -func (c ConnectorPropertiesOrganizationalData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "excludedAccountIds", c.ExcludedAccountIDs) - populate(objectMap, "organizationMembershipType", c.OrganizationMembershipType) - populate(objectMap, "parentHierarchyId", c.ParentHierarchyID) - populate(objectMap, "stacksetName", c.StacksetName) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ConnectorSettingProperties. -func (c ConnectorSettingProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "authenticationDetails", c.AuthenticationDetails) - populate(objectMap, "hybridComputeSettings", c.HybridComputeSettings) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ConnectorSettingProperties. -func (c *ConnectorSettingProperties) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "authenticationDetails": - c.AuthenticationDetails, err = unmarshalAuthenticationDetailsPropertiesClassification(val) - delete(rawMsg, key) - case "hybridComputeSettings": - err = unpopulate(val, "HybridComputeSettings", &c.HybridComputeSettings) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Contact. -func (c Contact) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "type", c.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ContainerRegistryVulnerabilityProperties. -func (c ContainerRegistryVulnerabilityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["assessedResourceType"] = AssessedResourceTypeContainerRegistryVulnerability - populate(objectMap, "cve", c.Cve) - populate(objectMap, "cvss", c.Cvss) - populate(objectMap, "imageDigest", c.ImageDigest) - populate(objectMap, "patchable", c.Patchable) - populateTimeRFC3339(objectMap, "publishedTime", c.PublishedTime) - populate(objectMap, "repositoryName", c.RepositoryName) - populate(objectMap, "type", c.Type) - populate(objectMap, "vendorReferences", c.VendorReferences) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ContainerRegistryVulnerabilityProperties. -func (c *ContainerRegistryVulnerabilityProperties) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "assessedResourceType": - err = unpopulate(val, "AssessedResourceType", &c.AssessedResourceType) - delete(rawMsg, key) - case "cve": - err = unpopulate(val, "Cve", &c.Cve) - delete(rawMsg, key) - case "cvss": - err = unpopulate(val, "Cvss", &c.Cvss) - delete(rawMsg, key) - case "imageDigest": - err = unpopulate(val, "ImageDigest", &c.ImageDigest) - delete(rawMsg, key) - case "patchable": - err = unpopulate(val, "Patchable", &c.Patchable) - delete(rawMsg, key) - case "publishedTime": - err = unpopulateTimeRFC3339(val, "PublishedTime", &c.PublishedTime) - delete(rawMsg, key) - case "repositoryName": - err = unpopulate(val, "RepositoryName", &c.RepositoryName) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) - delete(rawMsg, key) - case "vendorReferences": - err = unpopulate(val, "VendorReferences", &c.VendorReferences) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type CspmMonitorAwsOffering. -func (c CspmMonitorAwsOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", c.Description) - populate(objectMap, "nativeCloudConnection", c.NativeCloudConnection) - objectMap["offeringType"] = OfferingTypeCspmMonitorAws - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorAwsOffering. -func (c *CspmMonitorAwsOffering) 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", c, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &c.Description) - delete(rawMsg, key) - case "nativeCloudConnection": - err = unpopulate(val, "NativeCloudConnection", &c.NativeCloudConnection) - delete(rawMsg, key) - case "offeringType": - err = unpopulate(val, "OfferingType", &c.OfferingType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type DataExportSettings. -func (d DataExportSettings) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", d.ID) - objectMap["kind"] = SettingKindDataExportSettings - populate(objectMap, "name", d.Name) - populate(objectMap, "properties", d.Properties) - populate(objectMap, "type", d.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataExportSettings. -func (d *DataExportSettings) 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 "id": - err = unpopulate(val, "ID", &d.ID) - delete(rawMsg, key) - case "kind": - err = unpopulate(val, "Kind", &d.Kind) - delete(rawMsg, key) - case "name": - err = unpopulate(val, "Name", &d.Name) - delete(rawMsg, key) - case "properties": - err = unpopulate(val, "Properties", &d.Properties) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &d.Type) - 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 DefenderForContainersAwsOffering. -func (d DefenderForContainersAwsOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "cloudWatchToKinesis", d.CloudWatchToKinesis) - populate(objectMap, "description", d.Description) - populate(objectMap, "kinesisToS3", d.KinesisToS3) - populate(objectMap, "kubernetesScubaReader", d.KubernetesScubaReader) - populate(objectMap, "kubernetesService", d.KubernetesService) - objectMap["offeringType"] = OfferingTypeDefenderForContainersAws - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersAwsOffering. -func (d *DefenderForContainersAwsOffering) 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 "cloudWatchToKinesis": - err = unpopulate(val, "CloudWatchToKinesis", &d.CloudWatchToKinesis) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "kinesisToS3": - err = unpopulate(val, "KinesisToS3", &d.KinesisToS3) - delete(rawMsg, key) - case "kubernetesScubaReader": - err = unpopulate(val, "KubernetesScubaReader", &d.KubernetesScubaReader) - delete(rawMsg, key) - case "kubernetesService": - err = unpopulate(val, "KubernetesService", &d.KubernetesService) - delete(rawMsg, key) - case "offeringType": - err = unpopulate(val, "OfferingType", &d.OfferingType) - 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 DefenderForServersAwsOffering. -func (d DefenderForServersAwsOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "arcAutoProvisioning", d.ArcAutoProvisioning) - populate(objectMap, "defenderForServers", d.DefenderForServers) - populate(objectMap, "description", d.Description) - objectMap["offeringType"] = OfferingTypeDefenderForServersAws - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOffering. -func (d *DefenderForServersAwsOffering) 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 "arcAutoProvisioning": - err = unpopulate(val, "ArcAutoProvisioning", &d.ArcAutoProvisioning) - delete(rawMsg, key) - case "defenderForServers": - err = unpopulate(val, "DefenderForServers", &d.DefenderForServers) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "offeringType": - err = unpopulate(val, "OfferingType", &d.OfferingType) - 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 DenylistCustomAlertRule. -func (d DenylistCustomAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "denylistValues", d.DenylistValues) - populate(objectMap, "description", d.Description) - populate(objectMap, "displayName", d.DisplayName) - populate(objectMap, "isEnabled", d.IsEnabled) - objectMap["ruleType"] = "DenylistCustomAlertRule" - populate(objectMap, "valueType", d.ValueType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DenylistCustomAlertRule. -func (d *DenylistCustomAlertRule) 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 "denylistValues": - err = unpopulate(val, "DenylistValues", &d.DenylistValues) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &d.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &d.IsEnabled) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &d.RuleType) - delete(rawMsg, key) - case "valueType": - err = unpopulate(val, "ValueType", &d.ValueType) - 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 DeviceSecurityGroupProperties. -func (d DeviceSecurityGroupProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowlistRules", d.AllowlistRules) - populate(objectMap, "denylistRules", d.DenylistRules) - populate(objectMap, "thresholdRules", d.ThresholdRules) - populate(objectMap, "timeWindowRules", d.TimeWindowRules) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DeviceSecurityGroupProperties. -func (d *DeviceSecurityGroupProperties) 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 "allowlistRules": - d.AllowlistRules, err = unmarshalAllowlistCustomAlertRuleClassificationArray(val) - delete(rawMsg, key) - case "denylistRules": - err = unpopulate(val, "DenylistRules", &d.DenylistRules) - delete(rawMsg, key) - case "thresholdRules": - d.ThresholdRules, err = unmarshalThresholdCustomAlertRuleClassificationArray(val) - delete(rawMsg, key) - case "timeWindowRules": - d.TimeWindowRules, err = unmarshalTimeWindowCustomAlertRuleClassificationArray(val) - 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 DirectMethodInvokesNotInAllowedRange. -func (d DirectMethodInvokesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", d.Description) - populate(objectMap, "displayName", d.DisplayName) - populate(objectMap, "isEnabled", d.IsEnabled) - populate(objectMap, "maxThreshold", d.MaxThreshold) - populate(objectMap, "minThreshold", d.MinThreshold) - objectMap["ruleType"] = "DirectMethodInvokesNotInAllowedRange" - populate(objectMap, "timeWindowSize", d.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DirectMethodInvokesNotInAllowedRange. -func (d *DirectMethodInvokesNotInAllowedRange) 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 "description": - err = unpopulate(val, "Description", &d.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &d.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &d.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &d.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &d.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &d.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &d.TimeWindowSize) - 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 EffectiveNetworkSecurityGroups. -func (e EffectiveNetworkSecurityGroups) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "networkInterface", e.NetworkInterface) - populate(objectMap, "networkSecurityGroups", e.NetworkSecurityGroups) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ExternalSecuritySolutionProperties. -func (e ExternalSecuritySolutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "deviceType", e.DeviceType) - populate(objectMap, "deviceVendor", e.DeviceVendor) - populate(objectMap, "workspace", e.Workspace) - if e.AdditionalProperties != nil { - for key, val := range e.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ExternalSecuritySolutionProperties. -func (e *ExternalSecuritySolutionProperties) 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", e, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "deviceType": - err = unpopulate(val, "DeviceType", &e.DeviceType) - delete(rawMsg, key) - case "deviceVendor": - err = unpopulate(val, "DeviceVendor", &e.DeviceVendor) - delete(rawMsg, key) - case "workspace": - err = unpopulate(val, "Workspace", &e.Workspace) - delete(rawMsg, key) - default: - if e.AdditionalProperties == nil { - e.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - e.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FailedLocalLoginsNotInAllowedRange. -func (f FailedLocalLoginsNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", f.Description) - populate(objectMap, "displayName", f.DisplayName) - populate(objectMap, "isEnabled", f.IsEnabled) - populate(objectMap, "maxThreshold", f.MaxThreshold) - populate(objectMap, "minThreshold", f.MinThreshold) - objectMap["ruleType"] = "FailedLocalLoginsNotInAllowedRange" - populate(objectMap, "timeWindowSize", f.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FailedLocalLoginsNotInAllowedRange. -func (f *FailedLocalLoginsNotInAllowedRange) 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", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &f.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &f.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &f.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &f.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &f.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &f.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &f.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type FileUploadsNotInAllowedRange. -func (f FileUploadsNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", f.Description) - populate(objectMap, "displayName", f.DisplayName) - populate(objectMap, "isEnabled", f.IsEnabled) - populate(objectMap, "maxThreshold", f.MaxThreshold) - populate(objectMap, "minThreshold", f.MinThreshold) - objectMap["ruleType"] = "FileUploadsNotInAllowedRange" - populate(objectMap, "timeWindowSize", f.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type FileUploadsNotInAllowedRange. -func (f *FileUploadsNotInAllowedRange) 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", f, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &f.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &f.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &f.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &f.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &f.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &f.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &f.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", f, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type GcpCredentialsDetailsProperties. -func (g GcpCredentialsDetailsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "authProviderX509CertUrl", g.AuthProviderX509CertURL) - populate(objectMap, "authUri", g.AuthURI) - populate(objectMap, "authenticationProvisioningState", g.AuthenticationProvisioningState) - objectMap["authenticationType"] = AuthenticationTypeGcpCredentials - populate(objectMap, "clientEmail", g.ClientEmail) - populate(objectMap, "clientId", g.ClientID) - populate(objectMap, "clientX509CertUrl", g.ClientX509CertURL) - populate(objectMap, "grantedPermissions", g.GrantedPermissions) - populate(objectMap, "organizationId", g.OrganizationID) - populate(objectMap, "privateKey", g.PrivateKey) - populate(objectMap, "privateKeyId", g.PrivateKeyID) - populate(objectMap, "projectId", g.ProjectID) - populate(objectMap, "tokenUri", g.TokenURI) - populate(objectMap, "type", g.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GcpCredentialsDetailsProperties. -func (g *GcpCredentialsDetailsProperties) 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 "authProviderX509CertUrl": - err = unpopulate(val, "AuthProviderX509CertURL", &g.AuthProviderX509CertURL) - delete(rawMsg, key) - case "authUri": - err = unpopulate(val, "AuthURI", &g.AuthURI) - delete(rawMsg, key) - case "authenticationProvisioningState": - err = unpopulate(val, "AuthenticationProvisioningState", &g.AuthenticationProvisioningState) - delete(rawMsg, key) - case "authenticationType": - err = unpopulate(val, "AuthenticationType", &g.AuthenticationType) - delete(rawMsg, key) - case "clientEmail": - err = unpopulate(val, "ClientEmail", &g.ClientEmail) - delete(rawMsg, key) - case "clientId": - err = unpopulate(val, "ClientID", &g.ClientID) - delete(rawMsg, key) - case "clientX509CertUrl": - err = unpopulate(val, "ClientX509CertURL", &g.ClientX509CertURL) - delete(rawMsg, key) - case "grantedPermissions": - err = unpopulate(val, "GrantedPermissions", &g.GrantedPermissions) - delete(rawMsg, key) - case "organizationId": - err = unpopulate(val, "OrganizationID", &g.OrganizationID) - delete(rawMsg, key) - case "privateKey": - err = unpopulate(val, "PrivateKey", &g.PrivateKey) - delete(rawMsg, key) - case "privateKeyId": - err = unpopulate(val, "PrivateKeyID", &g.PrivateKeyID) - delete(rawMsg, key) - case "projectId": - err = unpopulate(val, "ProjectID", &g.ProjectID) - delete(rawMsg, key) - case "tokenUri": - err = unpopulate(val, "TokenURI", &g.TokenURI) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &g.Type) - 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 HTTPC2DMessagesNotInAllowedRange. -func (h HTTPC2DMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", h.Description) - populate(objectMap, "displayName", h.DisplayName) - populate(objectMap, "isEnabled", h.IsEnabled) - populate(objectMap, "maxThreshold", h.MaxThreshold) - populate(objectMap, "minThreshold", h.MinThreshold) - objectMap["ruleType"] = "HttpC2DMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", h.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPC2DMessagesNotInAllowedRange. -func (h *HTTPC2DMessagesNotInAllowedRange) 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", h, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &h.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &h.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &h.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &h.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &h.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &h.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &h.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type HTTPC2DRejectedMessagesNotInAllowedRange. -func (h HTTPC2DRejectedMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", h.Description) - populate(objectMap, "displayName", h.DisplayName) - populate(objectMap, "isEnabled", h.IsEnabled) - populate(objectMap, "maxThreshold", h.MaxThreshold) - populate(objectMap, "minThreshold", h.MinThreshold) - objectMap["ruleType"] = "HttpC2DRejectedMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", h.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPC2DRejectedMessagesNotInAllowedRange. -func (h *HTTPC2DRejectedMessagesNotInAllowedRange) 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", h, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &h.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &h.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &h.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &h.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &h.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &h.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &h.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type HTTPD2CMessagesNotInAllowedRange. -func (h HTTPD2CMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", h.Description) - populate(objectMap, "displayName", h.DisplayName) - populate(objectMap, "isEnabled", h.IsEnabled) - populate(objectMap, "maxThreshold", h.MaxThreshold) - populate(objectMap, "minThreshold", h.MinThreshold) - objectMap["ruleType"] = "HttpD2CMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", h.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type HTTPD2CMessagesNotInAllowedRange. -func (h *HTTPD2CMessagesNotInAllowedRange) 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", h, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &h.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &h.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &h.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &h.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &h.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &h.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &h.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", h, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type InformationProtectionAwsOffering. -func (i InformationProtectionAwsOffering) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", i.Description) - populate(objectMap, "informationProtection", i.InformationProtection) - objectMap["offeringType"] = OfferingTypeInformationProtectionAws - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InformationProtectionAwsOffering. -func (i *InformationProtectionAwsOffering) 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 "description": - err = unpopulate(val, "Description", &i.Description) - delete(rawMsg, key) - case "informationProtection": - err = unpopulate(val, "InformationProtection", &i.InformationProtection) - delete(rawMsg, key) - case "offeringType": - err = unpopulate(val, "OfferingType", &i.OfferingType) - 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 InformationProtectionPolicyProperties. -func (i InformationProtectionPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "informationTypes", i.InformationTypes) - populate(objectMap, "labels", i.Labels) - populateTimeRFC3339(objectMap, "lastModifiedUtc", i.LastModifiedUTC) - populate(objectMap, "version", i.Version) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type InformationProtectionPolicyProperties. -func (i *InformationProtectionPolicyProperties) 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 "informationTypes": - err = unpopulate(val, "InformationTypes", &i.InformationTypes) - delete(rawMsg, key) - case "labels": - err = unpopulate(val, "Labels", &i.Labels) - delete(rawMsg, key) - case "lastModifiedUtc": - err = unpopulateTimeRFC3339(val, "LastModifiedUTC", &i.LastModifiedUTC) - delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &i.Version) - 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 InformationType. -func (i InformationType) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "custom", i.Custom) - populate(objectMap, "description", i.Description) - populate(objectMap, "displayName", i.DisplayName) - populate(objectMap, "enabled", i.Enabled) - populate(objectMap, "keywords", i.Keywords) - populate(objectMap, "order", i.Order) - populate(objectMap, "recommendedLabelId", i.RecommendedLabelID) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecurityAggregatedAlert. -func (i IoTSecurityAggregatedAlert) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", i.ID) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "tags", i.Tags) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecurityAggregatedAlertProperties. -func (i IoTSecurityAggregatedAlertProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "actionTaken", i.ActionTaken) - populateDateType(objectMap, "aggregatedDateUtc", i.AggregatedDateUTC) - populate(objectMap, "alertDisplayName", i.AlertDisplayName) - populate(objectMap, "alertType", i.AlertType) - populate(objectMap, "count", i.Count) - populate(objectMap, "description", i.Description) - populate(objectMap, "effectedResourceType", i.EffectedResourceType) - populate(objectMap, "logAnalyticsQuery", i.LogAnalyticsQuery) - populate(objectMap, "remediationSteps", i.RemediationSteps) - populate(objectMap, "reportedSeverity", i.ReportedSeverity) - populate(objectMap, "systemSource", i.SystemSource) - populate(objectMap, "topDevicesList", i.TopDevicesList) - populate(objectMap, "vendorName", i.VendorName) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecurityAggregatedAlertProperties. -func (i *IoTSecurityAggregatedAlertProperties) 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 "actionTaken": - err = unpopulate(val, "ActionTaken", &i.ActionTaken) - delete(rawMsg, key) - case "aggregatedDateUtc": - err = unpopulateDateType(val, "AggregatedDateUTC", &i.AggregatedDateUTC) - delete(rawMsg, key) - case "alertDisplayName": - err = unpopulate(val, "AlertDisplayName", &i.AlertDisplayName) - delete(rawMsg, key) - case "alertType": - err = unpopulate(val, "AlertType", &i.AlertType) - delete(rawMsg, key) - case "count": - err = unpopulate(val, "Count", &i.Count) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &i.Description) - delete(rawMsg, key) - case "effectedResourceType": - err = unpopulate(val, "EffectedResourceType", &i.EffectedResourceType) - delete(rawMsg, key) - case "logAnalyticsQuery": - err = unpopulate(val, "LogAnalyticsQuery", &i.LogAnalyticsQuery) - delete(rawMsg, key) - case "remediationSteps": - err = unpopulate(val, "RemediationSteps", &i.RemediationSteps) - delete(rawMsg, key) - case "reportedSeverity": - err = unpopulate(val, "ReportedSeverity", &i.ReportedSeverity) - delete(rawMsg, key) - case "systemSource": - err = unpopulate(val, "SystemSource", &i.SystemSource) - delete(rawMsg, key) - case "topDevicesList": - err = unpopulate(val, "TopDevicesList", &i.TopDevicesList) - delete(rawMsg, key) - case "vendorName": - err = unpopulate(val, "VendorName", &i.VendorName) - 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 IoTSecurityAggregatedRecommendation. -func (i IoTSecurityAggregatedRecommendation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", i.ID) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "tags", i.Tags) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecuritySolutionAnalyticsModelProperties. -func (i IoTSecuritySolutionAnalyticsModelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "devicesMetrics", i.DevicesMetrics) - populate(objectMap, "metrics", i.Metrics) - populate(objectMap, "mostPrevalentDeviceAlerts", i.MostPrevalentDeviceAlerts) - populate(objectMap, "mostPrevalentDeviceRecommendations", i.MostPrevalentDeviceRecommendations) - populate(objectMap, "topAlertedDevices", i.TopAlertedDevices) - populate(objectMap, "unhealthyDeviceCount", i.UnhealthyDeviceCount) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem. -func (i IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "date", i.Date) - populate(objectMap, "devicesMetrics", i.DevicesMetrics) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem. -func (i *IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem) 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 "date": - err = unpopulateTimeRFC3339(val, "Date", &i.Date) - delete(rawMsg, key) - case "devicesMetrics": - err = unpopulate(val, "DevicesMetrics", &i.DevicesMetrics) - 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 IoTSecuritySolutionModel. -func (i IoTSecuritySolutionModel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", i.ID) - populate(objectMap, "location", i.Location) - populate(objectMap, "name", i.Name) - populate(objectMap, "properties", i.Properties) - populate(objectMap, "systemData", i.SystemData) - populate(objectMap, "tags", i.Tags) - populate(objectMap, "type", i.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type IoTSecuritySolutionProperties. -func (i IoTSecuritySolutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalWorkspaces", i.AdditionalWorkspaces) - populate(objectMap, "autoDiscoveredResources", i.AutoDiscoveredResources) - populate(objectMap, "disabledDataSources", i.DisabledDataSources) - populate(objectMap, "displayName", i.DisplayName) - populate(objectMap, "export", i.Export) - populate(objectMap, "iotHubs", i.IotHubs) - populate(objectMap, "recommendationsConfiguration", i.RecommendationsConfiguration) - populate(objectMap, "status", i.Status) - populate(objectMap, "unmaskedIpLoggingStatus", i.UnmaskedIPLoggingStatus) - populate(objectMap, "userDefinedResources", i.UserDefinedResources) - populate(objectMap, "workspace", i.Workspace) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicyInitiatePort. -func (j JitNetworkAccessPolicyInitiatePort) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowedSourceAddressPrefix", j.AllowedSourceAddressPrefix) - populateTimeRFC3339(objectMap, "endTimeUtc", j.EndTimeUTC) - populate(objectMap, "number", j.Number) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessPolicyInitiatePort. -func (j *JitNetworkAccessPolicyInitiatePort) 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", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allowedSourceAddressPrefix": - err = unpopulate(val, "AllowedSourceAddressPrefix", &j.AllowedSourceAddressPrefix) - delete(rawMsg, key) - case "endTimeUtc": - err = unpopulateTimeRFC3339(val, "EndTimeUTC", &j.EndTimeUTC) - delete(rawMsg, key) - case "number": - err = unpopulate(val, "Number", &j.Number) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicyInitiateRequest. -func (j JitNetworkAccessPolicyInitiateRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "justification", j.Justification) - populate(objectMap, "virtualMachines", j.VirtualMachines) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicyInitiateVirtualMachine. -func (j JitNetworkAccessPolicyInitiateVirtualMachine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", j.ID) - populate(objectMap, "ports", j.Ports) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicyProperties. -func (j JitNetworkAccessPolicyProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "provisioningState", j.ProvisioningState) - populate(objectMap, "requests", j.Requests) - populate(objectMap, "virtualMachines", j.VirtualMachines) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPolicyVirtualMachine. -func (j JitNetworkAccessPolicyVirtualMachine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", j.ID) - populate(objectMap, "ports", j.Ports) - populate(objectMap, "publicIpAddress", j.PublicIPAddress) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPortRule. -func (j JitNetworkAccessPortRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowedSourceAddressPrefix", j.AllowedSourceAddressPrefix) - populate(objectMap, "allowedSourceAddressPrefixes", j.AllowedSourceAddressPrefixes) - populate(objectMap, "maxRequestAccessDuration", j.MaxRequestAccessDuration) - populate(objectMap, "number", j.Number) - populate(objectMap, "protocol", j.Protocol) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessRequest. -func (j JitNetworkAccessRequest) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "justification", j.Justification) - populate(objectMap, "requestor", j.Requestor) - populateTimeRFC3339(objectMap, "startTimeUtc", j.StartTimeUTC) - populate(objectMap, "virtualMachines", j.VirtualMachines) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessRequest. -func (j *JitNetworkAccessRequest) 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", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "justification": - err = unpopulate(val, "Justification", &j.Justification) - delete(rawMsg, key) - case "requestor": - err = unpopulate(val, "Requestor", &j.Requestor) - delete(rawMsg, key) - case "startTimeUtc": - err = unpopulateTimeRFC3339(val, "StartTimeUTC", &j.StartTimeUTC) - delete(rawMsg, key) - case "virtualMachines": - err = unpopulate(val, "VirtualMachines", &j.VirtualMachines) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessRequestPort. -func (j JitNetworkAccessRequestPort) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowedSourceAddressPrefix", j.AllowedSourceAddressPrefix) - populate(objectMap, "allowedSourceAddressPrefixes", j.AllowedSourceAddressPrefixes) - populateTimeRFC3339(objectMap, "endTimeUtc", j.EndTimeUTC) - populate(objectMap, "mappedPort", j.MappedPort) - populate(objectMap, "number", j.Number) - populate(objectMap, "status", j.Status) - populate(objectMap, "statusReason", j.StatusReason) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type JitNetworkAccessRequestPort. -func (j *JitNetworkAccessRequestPort) 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", j, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allowedSourceAddressPrefix": - err = unpopulate(val, "AllowedSourceAddressPrefix", &j.AllowedSourceAddressPrefix) - delete(rawMsg, key) - case "allowedSourceAddressPrefixes": - err = unpopulate(val, "AllowedSourceAddressPrefixes", &j.AllowedSourceAddressPrefixes) - delete(rawMsg, key) - case "endTimeUtc": - err = unpopulateTimeRFC3339(val, "EndTimeUTC", &j.EndTimeUTC) - delete(rawMsg, key) - case "mappedPort": - err = unpopulate(val, "MappedPort", &j.MappedPort) - delete(rawMsg, key) - case "number": - err = unpopulate(val, "Number", &j.Number) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &j.Status) - delete(rawMsg, key) - case "statusReason": - err = unpopulate(val, "StatusReason", &j.StatusReason) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", j, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessRequestVirtualMachine. -func (j JitNetworkAccessRequestVirtualMachine) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", j.ID) - populate(objectMap, "ports", j.Ports) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ListCustomAlertRule. -func (l ListCustomAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", l.Description) - populate(objectMap, "displayName", l.DisplayName) - populate(objectMap, "isEnabled", l.IsEnabled) - objectMap["ruleType"] = "ListCustomAlertRule" - populate(objectMap, "valueType", l.ValueType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ListCustomAlertRule. -func (l *ListCustomAlertRule) 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", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &l.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &l.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &l.IsEnabled) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &l.RuleType) - delete(rawMsg, key) - case "valueType": - err = unpopulate(val, "ValueType", &l.ValueType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LocalUserNotAllowed. -func (l LocalUserNotAllowed) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowlistValues", l.AllowlistValues) - populate(objectMap, "description", l.Description) - populate(objectMap, "displayName", l.DisplayName) - populate(objectMap, "isEnabled", l.IsEnabled) - objectMap["ruleType"] = "LocalUserNotAllowed" - populate(objectMap, "valueType", l.ValueType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LocalUserNotAllowed. -func (l *LocalUserNotAllowed) 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", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "allowlistValues": - err = unpopulate(val, "AllowlistValues", &l.AllowlistValues) - delete(rawMsg, key) - case "description": - err = unpopulate(val, "Description", &l.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &l.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &l.IsEnabled) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &l.RuleType) - delete(rawMsg, key) - case "valueType": - err = unpopulate(val, "ValueType", &l.ValueType) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type LogAnalyticsIdentifier. -func (l LogAnalyticsIdentifier) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "agentId", l.AgentID) - objectMap["type"] = ResourceIdentifierTypeLogAnalytics - populate(objectMap, "workspaceId", l.WorkspaceID) - populate(objectMap, "workspaceResourceGroup", l.WorkspaceResourceGroup) - populate(objectMap, "workspaceSubscriptionId", l.WorkspaceSubscriptionID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type LogAnalyticsIdentifier. -func (l *LogAnalyticsIdentifier) 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", l, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "agentId": - err = unpopulate(val, "AgentID", &l.AgentID) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &l.Type) - delete(rawMsg, key) - case "workspaceId": - err = unpopulate(val, "WorkspaceID", &l.WorkspaceID) - delete(rawMsg, key) - case "workspaceResourceGroup": - err = unpopulate(val, "WorkspaceResourceGroup", &l.WorkspaceResourceGroup) - delete(rawMsg, key) - case "workspaceSubscriptionId": - err = unpopulate(val, "WorkspaceSubscriptionID", &l.WorkspaceSubscriptionID) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", l, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type MdeOnboardingDataProperties. -func (m MdeOnboardingDataProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateByteArray(objectMap, "onboardingPackageLinux", m.OnboardingPackageLinux, runtime.Base64StdFormat) - populateByteArray(objectMap, "onboardingPackageWindows", m.OnboardingPackageWindows, runtime.Base64StdFormat) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MdeOnboardingDataProperties. -func (m *MdeOnboardingDataProperties) 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 "onboardingPackageLinux": - err = runtime.DecodeByteArray(string(val), &m.OnboardingPackageLinux, runtime.Base64StdFormat) - delete(rawMsg, key) - case "onboardingPackageWindows": - err = runtime.DecodeByteArray(string(val), &m.OnboardingPackageWindows, runtime.Base64StdFormat) - 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 MqttC2DMessagesNotInAllowedRange. -func (m MqttC2DMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", m.Description) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "isEnabled", m.IsEnabled) - populate(objectMap, "maxThreshold", m.MaxThreshold) - populate(objectMap, "minThreshold", m.MinThreshold) - objectMap["ruleType"] = "MqttC2DMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", m.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MqttC2DMessagesNotInAllowedRange. -func (m *MqttC2DMessagesNotInAllowedRange) 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 "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &m.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &m.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &m.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &m.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &m.TimeWindowSize) - 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 MqttC2DRejectedMessagesNotInAllowedRange. -func (m MqttC2DRejectedMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", m.Description) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "isEnabled", m.IsEnabled) - populate(objectMap, "maxThreshold", m.MaxThreshold) - populate(objectMap, "minThreshold", m.MinThreshold) - objectMap["ruleType"] = "MqttC2DRejectedMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", m.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MqttC2DRejectedMessagesNotInAllowedRange. -func (m *MqttC2DRejectedMessagesNotInAllowedRange) 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 "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &m.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &m.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &m.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &m.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &m.TimeWindowSize) - 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 MqttD2CMessagesNotInAllowedRange. -func (m MqttD2CMessagesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", m.Description) - populate(objectMap, "displayName", m.DisplayName) - populate(objectMap, "isEnabled", m.IsEnabled) - populate(objectMap, "maxThreshold", m.MaxThreshold) - populate(objectMap, "minThreshold", m.MinThreshold) - objectMap["ruleType"] = "MqttD2CMessagesNotInAllowedRange" - populate(objectMap, "timeWindowSize", m.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type MqttD2CMessagesNotInAllowedRange. -func (m *MqttD2CMessagesNotInAllowedRange) 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 "description": - err = unpopulate(val, "Description", &m.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &m.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &m.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &m.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &m.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &m.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &m.TimeWindowSize) - 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 OnPremiseResourceDetails. -func (o OnPremiseResourceDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "machineName", o.MachineName) - objectMap["source"] = SourceOnPremise - populate(objectMap, "sourceComputerId", o.SourceComputerID) - populate(objectMap, "vmuuid", o.Vmuuid) - populate(objectMap, "workspaceId", o.WorkspaceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OnPremiseResourceDetails. -func (o *OnPremiseResourceDetails) 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 "machineName": - err = unpopulate(val, "MachineName", &o.MachineName) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &o.Source) - delete(rawMsg, key) - case "sourceComputerId": - err = unpopulate(val, "SourceComputerID", &o.SourceComputerID) - delete(rawMsg, key) - case "vmuuid": - err = unpopulate(val, "Vmuuid", &o.Vmuuid) - delete(rawMsg, key) - case "workspaceId": - err = unpopulate(val, "WorkspaceID", &o.WorkspaceID) - 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 OnPremiseSQLResourceDetails. -func (o OnPremiseSQLResourceDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "databaseName", o.DatabaseName) - populate(objectMap, "machineName", o.MachineName) - populate(objectMap, "serverName", o.ServerName) - objectMap["source"] = SourceOnPremiseSQL - populate(objectMap, "sourceComputerId", o.SourceComputerID) - populate(objectMap, "vmuuid", o.Vmuuid) - populate(objectMap, "workspaceId", o.WorkspaceID) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OnPremiseSQLResourceDetails. -func (o *OnPremiseSQLResourceDetails) 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 "databaseName": - err = unpopulate(val, "DatabaseName", &o.DatabaseName) - delete(rawMsg, key) - case "machineName": - err = unpopulate(val, "MachineName", &o.MachineName) - delete(rawMsg, key) - case "serverName": - err = unpopulate(val, "ServerName", &o.ServerName) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &o.Source) - delete(rawMsg, key) - case "sourceComputerId": - err = unpopulate(val, "SourceComputerID", &o.SourceComputerID) - delete(rawMsg, key) - case "vmuuid": - err = unpopulate(val, "Vmuuid", &o.Vmuuid) - delete(rawMsg, key) - case "workspaceId": - err = unpopulate(val, "WorkspaceID", &o.WorkspaceID) - 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 PathRecommendation. -func (p PathRecommendation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "action", p.Action) - populate(objectMap, "common", p.Common) - populate(objectMap, "configurationStatus", p.ConfigurationStatus) - populate(objectMap, "fileType", p.FileType) - populate(objectMap, "path", p.Path) - populate(objectMap, "publisherInfo", p.PublisherInfo) - populate(objectMap, "type", p.Type) - populate(objectMap, "userSids", p.UserSids) - populate(objectMap, "usernames", p.Usernames) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ProcessNotAllowed. -func (p ProcessNotAllowed) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allowlistValues", p.AllowlistValues) - populate(objectMap, "description", p.Description) - populate(objectMap, "displayName", p.DisplayName) - populate(objectMap, "isEnabled", p.IsEnabled) - objectMap["ruleType"] = "ProcessNotAllowed" - populate(objectMap, "valueType", p.ValueType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ProcessNotAllowed. -func (p *ProcessNotAllowed) 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 "allowlistValues": - err = unpopulate(val, "AllowlistValues", &p.AllowlistValues) - 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 "isEnabled": - err = unpopulate(val, "IsEnabled", &p.IsEnabled) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &p.RuleType) - delete(rawMsg, key) - case "valueType": - err = unpopulate(val, "ValueType", &p.ValueType) - 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 QueryCheck. -func (q QueryCheck) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "columnNames", q.ColumnNames) - populate(objectMap, "expectedResult", q.ExpectedResult) - populate(objectMap, "query", q.Query) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type QueuePurgesNotInAllowedRange. -func (q QueuePurgesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", q.Description) - populate(objectMap, "displayName", q.DisplayName) - populate(objectMap, "isEnabled", q.IsEnabled) - populate(objectMap, "maxThreshold", q.MaxThreshold) - populate(objectMap, "minThreshold", q.MinThreshold) - objectMap["ruleType"] = "QueuePurgesNotInAllowedRange" - populate(objectMap, "timeWindowSize", q.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type QueuePurgesNotInAllowedRange. -func (q *QueuePurgesNotInAllowedRange) 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", q, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &q.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &q.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &q.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &q.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &q.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &q.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &q.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", q, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type Remediation. -func (r Remediation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "automated", r.Automated) - populate(objectMap, "description", r.Description) - populate(objectMap, "portalLink", r.PortalLink) - populate(objectMap, "scripts", r.Scripts) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type Rule. -func (r Rule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "destinationPort", r.DestinationPort) - populate(objectMap, "direction", r.Direction) - populate(objectMap, "ipAddresses", r.IPAddresses) - populate(objectMap, "name", r.Name) - populate(objectMap, "protocols", r.Protocols) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RuleResultsInput. -func (r RuleResultsInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "latestScan", r.LatestScan) - populate(objectMap, "results", r.Results) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RuleResultsProperties. -func (r RuleResultsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "results", r.Results) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type RulesResultsInput. -func (r RulesResultsInput) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "latestScan", r.LatestScan) - populate(objectMap, "results", r.Results) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SQLServerVulnerabilityProperties. -func (s SQLServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["assessedResourceType"] = AssessedResourceTypeSQLServerVulnerability - populate(objectMap, "query", s.Query) - populate(objectMap, "type", s.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLServerVulnerabilityProperties. -func (s *SQLServerVulnerabilityProperties) 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 "assessedResourceType": - err = unpopulate(val, "AssessedResourceType", &s.AssessedResourceType) - delete(rawMsg, key) - case "query": - err = unpopulate(val, "Query", &s.Query) - 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 ScanProperties. -func (s ScanProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "database", s.Database) - populateTimeRFC3339(objectMap, "endTime", s.EndTime) - populate(objectMap, "highSeverityFailedRulesCount", s.HighSeverityFailedRulesCount) - populate(objectMap, "isBaselineApplied", s.IsBaselineApplied) - populate(objectMap, "lowSeverityFailedRulesCount", s.LowSeverityFailedRulesCount) - populate(objectMap, "mediumSeverityFailedRulesCount", s.MediumSeverityFailedRulesCount) - populate(objectMap, "sqlVersion", s.SQLVersion) - populate(objectMap, "server", s.Server) - populateTimeRFC3339(objectMap, "startTime", s.StartTime) - populate(objectMap, "state", s.State) - populate(objectMap, "totalFailedRulesCount", s.TotalFailedRulesCount) - populate(objectMap, "totalPassedRulesCount", s.TotalPassedRulesCount) - populate(objectMap, "totalRulesCount", s.TotalRulesCount) - populate(objectMap, "triggerType", s.TriggerType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScanProperties. -func (s *ScanProperties) 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 "database": - err = unpopulate(val, "Database", &s.Database) - delete(rawMsg, key) - case "endTime": - err = unpopulateTimeRFC3339(val, "EndTime", &s.EndTime) - delete(rawMsg, key) - case "highSeverityFailedRulesCount": - err = unpopulate(val, "HighSeverityFailedRulesCount", &s.HighSeverityFailedRulesCount) - delete(rawMsg, key) - case "isBaselineApplied": - err = unpopulate(val, "IsBaselineApplied", &s.IsBaselineApplied) - delete(rawMsg, key) - case "lowSeverityFailedRulesCount": - err = unpopulate(val, "LowSeverityFailedRulesCount", &s.LowSeverityFailedRulesCount) - delete(rawMsg, key) - case "mediumSeverityFailedRulesCount": - err = unpopulate(val, "MediumSeverityFailedRulesCount", &s.MediumSeverityFailedRulesCount) - delete(rawMsg, key) - case "sqlVersion": - err = unpopulate(val, "SQLVersion", &s.SQLVersion) - delete(rawMsg, key) - case "server": - err = unpopulate(val, "Server", &s.Server) - delete(rawMsg, key) - case "startTime": - err = unpopulateTimeRFC3339(val, "StartTime", &s.StartTime) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &s.State) - delete(rawMsg, key) - case "totalFailedRulesCount": - err = unpopulate(val, "TotalFailedRulesCount", &s.TotalFailedRulesCount) - delete(rawMsg, key) - case "totalPassedRulesCount": - err = unpopulate(val, "TotalPassedRulesCount", &s.TotalPassedRulesCount) - delete(rawMsg, key) - case "totalRulesCount": - err = unpopulate(val, "TotalRulesCount", &s.TotalRulesCount) - delete(rawMsg, key) - case "triggerType": - err = unpopulate(val, "TriggerType", &s.TriggerType) - 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 ScanResultProperties. -func (s ScanResultProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "baselineAdjustedResult", s.BaselineAdjustedResult) - populate(objectMap, "isTrimmed", s.IsTrimmed) - populate(objectMap, "queryResults", s.QueryResults) - populate(objectMap, "remediation", s.Remediation) - populate(objectMap, "ruleId", s.RuleID) - populate(objectMap, "ruleMetadata", s.RuleMetadata) - populate(objectMap, "status", s.Status) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ScopeElement. -func (s ScopeElement) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "field", s.Field) - if s.AdditionalProperties != nil { - for key, val := range s.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ScopeElement. -func (s *ScopeElement) 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 "field": - err = unpopulate(val, "Field", &s.Field) - delete(rawMsg, key) - default: - if s.AdditionalProperties == nil { - s.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - s.AdditionalProperties[key] = aux - } - 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 SecureScoreControlDefinitionItemProperties. -func (s SecureScoreControlDefinitionItemProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "assessmentDefinitions", s.AssessmentDefinitions) - populate(objectMap, "description", s.Description) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "maxScore", s.MaxScore) - populate(objectMap, "source", s.Source) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type ServerVulnerabilityProperties. -func (s ServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - objectMap["assessedResourceType"] = "ServerVulnerabilityAssessment" - populate(objectMap, "cve", s.Cve) - populate(objectMap, "cvss", s.Cvss) - populate(objectMap, "patchable", s.Patchable) - populateTimeRFC3339(objectMap, "publishedTime", s.PublishedTime) - populate(objectMap, "threat", s.Threat) - populate(objectMap, "type", s.Type) - populate(objectMap, "vendorReferences", s.VendorReferences) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityProperties. -func (s *ServerVulnerabilityProperties) 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 "assessedResourceType": - err = unpopulate(val, "AssessedResourceType", &s.AssessedResourceType) - delete(rawMsg, key) - case "cve": - err = unpopulate(val, "Cve", &s.Cve) - delete(rawMsg, key) - case "cvss": - err = unpopulate(val, "Cvss", &s.Cvss) - delete(rawMsg, key) - case "patchable": - err = unpopulate(val, "Patchable", &s.Patchable) - delete(rawMsg, key) - case "publishedTime": - err = unpopulateTimeRFC3339(val, "PublishedTime", &s.PublishedTime) - delete(rawMsg, key) - case "threat": - err = unpopulate(val, "Threat", &s.Threat) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &s.Type) - delete(rawMsg, key) - case "vendorReferences": - err = unpopulate(val, "VendorReferences", &s.VendorReferences) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", s, err) - } - } - return nil -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SettingsList. -func (s *SettingsList) 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 = unmarshalSettingClassificationArray(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 SubAssessmentProperties. -func (s SubAssessmentProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "additionalData", s.AdditionalData) - populate(objectMap, "category", s.Category) - populate(objectMap, "description", s.Description) - populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "id", s.ID) - populate(objectMap, "impact", s.Impact) - populate(objectMap, "remediation", s.Remediation) - populate(objectMap, "resourceDetails", s.ResourceDetails) - populate(objectMap, "status", s.Status) - populateTimeRFC3339(objectMap, "timeGenerated", s.TimeGenerated) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SubAssessmentProperties. -func (s *SubAssessmentProperties) 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": - s.AdditionalData, err = unmarshalAdditionalDataClassification(val) - delete(rawMsg, key) - case "category": - err = unpopulate(val, "Category", &s.Category) - 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 "impact": - err = unpopulate(val, "Impact", &s.Impact) - delete(rawMsg, key) - case "remediation": - err = unpopulate(val, "Remediation", &s.Remediation) - delete(rawMsg, key) - case "resourceDetails": - s.ResourceDetails, err = unmarshalResourceDetailsClassification(val) - delete(rawMsg, key) - case "status": - err = unpopulate(val, "Status", &s.Status) - delete(rawMsg, key) - case "timeGenerated": - err = unpopulateTimeRFC3339(val, "TimeGenerated", &s.TimeGenerated) - 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 SuppressionAlertsScope. -func (s SuppressionAlertsScope) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "allOf", s.AllOf) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type SystemData. -func (s SystemData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) - populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "createdByType", s.CreatedByType) - populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) - populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedByType", s.LastModifiedByType) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. -func (s *SystemData) 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 "createdAt": - err = unpopulateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) - delete(rawMsg, key) - case "createdBy": - err = unpopulate(val, "CreatedBy", &s.CreatedBy) - delete(rawMsg, key) - case "createdByType": - err = unpopulate(val, "CreatedByType", &s.CreatedByType) - delete(rawMsg, key) - case "lastModifiedAt": - err = unpopulateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) - delete(rawMsg, key) - case "lastModifiedBy": - err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) - delete(rawMsg, key) - case "lastModifiedByType": - err = unpopulate(val, "LastModifiedByType", &s.LastModifiedByType) - 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 Tags. -func (t Tags) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", t.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TagsResource. -func (t TagsResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "tags", t.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TaskParameters. -func (t TaskParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "name", t.Name) - if t.AdditionalProperties != nil { - for key, val := range t.AdditionalProperties { - objectMap[key] = val - } - } - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskParameters. -func (t *TaskParameters) 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 "name": - err = unpopulate(val, "Name", &t.Name) - delete(rawMsg, key) - default: - if t.AdditionalProperties == nil { - t.AdditionalProperties = map[string]interface{}{} - } - if val != nil { - var aux interface{} - err = json.Unmarshal(val, &aux) - t.AdditionalProperties[key] = aux - } - 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 TaskProperties. -func (t TaskProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "creationTimeUtc", t.CreationTimeUTC) - populateTimeRFC3339(objectMap, "lastStateChangeTimeUtc", t.LastStateChangeTimeUTC) - populate(objectMap, "securityTaskParameters", t.SecurityTaskParameters) - populate(objectMap, "state", t.State) - populate(objectMap, "subState", t.SubState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TaskProperties. -func (t *TaskProperties) 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 "creationTimeUtc": - err = unpopulateTimeRFC3339(val, "CreationTimeUTC", &t.CreationTimeUTC) - delete(rawMsg, key) - case "lastStateChangeTimeUtc": - err = unpopulateTimeRFC3339(val, "LastStateChangeTimeUTC", &t.LastStateChangeTimeUTC) - delete(rawMsg, key) - case "securityTaskParameters": - err = unpopulate(val, "SecurityTaskParameters", &t.SecurityTaskParameters) - delete(rawMsg, key) - case "state": - err = unpopulate(val, "State", &t.State) - delete(rawMsg, key) - case "subState": - err = unpopulate(val, "SubState", &t.SubState) - 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 ThresholdCustomAlertRule. -func (t ThresholdCustomAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", t.Description) - populate(objectMap, "displayName", t.DisplayName) - populate(objectMap, "isEnabled", t.IsEnabled) - populate(objectMap, "maxThreshold", t.MaxThreshold) - populate(objectMap, "minThreshold", t.MinThreshold) - objectMap["ruleType"] = "ThresholdCustomAlertRule" - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ThresholdCustomAlertRule. -func (t *ThresholdCustomAlertRule) 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 "description": - err = unpopulate(val, "Description", &t.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &t.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &t.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &t.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &t.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &t.RuleType) - 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 TimeWindowCustomAlertRule. -func (t TimeWindowCustomAlertRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", t.Description) - populate(objectMap, "displayName", t.DisplayName) - populate(objectMap, "isEnabled", t.IsEnabled) - populate(objectMap, "maxThreshold", t.MaxThreshold) - populate(objectMap, "minThreshold", t.MinThreshold) - objectMap["ruleType"] = "TimeWindowCustomAlertRule" - populate(objectMap, "timeWindowSize", t.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TimeWindowCustomAlertRule. -func (t *TimeWindowCustomAlertRule) 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 "description": - err = unpopulate(val, "Description", &t.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &t.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &t.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &t.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &t.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &t.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &t.TimeWindowSize) - 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 TopologyResourceProperties. -func (t TopologyResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populateTimeRFC3339(objectMap, "calculatedDateTime", t.CalculatedDateTime) - populate(objectMap, "topologyResources", t.TopologyResources) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TopologyResourceProperties. -func (t *TopologyResourceProperties) 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 "calculatedDateTime": - err = unpopulateTimeRFC3339(val, "CalculatedDateTime", &t.CalculatedDateTime) - delete(rawMsg, key) - case "topologyResources": - err = unpopulate(val, "TopologyResources", &t.TopologyResources) - 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 TopologySingleResource. -func (t TopologySingleResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "children", t.Children) - populate(objectMap, "location", t.Location) - populate(objectMap, "networkZones", t.NetworkZones) - populate(objectMap, "parents", t.Parents) - populate(objectMap, "recommendationsExist", t.RecommendationsExist) - populate(objectMap, "resourceId", t.ResourceID) - populate(objectMap, "severity", t.Severity) - populate(objectMap, "topologyScore", t.TopologyScore) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "etag", t.Etag) - populate(objectMap, "id", t.ID) - populate(objectMap, "kind", t.Kind) - populate(objectMap, "location", t.Location) - populate(objectMap, "name", t.Name) - populate(objectMap, "tags", t.Tags) - populate(objectMap, "type", t.Type) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type TwinUpdatesNotInAllowedRange. -func (t TwinUpdatesNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", t.Description) - populate(objectMap, "displayName", t.DisplayName) - populate(objectMap, "isEnabled", t.IsEnabled) - populate(objectMap, "maxThreshold", t.MaxThreshold) - populate(objectMap, "minThreshold", t.MinThreshold) - objectMap["ruleType"] = "TwinUpdatesNotInAllowedRange" - populate(objectMap, "timeWindowSize", t.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type TwinUpdatesNotInAllowedRange. -func (t *TwinUpdatesNotInAllowedRange) 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 "description": - err = unpopulate(val, "Description", &t.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &t.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &t.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &t.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &t.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &t.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &t.TimeWindowSize) - 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 UnauthorizedOperationsNotInAllowedRange. -func (u UnauthorizedOperationsNotInAllowedRange) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "description", u.Description) - populate(objectMap, "displayName", u.DisplayName) - populate(objectMap, "isEnabled", u.IsEnabled) - populate(objectMap, "maxThreshold", u.MaxThreshold) - populate(objectMap, "minThreshold", u.MinThreshold) - objectMap["ruleType"] = "UnauthorizedOperationsNotInAllowedRange" - populate(objectMap, "timeWindowSize", u.TimeWindowSize) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type UnauthorizedOperationsNotInAllowedRange. -func (u *UnauthorizedOperationsNotInAllowedRange) 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", u, err) - } - for key, val := range rawMsg { - var err error - switch key { - case "description": - err = unpopulate(val, "Description", &u.Description) - delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &u.DisplayName) - delete(rawMsg, key) - case "isEnabled": - err = unpopulate(val, "IsEnabled", &u.IsEnabled) - delete(rawMsg, key) - case "maxThreshold": - err = unpopulate(val, "MaxThreshold", &u.MaxThreshold) - delete(rawMsg, key) - case "minThreshold": - err = unpopulate(val, "MinThreshold", &u.MinThreshold) - delete(rawMsg, key) - case "ruleType": - err = unpopulate(val, "RuleType", &u.RuleType) - delete(rawMsg, key) - case "timeWindowSize": - err = unpopulate(val, "TimeWindowSize", &u.TimeWindowSize) - delete(rawMsg, key) - } - if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", u, err) - } - } - return nil -} - -// MarshalJSON implements the json.Marshaller interface for type UpdateIoTSecuritySolutionProperties. -func (u UpdateIoTSecuritySolutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "recommendationsConfiguration", u.RecommendationsConfiguration) - populate(objectMap, "userDefinedResources", u.UserDefinedResources) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type UpdateIotSecuritySolutionData. -func (u UpdateIotSecuritySolutionData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", u.Properties) - populate(objectMap, "tags", u.Tags) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type UserDefinedResourcesProperties. -func (u UserDefinedResourcesProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "query", u.Query) - populate(objectMap, "querySubscriptions", u.QuerySubscriptions) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type VaRule. -func (v VaRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "benchmarkReferences", v.BenchmarkReferences) - populate(objectMap, "category", v.Category) - populate(objectMap, "description", v.Description) - populate(objectMap, "queryCheck", v.QueryCheck) - populate(objectMap, "rationale", v.Rationale) - populate(objectMap, "ruleId", v.RuleID) - populate(objectMap, "ruleType", v.RuleType) - populate(objectMap, "severity", v.Severity) - populate(objectMap, "title", v.Title) - return json.Marshal(objectMap) -} - -// MarshalJSON implements the json.Marshaller interface for type WorkspaceSetting. -func (w WorkspaceSetting) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "id", w.ID) - populate(objectMap, "name", w.Name) - populate(objectMap, "properties", w.Properties) - populate(objectMap, "type", w.Type) - return json.Marshal(objectMap) -} - -func populate(m map[string]interface{}, k string, v interface{}) { - if v == nil { - return - } else if azcore.IsNullValue(v) { - m[k] = nil - } else if !reflect.ValueOf(v).IsNil() { - m[k] = v - } -} - -func populateByteArray(m map[string]interface{}, k string, b []byte, f runtime.Base64Encoding) { - if azcore.IsNullValue(b) { - m[k] = nil - } else if len(b) == 0 { - return - } else { - m[k] = runtime.EncodeByteArray(b, f) - } -} - -func unpopulate(data json.RawMessage, fn string, v interface{}) error { - if data == nil { - return nil - } - if err := json.Unmarshal(data, v); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - return nil -}