From c488090dfb735b059fc71fe607ac281ab08f8f56 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Wed, 6 May 2026 03:16:39 +0000 Subject: [PATCH 1/5] Configurations: 'specification/security/resource-manager/Microsoft.Security/Security/tspconfig.yaml', and CommitSHA: 'f127e37c800e7ba895f4de2cc4b3e9cb6b75ff94' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6255576 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../security/armsecurity/CHANGELOG.md | 433 ++ .../armsecurity/accountconnectors_client.go | 271 - .../adaptiveapplicationcontrols_client.go | 291 - .../adaptivenetworkhardenings_client.go | 291 - .../advancedthreatprotection_client.go | 21 +- .../security/armsecurity/alerts_client.go | 63 +- .../alertssuppressionrules_client.go | 15 +- .../armsecurity/allowedconnections_client.go | 15 +- .../armsecurity/apicollections_client.go | 70 +- .../armsecurity/application_client.go | 14 +- .../armsecurity/applications_client.go | 9 +- .../armsecurity/assessments_client.go | 50 +- .../armsecurity/assessmentsmetadata_client.go | 69 +- .../armsecurity/assignments_client.go | 341 + .../armsecurity/automations_client.go | 37 +- .../autoprovisioningsettings_client.go | 14 +- .../security/armsecurity/autorest.md | 55 - .../armsecurity/azuredevopsorgs_client.go | 66 +- .../armsecurity/azuredevopsprojects_client.go | 62 +- .../armsecurity/azuredevopsrepos_client.go | 66 +- .../security/armsecurity/build.go | 7 - .../security/armsecurity/client_factory.go | 139 +- .../armsecurity/complianceresults_client.go | 22 +- .../armsecurity/compliances_client.go | 21 +- .../connectorapplication_client.go | 22 +- .../connectorapplications_client.go | 13 +- .../security/armsecurity/connectors_client.go | 58 +- .../security/armsecurity/constants.go | 1865 +++--- .../security/armsecurity/contacts_client.go | 19 +- .../customassessmentautomations_client.go | 346 - .../customentitystoreassignments_client.go | 345 - .../customrecommendations_client.go | 270 + .../security/armsecurity/date_type.go | 55 - .../armsecurity/defenderforstorage_client.go | 282 +- .../devicesecuritygroups_client.go | 35 +- .../devopsconfigurations_client.go | 68 +- .../devopsoperationresults_client.go | 16 +- .../discoveredsecuritysolutions_client.go | 15 +- .../externalsecuritysolutions_client.go | 15 +- .../fake/accountconnectors_server.go | 211 - .../adaptiveapplicationcontrols_server.go | 235 - .../fake/adaptivenetworkhardenings_server.go | 237 - .../fake/advancedthreatprotection_server.go | 60 +- .../armsecurity/fake/alerts_server.go | 170 +- .../fake/alertssuppressionrules_server.go | 82 +- .../fake/allowedconnections_server.go | 68 +- .../armsecurity/fake/apicollections_server.go | 92 +- .../armsecurity/fake/application_server.go | 68 +- .../armsecurity/fake/applications_server.go | 52 +- .../armsecurity/fake/assessments_server.go | 82 +- .../fake/assessmentsmetadata_server.go | 90 +- .../armsecurity/fake/assignments_server.go | 288 + .../armsecurity/fake/automations_server.go | 100 +- .../fake/autoprovisioningsettings_server.go | 68 +- .../fake/azuredevopsorgs_server.go | 84 +- .../fake/azuredevopsprojects_server.go | 76 +- .../fake/azuredevopsrepos_server.go | 76 +- .../fake/complianceresults_server.go | 60 +- .../armsecurity/fake/compliances_server.go | 60 +- .../fake/connectorapplication_server.go | 68 +- .../fake/connectorapplications_server.go | 52 +- .../armsecurity/fake/connectors_server.go | 92 +- .../armsecurity/fake/contacts_server.go | 76 +- .../customassessmentautomations_server.go | 268 - .../customentitystoreassignments_server.go | 268 - .../fake/customrecommendations_server.go | 247 + .../security/armsecurity/fake/date_type.go | 55 - .../fake/defenderforstorage_server.go | 247 +- .../fake/devicesecuritygroups_server.go | 76 +- .../fake/devopsconfigurations_server.go | 84 +- .../fake/devopsoperationresults_server.go | 52 +- .../discoveredsecuritysolutions_server.go | 68 +- .../fake/externalsecuritysolutions_server.go | 68 +- .../armsecurity/fake/githubissues_server.go | 151 + .../armsecurity/fake/githubowners_server.go | 68 +- .../armsecurity/fake/githubrepos_server.go | 60 +- .../armsecurity/fake/gitlabgroups_server.go | 68 +- .../armsecurity/fake/gitlabprojects_server.go | 60 +- .../fake/gitlabsubgroups_server.go | 52 +- .../fake/governanceassignments_server.go | 76 +- .../fake/governancerules_server.go | 100 +- .../armsecurity/fake/healthreports_server.go | 60 +- .../informationprotectionpolicies_server.go | 68 +- .../security/armsecurity/fake/internal.go | 27 +- .../fake/iotsecuritysolution_server.go | 104 +- .../iotsecuritysolutionanalytics_server.go | 60 +- ...olutionsanalyticsaggregatedalert_server.go | 74 +- ...solutionsanalyticsrecommendation_server.go | 66 +- .../fake/jitnetworkaccesspolicies_server.go | 108 +- .../armsecurity/fake/locations_server.go | 60 +- .../armsecurity/fake/mdeonboardings_server.go | 60 +- .../fake/operationresults_server.go | 124 + .../armsecurity/fake/operations_server.go | 50 +- .../fake/operationstatuses_server.go | 117 + .../armsecurity/fake/operators_server.go | 133 +- .../armsecurity/fake/polymorphic_helpers.go | 7 +- .../armsecurity/fake/pricings_server.go | 82 +- .../fake/privateendpointconnections_server.go | 301 + .../fake/privatelinkresources_server.go | 179 + .../armsecurity/fake/privatelinks_server.go | 411 ++ .../regulatorycomplianceassessments_server.go | 66 +- .../regulatorycompliancecontrols_server.go | 66 +- .../regulatorycompliancestandards_server.go | 66 +- .../securescorecontroldefinitions_server.go | 58 +- .../fake/securescorecontrols_server.go | 72 +- .../armsecurity/fake/securescores_server.go | 60 +- .../fake/sensitivitysettings_server.go | 64 +- .../armsecurity/fake/server_factory.go | 530 +- .../servervulnerabilityassessment_server.go | 76 +- ...vulnerabilityassessmentssettings_server.go | 76 +- .../armsecurity/fake/settings_server.go | 80 +- .../fake/softwareinventories_server.go | 210 - .../armsecurity/fake/solutions_server.go | 60 +- .../fake/solutionsreferencedata_server.go | 60 +- ...erabilityassessmentbaselinerules_server.go | 225 +- ...lnerabilityassessmentscanresults_server.go | 155 +- .../sqlvulnerabilityassessmentscans_server.go | 220 +- ...lvulnerabilityassessmentsettings_server.go | 187 + .../fake/standardassignments_server.go | 247 + .../armsecurity/fake/standards_server.go | 288 + .../armsecurity/fake/subassessments_server.go | 68 +- .../security/armsecurity/fake/tasks_server.go | 118 +- .../security/armsecurity/fake/time_rfc3339.go | 107 - .../armsecurity/fake/topology_server.go | 68 +- .../fake/workspacesettings_server.go | 84 +- .../armsecurity/githubissues_client.go | 134 + .../armsecurity/githubowners_client.go | 32 +- .../armsecurity/githubrepos_client.go | 26 +- .../armsecurity/gitlabgroups_client.go | 32 +- .../armsecurity/gitlabprojects_client.go | 26 +- .../armsecurity/gitlabsubgroups_client.go | 16 +- .../security/armsecurity/go.mod | 12 +- .../security/armsecurity/go.sum | 24 +- .../governanceassignments_client.go | 52 +- .../armsecurity/governancerules_client.go | 74 +- .../armsecurity/healthreports_client.go | 24 +- .../informationprotectionpolicies_client.go | 30 +- .../security/armsecurity/interfaces.go | 28 +- .../armsecurity/iotsecuritysolution_client.go | 28 +- .../iotsecuritysolutionanalytics_client.go | 15 +- ...olutionsanalyticsaggregatedalert_client.go | 21 +- ...solutionsanalyticsrecommendation_client.go | 16 +- .../jitnetworkaccesspolicies_client.go | 38 +- .../security/armsecurity/locations_client.go | 15 +- .../armsecurity/mdeonboardings_client.go | 11 +- .../security/armsecurity/models.go | 3365 +++++----- .../security/armsecurity/models_serde.go | 5541 +++++++++-------- .../armsecurity/operationresults_client.go | 112 + .../security/armsecurity/operations_client.go | 13 +- .../armsecurity/operationstatuses_client.go | 104 + .../security/armsecurity/operators_client.go | 79 +- .../security/armsecurity/options.go | 437 +- .../armsecurity/polymorphic_helpers.go | 103 +- .../security/armsecurity/pricings_client.go | 59 +- .../privateendpointconnections_client.go | 344 + .../privatelinkresources_client.go | 174 + .../armsecurity/privatelinks_client.go | 506 ++ .../regulatorycomplianceassessments_client.go | 9 +- .../regulatorycompliancecontrols_client.go | 9 +- .../regulatorycompliancestandards_client.go | 9 +- .../security/armsecurity/responses.go | 472 +- .../security/armsecurity/responses_serde.go | 55 + .../securescorecontroldefinitions_client.go | 11 +- .../armsecurity/securescorecontrols_client.go | 7 +- .../armsecurity/securescores_client.go | 11 +- .../armsecurity/sensitivitysettings_client.go | 12 +- .../servervulnerabilityassessment_client.go | 43 +- ...vulnerabilityassessmentssettings_client.go | 17 +- .../security/armsecurity/settings_client.go | 18 +- .../armsecurity/softwareinventories_client.go | 250 - .../security/armsecurity/solutions_client.go | 15 +- .../solutionsreferencedata_client.go | 13 +- ...erabilityassessmentbaselinerules_client.go | 178 +- ...lnerabilityassessmentscanresults_client.go | 92 +- .../sqlvulnerabilityassessmentscans_client.go | 204 +- ...lvulnerabilityassessmentsettings_client.go | 204 + .../armsecurity/standardassignments_client.go | 278 + .../security/armsecurity/standards_client.go | 342 + .../armsecurity/subassessments_client.go | 33 +- .../security/armsecurity/tasks_client.go | 23 +- .../armsecurity/testdata/_metadata.json | 37 + .../security/armsecurity/time_rfc3339.go | 107 - .../security/armsecurity/topology_client.go | 15 +- .../security/armsecurity/tsp-location.yaml | 4 + .../security/armsecurity/version.go | 10 + .../armsecurity/workspacesettings_client.go | 20 +- 186 files changed, 17893 insertions(+), 11979 deletions(-) delete mode 100644 sdk/resourcemanager/security/armsecurity/accountconnectors_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client.go create mode 100644 sdk/resourcemanager/security/armsecurity/assignments_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/autorest.md delete mode 100644 sdk/resourcemanager/security/armsecurity/build.go delete mode 100644 sdk/resourcemanager/security/armsecurity/customassessmentautomations_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client.go create mode 100644 sdk/resourcemanager/security/armsecurity/customrecommendations_client.go delete mode 100644 sdk/resourcemanager/security/armsecurity/date_type.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/accountconnectors_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/adaptiveapplicationcontrols_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/adaptivenetworkhardenings_server.go create mode 100644 sdk/resourcemanager/security/armsecurity/fake/assignments_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/customassessmentautomations_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/customentitystoreassignments_server.go create mode 100644 sdk/resourcemanager/security/armsecurity/fake/customrecommendations_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/date_type.go create mode 100644 sdk/resourcemanager/security/armsecurity/fake/githubissues_server.go create mode 100644 sdk/resourcemanager/security/armsecurity/fake/operationresults_server.go create mode 100644 sdk/resourcemanager/security/armsecurity/fake/operationstatuses_server.go create mode 100644 sdk/resourcemanager/security/armsecurity/fake/privateendpointconnections_server.go create mode 100644 sdk/resourcemanager/security/armsecurity/fake/privatelinkresources_server.go create mode 100644 sdk/resourcemanager/security/armsecurity/fake/privatelinks_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/softwareinventories_server.go create mode 100644 sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentsettings_server.go create mode 100644 sdk/resourcemanager/security/armsecurity/fake/standardassignments_server.go create mode 100644 sdk/resourcemanager/security/armsecurity/fake/standards_server.go delete mode 100644 sdk/resourcemanager/security/armsecurity/fake/time_rfc3339.go create mode 100644 sdk/resourcemanager/security/armsecurity/githubissues_client.go create mode 100644 sdk/resourcemanager/security/armsecurity/operationresults_client.go create mode 100644 sdk/resourcemanager/security/armsecurity/operationstatuses_client.go create mode 100644 sdk/resourcemanager/security/armsecurity/privateendpointconnections_client.go create mode 100644 sdk/resourcemanager/security/armsecurity/privatelinkresources_client.go create mode 100644 sdk/resourcemanager/security/armsecurity/privatelinks_client.go create mode 100644 sdk/resourcemanager/security/armsecurity/responses_serde.go delete mode 100644 sdk/resourcemanager/security/armsecurity/softwareinventories_client.go create mode 100644 sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentsettings_client.go create mode 100644 sdk/resourcemanager/security/armsecurity/standardassignments_client.go create mode 100644 sdk/resourcemanager/security/armsecurity/standards_client.go create mode 100644 sdk/resourcemanager/security/armsecurity/testdata/_metadata.json delete mode 100644 sdk/resourcemanager/security/armsecurity/time_rfc3339.go create mode 100644 sdk/resourcemanager/security/armsecurity/tsp-location.yaml create mode 100644 sdk/resourcemanager/security/armsecurity/version.go diff --git a/sdk/resourcemanager/security/armsecurity/CHANGELOG.md b/sdk/resourcemanager/security/armsecurity/CHANGELOG.md index 14793702fc7a..f1cc444993b0 100644 --- a/sdk/resourcemanager/security/armsecurity/CHANGELOG.md +++ b/sdk/resourcemanager/security/armsecurity/CHANGELOG.md @@ -1,5 +1,438 @@ # Release History +## 0.15.0 (2026-05-06) +### Breaking Changes + +- Function `*SQLVulnerabilityAssessmentBaselineRulesClient.Add` parameter(s) have been changed from `(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientAddOptions)` to `(ctx context.Context, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientAddOptions)` +- Function `*SQLVulnerabilityAssessmentBaselineRulesClient.CreateOrUpdate` parameter(s) have been changed from `(ctx context.Context, ruleID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions)` to `(ctx context.Context, resourceID string, ruleID string, body RuleResultsInput, options *SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions)` +- Function `*SQLVulnerabilityAssessmentBaselineRulesClient.Delete` parameter(s) have been changed from `(ctx context.Context, ruleID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions)` to `(ctx context.Context, resourceID string, ruleID string, options *SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions)` +- Function `*SQLVulnerabilityAssessmentBaselineRulesClient.Get` parameter(s) have been changed from `(ctx context.Context, ruleID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientGetOptions)` to `(ctx context.Context, resourceID string, ruleID string, options *SQLVulnerabilityAssessmentBaselineRulesClientGetOptions)` +- Function `*SQLVulnerabilityAssessmentScanResultsClient.Get` parameter(s) have been changed from `(ctx context.Context, scanID string, scanResultID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentScanResultsClientGetOptions)` to `(ctx context.Context, scanID string, scanResultID string, resourceID string, options *SQLVulnerabilityAssessmentScanResultsClientGetOptions)` +- Function `*SQLVulnerabilityAssessmentScansClient.Get` parameter(s) have been changed from `(ctx context.Context, scanID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentScansClientGetOptions)` to `(ctx context.Context, scanID string, resourceID string, options *SQLVulnerabilityAssessmentScansClientGetOptions)` +- Function `*SettingsClient.Get` parameter(s) have been changed from `(ctx context.Context, settingName SettingNameAutoGenerated, options *SettingsClientGetOptions)` to `(ctx context.Context, settingName SettingName, options *SettingsClientGetOptions)` +- Function `*SettingsClient.Update` parameter(s) have been changed from `(ctx context.Context, settingName SettingNameAutoGenerated, setting SettingClassification, options *SettingsClientUpdateOptions)` to `(ctx context.Context, settingName SettingName, setting SettingClassification, options *SettingsClientUpdateOptions)` +- Type of `Extension.OperationStatus` has been changed from `*OperationStatusAutoGenerated` to `*OperationStatus` +- Type of `HealthReportProperties.ResourceDetails` has been changed from `*ResourceDetailsAutoGenerated` to `*ResourceDetails` +- Type of `HealthReportProperties.Status` has been changed from `*StatusAutoGenerated` to `*Status` +- Type of `JitNetworkAccessRequestPort.Status` has been changed from `*Status` to `*StatusEnum` +- Type of `Operation.Origin` has been changed from `*string` to `*Origin` +- Type of `OperationStatusResult.Error` has been changed from `*ErrorDetailAutoGenerated` to `*ErrorDetail` +- Type of `OperationStatusResult.PercentComplete` has been changed from `*float32` to `*float64` +- `AuthenticationTypeAwsAssumeRole`, `AuthenticationTypeAwsCreds`, `AuthenticationTypeGcpCredentials` from enum `AuthenticationType` has been removed +- Enum `AdaptiveApplicationControlIssue` has been removed +- Enum `ApplicationConditionOperator` has been removed +- Enum `AuthenticationProvisioningState` has been removed +- Enum `Code` has been removed +- Enum `ConfigurationStatus` has been removed +- Enum `DesiredOnboardingState` has been removed +- Enum `Direction` has been removed +- Enum `EndOfSupportStatus` has been removed +- Enum `EnforcementMode` has been removed +- Enum `EnforcementSupport` has been removed +- Enum `FileType` has been removed +- Enum `GovernanceRuleConditionOperator` has been removed +- Enum `HybridComputeProvisioningState` has been removed +- Enum `OperationResult` has been removed +- Enum `PermissionProperty` has been removed +- Enum `RecommendationAction` has been removed +- Enum `RecommendationStatus` has been removed +- Enum `SettingNameAutoGenerated` has been removed +- Enum `SourceSystem` has been removed +- Enum `Status` has been removed +- Enum `SupportedCloudEnum` has been removed +- Enum `TransportProtocol` has been removed +- Function `NewAccountConnectorsClient` has been removed +- Function `*AccountConnectorsClient.CreateOrUpdate` has been removed +- Function `*AccountConnectorsClient.Delete` has been removed +- Function `*AccountConnectorsClient.Get` has been removed +- Function `*AccountConnectorsClient.NewListPager` has been removed +- Function `NewAdaptiveApplicationControlsClient` has been removed +- Function `*AdaptiveApplicationControlsClient.Delete` has been removed +- Function `*AdaptiveApplicationControlsClient.Get` has been removed +- Function `*AdaptiveApplicationControlsClient.List` has been removed +- Function `*AdaptiveApplicationControlsClient.Put` has been removed +- Function `NewAdaptiveNetworkHardeningsClient` has been removed +- Function `*AdaptiveNetworkHardeningsClient.BeginEnforce` has been removed +- Function `*AdaptiveNetworkHardeningsClient.Get` has been removed +- Function `*AdaptiveNetworkHardeningsClient.NewListByExtendedResourcePager` has been removed +- Function `*AuthenticationDetailsProperties.GetAuthenticationDetailsProperties` has been removed +- Function `*AwAssumeRoleAuthenticationDetailsProperties.GetAuthenticationDetailsProperties` has been removed +- Function `*AwsCredsAuthenticationDetailsProperties.GetAuthenticationDetailsProperties` has been removed +- Function `*ClientFactory.NewAccountConnectorsClient` has been removed +- Function `*ClientFactory.NewAdaptiveApplicationControlsClient` has been removed +- Function `*ClientFactory.NewAdaptiveNetworkHardeningsClient` has been removed +- Function `*ClientFactory.NewCustomAssessmentAutomationsClient` has been removed +- Function `*ClientFactory.NewCustomEntityStoreAssignmentsClient` has been removed +- Function `*ClientFactory.NewSoftwareInventoriesClient` has been removed +- Function `NewCustomAssessmentAutomationsClient` has been removed +- Function `*CustomAssessmentAutomationsClient.Create` has been removed +- Function `*CustomAssessmentAutomationsClient.Delete` has been removed +- Function `*CustomAssessmentAutomationsClient.Get` has been removed +- Function `*CustomAssessmentAutomationsClient.NewListByResourceGroupPager` has been removed +- Function `*CustomAssessmentAutomationsClient.NewListBySubscriptionPager` has been removed +- Function `NewCustomEntityStoreAssignmentsClient` has been removed +- Function `*CustomEntityStoreAssignmentsClient.Create` has been removed +- Function `*CustomEntityStoreAssignmentsClient.Delete` has been removed +- Function `*CustomEntityStoreAssignmentsClient.Get` has been removed +- Function `*CustomEntityStoreAssignmentsClient.NewListByResourceGroupPager` has been removed +- Function `*CustomEntityStoreAssignmentsClient.NewListBySubscriptionPager` has been removed +- Function `*GcpCredentialsDetailsProperties.GetAuthenticationDetailsProperties` has been removed +- Function `*ResourceDetails.GetResourceDetails` has been removed +- Function `NewSoftwareInventoriesClient` has been removed +- Function `*SoftwareInventoriesClient.Get` has been removed +- Function `*SoftwareInventoriesClient.NewListByExtendedResourcePager` has been removed +- Function `*SoftwareInventoriesClient.NewListBySubscriptionPager` has been removed +- Operation `*OperatorsClient.List` has supported pagination, use `*OperatorsClient.NewListPager` instead. +- Operation `*SQLVulnerabilityAssessmentBaselineRulesClient.List` has supported pagination, use `*SQLVulnerabilityAssessmentBaselineRulesClient.NewListPager` instead. +- Operation `*SQLVulnerabilityAssessmentScanResultsClient.List` has supported pagination, use `*SQLVulnerabilityAssessmentScanResultsClient.NewListPager` instead. +- Operation `*SQLVulnerabilityAssessmentScansClient.List` has supported pagination, use `*SQLVulnerabilityAssessmentScansClient.NewListPager` instead. +- Struct `AADConnectivityStateAutoGenerated` has been removed +- Struct `AdaptiveApplicationControlGroup` has been removed +- Struct `AdaptiveApplicationControlGroupData` has been removed +- Struct `AdaptiveApplicationControlGroups` has been removed +- Struct `AdaptiveApplicationControlIssueSummary` has been removed +- Struct `AdaptiveNetworkHardening` has been removed +- Struct `AdaptiveNetworkHardeningEnforceRequest` has been removed +- Struct `AdaptiveNetworkHardeningProperties` has been removed +- Struct `AdaptiveNetworkHardeningsList` has been removed +- Struct `ApplicationCondition` has been removed +- Struct `ArcAutoProvisioning` has been removed +- Struct `ArcAutoProvisioningAws` has been removed +- Struct `ArcAutoProvisioningGcp` has been removed +- Struct `AssessmentMetadata` has been removed +- Struct `AssessmentPropertiesBase` has been removed +- Struct `AwAssumeRoleAuthenticationDetailsProperties` has been removed +- Struct `AwsCredsAuthenticationDetailsProperties` has been removed +- Struct `AzureDevOpsOrganizationConfiguration` has been removed +- Struct `AzureDevOpsProjectConfiguration` has been removed +- Struct `AzureTrackedResourceLocation` has been removed +- Struct `BaseResourceConfiguration` has been removed +- Struct `Condition` has been removed +- Struct `ConnectorSetting` has been removed +- Struct `ConnectorSettingList` has been removed +- Struct `ConnectorSettingProperties` has been removed +- Struct `CustomAssessmentAutomation` has been removed +- Struct `CustomAssessmentAutomationProperties` has been removed +- Struct `CustomAssessmentAutomationRequest` has been removed +- Struct `CustomAssessmentAutomationRequestProperties` has been removed +- Struct `CustomAssessmentAutomationsListResult` has been removed +- Struct `CustomEntityStoreAssignment` has been removed +- Struct `CustomEntityStoreAssignmentProperties` has been removed +- Struct `CustomEntityStoreAssignmentRequest` has been removed +- Struct `CustomEntityStoreAssignmentRequestProperties` has been removed +- Struct `CustomEntityStoreAssignmentsListResult` has been removed +- Struct `ETag` has been removed +- Struct `EffectiveNetworkSecurityGroups` has been removed +- Struct `ErrorDetailAutoGenerated` has been removed +- Struct `ErrorResponse` has been removed +- Struct `ErrorResponseAutoGenerated` has been removed +- Struct `ExternalSecuritySolutionProperties` has been removed +- Struct `GcpCredentialsDetailsProperties` has been removed +- Struct `GitHubOwnerConfiguration` has been removed +- Struct `GitLabGroupConfiguration` has been removed +- Struct `HybridComputeSettingsProperties` has been removed +- Struct `KindAutoGenerated` has been removed +- Struct `Location` has been removed +- Struct `OperationList` has been removed +- Struct `OperationResultAutoGenerated` has been removed +- Struct `OperationStatusAutoGenerated` has been removed +- Struct `PathRecommendation` has been removed +- Struct `ProtectionMode` has been removed +- Struct `ProxyResource` has been removed +- Struct `ProxyServerProperties` has been removed +- Struct `PublisherInfo` has been removed +- Struct `Resource` has been removed +- Struct `ResourceAutoGenerated` has been removed +- Struct `ResourceAutoGenerated2` has been removed +- Struct `ResourceDetailsAutoGenerated` has been removed +- Struct `Rule` has been removed +- Struct `Scan` has been removed +- Struct `ScanProperties` has been removed +- Struct `Scans` has been removed +- Struct `SecureScoreControlScore` has been removed +- Struct `ServicePrincipalProperties` has been removed +- Struct `Software` has been removed +- Struct `SoftwareProperties` has been removed +- Struct `SoftwaresList` has been removed +- Struct `StatusAutoGenerated` has been removed +- Struct `Tags` has been removed +- Struct `TagsResource` has been removed +- Struct `TrackedResource` has been removed +- Struct `UserRecommendation` has been removed +- Struct `VMRecommendation` has been removed +- Struct `VMScannersAws` has been removed +- Struct `VMScannersBase` has been removed +- Struct `VMScannersGcp` has been removed +- Field `OperationResultAutoGenerated` of struct `GovernanceRulesClientOperationResultsResponse` has been removed +- Field `OperationList` of struct `OperationsClientListResponse` has been removed +- Field `Body` of struct `SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions` has been removed +- Field `Scan` of struct `SQLVulnerabilityAssessmentScansClientGetResponse` has been removed + +### Features Added + +- New value `ActionTypeInternal` added to enum type `ActionType` +- New value `AssessedResourceTypeServerVulnerabilityAssessment` added to enum type `AssessedResourceType` +- New value `AssessmentTypeBuiltInPolicy`, `AssessmentTypeCustom`, `AssessmentTypeDynamicBuiltIn`, `AssessmentTypeManualBuiltIn`, `AssessmentTypeManualBuiltInPolicy`, `AssessmentTypeManualCustomPolicy`, `AssessmentTypeUnknown` added to enum type `AssessmentType` +- New value `AuthenticationTypeAccessToken` added to enum type `AuthenticationType` +- New value `CategoriesAppServices`, `CategoriesContainer` added to enum type `Categories` +- New value `CloudNameDockerHub`, `CloudNameJFrog` added to enum type `CloudName` +- New value `EnvironmentTypeDockerHubOrganization`, `EnvironmentTypeJFrogArtifactory` added to enum type `EnvironmentType` +- New value `OfferingTypeCspmMonitorDockerHub`, `OfferingTypeCspmMonitorJFrog`, `OfferingTypeDefenderCspmDockerHub`, `OfferingTypeDefenderCspmJFrog`, `OfferingTypeDefenderForContainersDockerHub`, `OfferingTypeDefenderForContainersJFrog` added to enum type `OfferingType` +- New value `ProvisioningStateCanceled`, `ProvisioningStateCreating`, `ProvisioningStateDeleting`, `ProvisioningStateInProgress` added to enum type `ProvisioningState` +- New value `RuleStatusNotApplicable` added to enum type `RuleStatus` +- New value `SettingNameMCAS`, `SettingNameSentinel`, `SettingNameWDATP`, `SettingNameWDATPEXCLUDELINUXPUBLICPREVIEW`, `SettingNameWDATPUNIFIEDSOLUTION` added to enum type `SettingName` +- New value `SeverityCritical` added to enum type `Severity` +- New value `SourceAws`, `SourceGcp`, `SourceOnPremiseResourceDetails` added to enum type `Source` +- New value `StateOff`, `StateOn` added to enum type `State` +- New enum type `AgentlessEnablement` with values `AgentlessEnablementDisabled`, `AgentlessEnablementEnabled`, `AgentlessEnablementNotApplicable` +- New enum type `AttestationComplianceState` with values `AttestationComplianceStateCompliant`, `AttestationComplianceStateNonCompliant`, `AttestationComplianceStateUnknown` +- New enum type `AutomatedResponseType` with values `AutomatedResponseTypeBlobSoftDelete`, `AutomatedResponseTypeNone` +- New enum type `BlobScanResultsOptions` with values `BlobScanResultsOptionsBlobIndexTags`, `BlobScanResultsOptionsNone` +- New enum type `Effect` with values `EffectAttest`, `EffectAudit`, `EffectExempt` +- New enum type `ExemptionCategory` with values `ExemptionCategoryMitigated`, `ExemptionCategoryWaiver` +- New enum type `InventoryKind` with values `InventoryKindAzureDevOpsOrganization`, `InventoryKindAzureDevOpsProject`, `InventoryKindAzureDevOpsRepository`, `InventoryKindGitHubOwner`, `InventoryKindGitHubRepository` +- New enum type `InventoryListKind` with values `InventoryListKindExclusion`, `InventoryListKindInclusion` +- New enum type `OperationResultStatus` with values `OperationResultStatusCanceled`, `OperationResultStatusFailed`, `OperationResultStatusSucceeded` +- New enum type `Origin` with values `OriginSystem`, `OriginUser`, `OriginUserSystem` +- New enum type `PrivateEndpointConnectionProvisioningState` with values `PrivateEndpointConnectionProvisioningStateCreating`, `PrivateEndpointConnectionProvisioningStateDeleting`, `PrivateEndpointConnectionProvisioningStateFailed`, `PrivateEndpointConnectionProvisioningStateSucceeded` +- New enum type `PrivateEndpointServiceConnectionStatus` with values `PrivateEndpointServiceConnectionStatusApproved`, `PrivateEndpointServiceConnectionStatusPending`, `PrivateEndpointServiceConnectionStatusRejected` +- New enum type `PublicNetworkAccess` with values `PublicNetworkAccessDisabled`, `PublicNetworkAccessEnabled` +- New enum type `RecommendationSupportedClouds` with values `RecommendationSupportedCloudsAWS`, `RecommendationSupportedCloudsAzure`, `RecommendationSupportedCloudsGCP` +- New enum type `RiskLevel` with values `RiskLevelCritical`, `RiskLevelHigh`, `RiskLevelLow`, `RiskLevelMedium`, `RiskLevelNone` +- New enum type `SQLVulnerabilityAssessmentState` with values `SQLVulnerabilityAssessmentStateDisabled`, `SQLVulnerabilityAssessmentStateEnabled` +- New enum type `ScanOperationStatus` with values `ScanOperationStatusFailed`, `ScanOperationStatusFailedToRun`, `ScanOperationStatusInProgress`, `ScanOperationStatusPassed` +- New enum type `SecurityIssue` with values `SecurityIssueAnonymousAccess`, `SecurityIssueBestPractices`, `SecurityIssueExcessivePermissions`, `SecurityIssueNetworkExposure`, `SecurityIssueTrafficEncryption`, `SecurityIssueVulnerability` +- New enum type `StandardSupportedCloud` with values `StandardSupportedCloudAWS`, `StandardSupportedCloudAzure`, `StandardSupportedCloudGCP` +- New enum type `StandardSupportedClouds` with values `StandardSupportedCloudsAWS`, `StandardSupportedCloudsGCP` +- New enum type `StandardType` with values `StandardTypeCompliance`, `StandardTypeCustom`, `StandardTypeDefault` +- New enum type `StatusEnum` with values `StatusEnumInitiated`, `StatusEnumRevoked` +- New function `*AccessTokenAuthentication.GetAuthentication() *Authentication` +- New function `NewAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssignmentsClient, error)` +- New function `*AssignmentsClient.CreateOrUpdate(ctx context.Context, resourceGroupName string, assignmentID string, assignment Assignment, options *AssignmentsClientCreateOrUpdateOptions) (AssignmentsClientCreateOrUpdateResponse, error)` +- New function `*AssignmentsClient.Delete(ctx context.Context, resourceGroupName string, assignmentID string, options *AssignmentsClientDeleteOptions) (AssignmentsClientDeleteResponse, error)` +- New function `*AssignmentsClient.Get(ctx context.Context, resourceGroupName string, assignmentID string, options *AssignmentsClientGetOptions) (AssignmentsClientGetResponse, error)` +- New function `*AssignmentsClient.NewListBySubscriptionPager(options *AssignmentsClientListBySubscriptionOptions) *runtime.Pager[AssignmentsClientListBySubscriptionResponse]` +- New function `*AssignmentsClient.NewListPager(resourceGroupName string, options *AssignmentsClientListOptions) *runtime.Pager[AssignmentsClientListResponse]` +- New function `*Authentication.GetAuthentication() *Authentication` +- New function `*ClientFactory.NewAssignmentsClient() *AssignmentsClient` +- New function `*ClientFactory.NewCustomRecommendationsClient() *CustomRecommendationsClient` +- New function `*ClientFactory.NewGitHubIssuesClient() *GitHubIssuesClient` +- New function `*ClientFactory.NewOperationResultsClient() *OperationResultsClient` +- New function `*ClientFactory.NewOperationStatusesClient() *OperationStatusesClient` +- New function `*ClientFactory.NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient` +- New function `*ClientFactory.NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient` +- New function `*ClientFactory.NewPrivateLinksClient() *PrivateLinksClient` +- New function `*ClientFactory.NewSQLVulnerabilityAssessmentSettingsClient() *SQLVulnerabilityAssessmentSettingsClient` +- New function `*ClientFactory.NewStandardAssignmentsClient() *StandardAssignmentsClient` +- New function `*ClientFactory.NewStandardsClient() *StandardsClient` +- New function `*CspmMonitorDockerHubOffering.GetCloudOffering() *CloudOffering` +- New function `*CspmMonitorJFrogOffering.GetCloudOffering() *CloudOffering` +- New function `NewCustomRecommendationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomRecommendationsClient, error)` +- New function `*CustomRecommendationsClient.CreateOrUpdate(ctx context.Context, scope string, customRecommendationName string, customRecommendationBody CustomRecommendation, options *CustomRecommendationsClientCreateOrUpdateOptions) (CustomRecommendationsClientCreateOrUpdateResponse, error)` +- New function `*CustomRecommendationsClient.Delete(ctx context.Context, scope string, customRecommendationName string, options *CustomRecommendationsClientDeleteOptions) (CustomRecommendationsClientDeleteResponse, error)` +- New function `*CustomRecommendationsClient.Get(ctx context.Context, scope string, customRecommendationName string, options *CustomRecommendationsClientGetOptions) (CustomRecommendationsClientGetResponse, error)` +- New function `*CustomRecommendationsClient.NewListPager(scope string, options *CustomRecommendationsClientListOptions) *runtime.Pager[CustomRecommendationsClientListResponse]` +- New function `*DefenderCspmDockerHubOffering.GetCloudOffering() *CloudOffering` +- New function `*DefenderCspmJFrogOffering.GetCloudOffering() *CloudOffering` +- New function `*DefenderForContainersDockerHubOffering.GetCloudOffering() *CloudOffering` +- New function `*DefenderForContainersJFrogOffering.GetCloudOffering() *CloudOffering` +- New function `*DefenderForStorageClient.CancelMalwareScan(ctx context.Context, resourceID string, settingName SettingName, scanID string, options *DefenderForStorageClientCancelMalwareScanOptions) (DefenderForStorageClientCancelMalwareScanResponse, error)` +- New function `*DefenderForStorageClient.GetMalwareScan(ctx context.Context, resourceID string, settingName SettingName, scanID string, options *DefenderForStorageClientGetMalwareScanOptions) (DefenderForStorageClientGetMalwareScanResponse, error)` +- New function `*DefenderForStorageClient.NewListPager(resourceID string, options *DefenderForStorageClientListOptions) *runtime.Pager[DefenderForStorageClientListResponse]` +- New function `*DefenderForStorageClient.StartMalwareScan(ctx context.Context, resourceID string, settingName SettingName, options *DefenderForStorageClientStartMalwareScanOptions) (DefenderForStorageClientStartMalwareScanResponse, error)` +- New function `*DockerHubEnvironmentData.GetEnvironmentData() *EnvironmentData` +- New function `NewGitHubIssuesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GitHubIssuesClient, error)` +- New function `*GitHubIssuesClient.BeginCreate(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, repoName string, options *GitHubIssuesClientBeginCreateOptions) (*runtime.Poller[GitHubIssuesClientCreateResponse], error)` +- New function `*JFrogEnvironmentData.GetEnvironmentData() *EnvironmentData` +- New function `NewOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationResultsClient, error)` +- New function `*OperationResultsClient.Get(ctx context.Context, location string, operationID string, options *OperationResultsClientGetOptions) (OperationResultsClientGetResponse, error)` +- New function `NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusesClient, error)` +- New function `*OperationStatusesClient.Get(ctx context.Context, location string, operationID string, options *OperationStatusesClientGetOptions) (OperationStatusesClientGetResponse, error)` +- New function `PossibleStandardSupportedCloudValues() []StandardSupportedCloud` +- New function `NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error)` +- New function `*PrivateEndpointConnectionsClient.BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, privateEndpointConnectionName string, properties PrivateEndpointConnectionProperties, privateLinkName PrivateLinkParameters, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error)` +- New function `*PrivateEndpointConnectionsClient.BeginDelete(ctx context.Context, resourceGroupName string, privateEndpointConnectionName string, privateLinkName PrivateLinkParameters, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error)` +- New function `*PrivateEndpointConnectionsClient.Get(ctx context.Context, resourceGroupName string, privateEndpointConnectionName string, privateLinkName PrivateLinkParameters, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error)` +- New function `*PrivateEndpointConnectionsClient.NewListPager(resourceGroupName string, privateLinkName PrivateLinkParameters, options *PrivateEndpointConnectionsClientListOptions) *runtime.Pager[PrivateEndpointConnectionsClientListResponse]` +- New function `NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error)` +- New function `*PrivateLinkResourcesClient.Get(ctx context.Context, resourceGroupName string, groupID string, privateLinkName PrivateLinkParameters, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error)` +- New function `*PrivateLinkResourcesClient.NewListPager(resourceGroupName string, privateLinkName PrivateLinkParameters, options *PrivateLinkResourcesClientListOptions) *runtime.Pager[PrivateLinkResourcesClientListResponse]` +- New function `NewPrivateLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinksClient, error)` +- New function `*PrivateLinksClient.BeginCreate(ctx context.Context, resourceGroupName string, privateLink PrivateLinkResource, privateLinkName PrivateLinkParameters, options *PrivateLinksClientBeginCreateOptions) (*runtime.Poller[PrivateLinksClientCreateResponse], error)` +- New function `*PrivateLinksClient.BeginDelete(ctx context.Context, resourceGroupName string, privateLinkName PrivateLinkParameters, options *PrivateLinksClientBeginDeleteOptions) (*runtime.Poller[PrivateLinksClientDeleteResponse], error)` +- New function `*PrivateLinksClient.Get(ctx context.Context, resourceGroupName string, privateLinkName PrivateLinkParameters, options *PrivateLinksClientGetOptions) (PrivateLinksClientGetResponse, error)` +- New function `*PrivateLinksClient.Head(ctx context.Context, resourceGroupName string, privateLinkName PrivateLinkParameters, options *PrivateLinksClientHeadOptions) (PrivateLinksClientHeadResponse, error)` +- New function `*PrivateLinksClient.NewListBySubscriptionPager(options *PrivateLinksClientListBySubscriptionOptions) *runtime.Pager[PrivateLinksClientListBySubscriptionResponse]` +- New function `*PrivateLinksClient.NewListPager(resourceGroupName string, options *PrivateLinksClientListOptions) *runtime.Pager[PrivateLinksClientListResponse]` +- New function `*PrivateLinksClient.Update(ctx context.Context, resourceGroupName string, privateLink PrivateLinkUpdate, privateLinkName PrivateLinkParameters, options *PrivateLinksClientUpdateOptions) (PrivateLinksClientUpdateResponse, error)` +- New function `*SQLVulnerabilityAssessmentScansClient.GetScanOperationResult(ctx context.Context, resourceID string, operationID string, options *SQLVulnerabilityAssessmentScansClientGetScanOperationResultOptions) (SQLVulnerabilityAssessmentScansClientGetScanOperationResultResponse, error)` +- New function `*SQLVulnerabilityAssessmentScansClient.BeginInitiateScan(ctx context.Context, resourceID string, options *SQLVulnerabilityAssessmentScansClientBeginInitiateScanOptions) (*runtime.Poller[SQLVulnerabilityAssessmentScansClientInitiateScanResponse], error)` +- New function `NewSQLVulnerabilityAssessmentSettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLVulnerabilityAssessmentSettingsClient, error)` +- New function `*SQLVulnerabilityAssessmentSettingsClient.CreateOrUpdate(ctx context.Context, resourceID string, body SQLVulnerabilityAssessmentSettings, options *SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateOptions) (SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateResponse, error)` +- New function `*SQLVulnerabilityAssessmentSettingsClient.Delete(ctx context.Context, resourceID string, options *SQLVulnerabilityAssessmentSettingsClientDeleteOptions) (SQLVulnerabilityAssessmentSettingsClientDeleteResponse, error)` +- New function `*SQLVulnerabilityAssessmentSettingsClient.Get(ctx context.Context, resourceID string, options *SQLVulnerabilityAssessmentSettingsClientGetOptions) (SQLVulnerabilityAssessmentSettingsClientGetResponse, error)` +- New function `NewStandardAssignmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*StandardAssignmentsClient, error)` +- New function `*StandardAssignmentsClient.Create(ctx context.Context, resourceID string, standardAssignmentName string, standardAssignment StandardAssignment, options *StandardAssignmentsClientCreateOptions) (StandardAssignmentsClientCreateResponse, error)` +- New function `*StandardAssignmentsClient.Delete(ctx context.Context, resourceID string, standardAssignmentName string, options *StandardAssignmentsClientDeleteOptions) (StandardAssignmentsClientDeleteResponse, error)` +- New function `*StandardAssignmentsClient.Get(ctx context.Context, resourceID string, standardAssignmentName string, options *StandardAssignmentsClientGetOptions) (StandardAssignmentsClientGetResponse, error)` +- New function `*StandardAssignmentsClient.NewListPager(scope string, options *StandardAssignmentsClientListOptions) *runtime.Pager[StandardAssignmentsClientListResponse]` +- New function `NewStandardsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*StandardsClient, error)` +- New function `*StandardsClient.CreateOrUpdate(ctx context.Context, resourceGroupName string, standardID string, standard Standard, options *StandardsClientCreateOrUpdateOptions) (StandardsClientCreateOrUpdateResponse, error)` +- New function `*StandardsClient.Delete(ctx context.Context, resourceGroupName string, standardID string, options *StandardsClientDeleteOptions) (StandardsClientDeleteResponse, error)` +- New function `*StandardsClient.Get(ctx context.Context, resourceGroupName string, standardID string, options *StandardsClientGetOptions) (StandardsClientGetResponse, error)` +- New function `*StandardsClient.NewListBySubscriptionPager(options *StandardsClientListBySubscriptionOptions) *runtime.Pager[StandardsClientListBySubscriptionResponse]` +- New function `*StandardsClient.NewListPager(resourceGroupName string, options *StandardsClientListOptions) *runtime.Pager[StandardsClientListResponse]` +- New struct `AccessTokenAuthentication` +- New struct `AgentlessConfiguration` +- New struct `ArmPrivateEndpointConnection` +- New struct `ArmSecurityStandard` +- New struct `ArmSecurityStandardProperties` +- New struct `AssessmentPropertiesBaseRisk` +- New struct `AssessmentPropertiesBaseRiskPathsItem` +- New struct `AssessmentPropertiesBaseRiskPathsItemEdgeItem` +- New struct `AssessmentPropertiesBaseRiskPathsItemNodesItem` +- New struct `AssignedAssessmentItem` +- New struct `AssignedComponentItem` +- New struct `AssignedStandardItem` +- New struct `Assignment` +- New struct `AssignmentList` +- New struct `AssignmentProperties` +- New struct `AssignmentPropertiesAdditionalData` +- New struct `AttestationEvidence` +- New struct `BlobsScanSummary` +- New struct `CspmMonitorDockerHubOffering` +- New struct `CspmMonitorJFrogOffering` +- New struct `CustomRecommendation` +- New struct `CustomRecommendationProperties` +- New struct `CustomRecommendationsList` +- New struct `DefenderCspmDockerHubOffering` +- New struct `DefenderCspmJFrogOffering` +- New struct `DefenderCspmJFrogOfferingMdcContainersImageAssessment` +- New struct `DefenderForContainersDockerHubOffering` +- New struct `DefenderForContainersJFrogOffering` +- New struct `DefenderForStorageSettingList` +- New struct `DevOpsCapability` +- New struct `DockerHubEnvironmentData` +- New struct `FilesScanSummary` +- New struct `InventoryList` +- New struct `IssueCreationRequest` +- New struct `JFrogEnvironmentData` +- New struct `MalwareScan` +- New struct `MalwareScanProperties` +- New struct `OnUploadFilters` +- New struct `OperationListResult` +- New struct `OperationResult` +- New struct `PartialAssessmentProperties` +- New struct `PrivateEndpoint` +- New struct `PrivateEndpointConnection` +- New struct `PrivateEndpointConnectionListResult` +- New struct `PrivateEndpointConnectionProperties` +- New struct `PrivateLinkGroupResource` +- New struct `PrivateLinkGroupResourceListResult` +- New struct `PrivateLinkParameters` +- New struct `PrivateLinkProperties` +- New struct `PrivateLinkResource` +- New struct `PrivateLinkResourceProperties` +- New struct `PrivateLinkServiceConnectionState` +- New struct `PrivateLinkUpdate` +- New struct `PrivateLinksList` +- New struct `SQLVulnerabilityAssessmentScanOperationResult` +- New struct `SQLVulnerabilityAssessmentScanOperationResultProperties` +- New struct `SQLVulnerabilityAssessmentSettings` +- New struct `SQLVulnerabilityAssessmentSettingsProperties` +- New struct `ScanPropertiesV2` +- New struct `ScanSummary` +- New struct `ScanV2` +- New struct `ScansV2` +- New struct `ServerVulnerabilityAssessmentsSettingProperties` +- New struct `SettingProperties` +- New struct `Standard` +- New struct `StandardAssignment` +- New struct `StandardAssignmentMetadata` +- New struct `StandardAssignmentProperties` +- New struct `StandardAssignmentPropertiesAttestationData` +- New struct `StandardAssignmentPropertiesExemptionData` +- New struct `StandardAssignmentsList` +- New struct `StandardComponentProperties` +- New struct `StandardList` +- New struct `StandardMetadata` +- New struct `StandardProperties` +- New struct `Status` +- New field `SystemData` in struct `AADExternalSecuritySolution` +- New field `SystemData` in struct `APICollection` +- New field `SystemData` in struct `AdvancedThreatProtectionSetting` +- New field `SystemData` in struct `Alert` +- New field `SystemData` in struct `AlertSyncSettings` +- New field `SystemData` in struct `AlertsSuppressionRule` +- New field `SystemData` in struct `AllowedConnectionsResource` +- New field `SystemData` in struct `Application` +- New field `SystemData` in struct `AscLocation` +- New field `SystemData` in struct `Assessment` +- New field `SystemData` in struct `AssessmentMetadataResponse` +- New field `Risk` in struct `AssessmentProperties` +- New field `Risk` in struct `AssessmentPropertiesResponse` +- New field `SystemData` in struct `AssessmentResponse` +- New field `SystemData` in struct `AtaExternalSecuritySolution` +- New field `SystemData` in struct `AutoProvisioningSetting` +- New field `SystemData` in struct `Automation` +- New field `SystemData` in struct `CefExternalSecuritySolution` +- New field `SystemData` in struct `Compliance` +- New field `SystemData` in struct `ComplianceResult` +- New field `SystemData` in struct `Contact` +- New field `SystemData` in struct `DataExportSettings` +- New field `SystemData` in struct `DefenderForStorageSetting` +- New field `AgentlessConfiguration`, `Capabilities` in struct `DevOpsConfigurationProperties` +- New field `SystemData` in struct `DeviceSecurityGroup` +- New field `SystemData` in struct `DiscoveredSecuritySolution` +- New field `Properties`, `SystemData` in struct `ExternalSecuritySolution` +- New field `SystemData` in struct `GetSensitivitySettingsResponse` +- New field `SystemData` in struct `GovernanceAssignment` +- New field `SystemData` in struct `GovernanceRule` +- New anonymous field `OperationResult` in struct `GovernanceRulesClientOperationResultsResponse` +- New field `SystemData` in struct `HealthReport` +- New field `SystemData` in struct `InformationProtectionPolicy` +- New field `SystemData` in struct `IoTSecurityAggregatedAlert` +- New field `SystemData` in struct `IoTSecurityAggregatedRecommendation` +- New field `SystemData` in struct `IoTSecuritySolutionAnalyticsModel` +- New field `SystemData` in struct `JitNetworkAccessPolicy` +- New field `AutomatedResponse`, `BlobScanResultsOptions` in struct `MalwareScanningProperties` +- New field `SystemData` in struct `MdeOnboardingData` +- New field `Filters` in struct `OnUploadProperties` +- New field `ActionType`, `IsDataAction` in struct `Operation` +- New field `ResourceID` in struct `OperationStatusResult` +- New anonymous field `OperationListResult` in struct `OperationsClientListResponse` +- New field `SystemData` in struct `OperatorResource` +- New field `SystemData` in struct `Pricing` +- New field `SystemData` in struct `RegulatoryComplianceAssessment` +- New field `SystemData` in struct `RegulatoryComplianceControl` +- New field `SystemData` in struct `RegulatoryComplianceStandard` +- New field `ConnectorID`, `ID` in struct `ResourceDetails` +- New field `SystemData` in struct `RuleResults` +- New field `LatestScan` in struct `RuleResultsProperties` +- New field `NextLink` in struct `RulesResults` +- New field `DatabaseName` in struct `SQLVulnerabilityAssessmentBaselineRulesClientAddOptions` +- New field `DatabaseName` in struct `SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions` +- New field `DatabaseName` in struct `SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions` +- New field `DatabaseName` in struct `SQLVulnerabilityAssessmentBaselineRulesClientGetOptions` +- New field `DatabaseName` in struct `SQLVulnerabilityAssessmentScanResultsClientGetOptions` +- New field `DatabaseName` in struct `SQLVulnerabilityAssessmentScansClientGetOptions` +- New anonymous field `ScanV2` in struct `SQLVulnerabilityAssessmentScansClientGetResponse` +- New field `SystemData` in struct `ScanResult` +- New field `NextLink` in struct `ScanResults` +- New field `SystemData` in struct `SecureScoreControlDefinitionItem` +- New field `SystemData` in struct `SecureScoreControlDetails` +- New field `SystemData` in struct `SecureScoreItem` +- New field `SystemData` in struct `ServerVulnerabilityAssessment` +- New field `Properties` in struct `ServerVulnerabilityAssessmentsSetting` +- New field `Properties`, `SystemData` in struct `Setting` +- New field `SystemData` in struct `Solution` +- New field `SystemData` in struct `SolutionsReferenceData` +- New field `SystemData` in struct `SubAssessment` +- New field `SystemData` in struct `Task` +- New field `SystemData` in struct `TopologyResource` +- New field `SystemData` in struct `WorkspaceSetting` + + ## 0.14.0 (2024-04-04) ### Breaking Changes diff --git a/sdk/resourcemanager/security/armsecurity/accountconnectors_client.go b/sdk/resourcemanager/security/armsecurity/accountconnectors_client.go deleted file mode 100644 index 08e265b97b65..000000000000 --- a/sdk/resourcemanager/security/armsecurity/accountconnectors_client.go +++ /dev/null @@ -1,271 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurity - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// AccountConnectorsClient contains the methods for the AccountConnectors group. -// Don't use this type directly, use NewAccountConnectorsClient() instead. -type AccountConnectorsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAccountConnectorsClient creates a new instance of AccountConnectorsClient 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 NewAccountConnectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AccountConnectorsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AccountConnectorsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// CreateOrUpdate - Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use -// either account credentials or role-based authentication. For GCP, use account organization -// credentials. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01-preview -// - connectorName - Name of the cloud account connector -// - connectorSetting - Settings for the cloud account connector -// - options - AccountConnectorsClientCreateOrUpdateOptions contains the optional parameters for the AccountConnectorsClient.CreateOrUpdate -// method. -func (client *AccountConnectorsClient) CreateOrUpdate(ctx context.Context, connectorName string, connectorSetting ConnectorSetting, options *AccountConnectorsClientCreateOrUpdateOptions) (AccountConnectorsClientCreateOrUpdateResponse, error) { - var err error - const operationName = "AccountConnectorsClient.CreateOrUpdate" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, connectorName, connectorSetting, options) - if err != nil { - return AccountConnectorsClientCreateOrUpdateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AccountConnectorsClientCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AccountConnectorsClientCreateOrUpdateResponse{}, err - } - resp, err := client.createOrUpdateHandleResponse(httpResp) - return resp, err -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AccountConnectorsClient) createOrUpdateCreateRequest(ctx context.Context, connectorName string, connectorSetting ConnectorSetting, options *AccountConnectorsClientCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if connectorName == "" { - return nil, errors.New("parameter connectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, connectorSetting); err != nil { - return nil, err - } - return req, nil -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *AccountConnectorsClient) createOrUpdateHandleResponse(resp *http.Response) (AccountConnectorsClientCreateOrUpdateResponse, error) { - result := AccountConnectorsClientCreateOrUpdateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ConnectorSetting); err != nil { - return AccountConnectorsClientCreateOrUpdateResponse{}, err - } - return result, nil -} - -// Delete - Delete a cloud account connector from a subscription -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01-preview -// - connectorName - Name of the cloud account connector -// - options - AccountConnectorsClientDeleteOptions contains the optional parameters for the AccountConnectorsClient.Delete -// method. -func (client *AccountConnectorsClient) Delete(ctx context.Context, connectorName string, options *AccountConnectorsClientDeleteOptions) (AccountConnectorsClientDeleteResponse, error) { - var err error - const operationName = "AccountConnectorsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, connectorName, options) - if err != nil { - return AccountConnectorsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AccountConnectorsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AccountConnectorsClientDeleteResponse{}, err - } - return AccountConnectorsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *AccountConnectorsClient) deleteCreateRequest(ctx context.Context, connectorName string, options *AccountConnectorsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if connectorName == "" { - return nil, errors.New("parameter connectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-01-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Details of a specific cloud account connector -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01-preview -// - connectorName - Name of the cloud account connector -// - options - AccountConnectorsClientGetOptions contains the optional parameters for the AccountConnectorsClient.Get method. -func (client *AccountConnectorsClient) Get(ctx context.Context, connectorName string, options *AccountConnectorsClientGetOptions) (AccountConnectorsClientGetResponse, error) { - var err error - const operationName = "AccountConnectorsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, connectorName, options) - if err != nil { - return AccountConnectorsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AccountConnectorsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AccountConnectorsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AccountConnectorsClient) getCreateRequest(ctx context.Context, connectorName string, options *AccountConnectorsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors/{connectorName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if connectorName == "" { - return nil, errors.New("parameter connectorName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{connectorName}", url.PathEscape(connectorName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-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 *AccountConnectorsClient) getHandleResponse(resp *http.Response) (AccountConnectorsClientGetResponse, error) { - result := AccountConnectorsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ConnectorSetting); err != nil { - return AccountConnectorsClientGetResponse{}, err - } - return result, nil -} - -// NewListPager - Cloud accounts connectors of a subscription -// -// Generated from API version 2020-01-01-preview -// - options - AccountConnectorsClientListOptions contains the optional parameters for the AccountConnectorsClient.NewListPager -// method. -func (client *AccountConnectorsClient) NewListPager(options *AccountConnectorsClientListOptions) *runtime.Pager[AccountConnectorsClientListResponse] { - return runtime.NewPager(runtime.PagingHandler[AccountConnectorsClientListResponse]{ - More: func(page AccountConnectorsClientListResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AccountConnectorsClientListResponse) (AccountConnectorsClientListResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AccountConnectorsClient.NewListPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listCreateRequest(ctx, options) - }, nil) - if err != nil { - return AccountConnectorsClientListResponse{}, err - } - return client.listHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listCreateRequest creates the List request. -func (client *AccountConnectorsClient) listCreateRequest(ctx context.Context, options *AccountConnectorsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/connectors" - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-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 *AccountConnectorsClient) listHandleResponse(resp *http.Response) (AccountConnectorsClientListResponse, error) { - result := AccountConnectorsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.ConnectorSettingList); err != nil { - return AccountConnectorsClientListResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client.go b/sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client.go deleted file mode 100644 index c69a8b9024de..000000000000 --- a/sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client.go +++ /dev/null @@ -1,291 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurity - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strconv" - "strings" -) - -// AdaptiveApplicationControlsClient contains the methods for the AdaptiveApplicationControls group. -// Don't use this type directly, use NewAdaptiveApplicationControlsClient() instead. -type AdaptiveApplicationControlsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAdaptiveApplicationControlsClient creates a new instance of AdaptiveApplicationControlsClient 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 NewAdaptiveApplicationControlsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AdaptiveApplicationControlsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AdaptiveApplicationControlsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Delete - Delete an application control machine group -// 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 -// - groupName - Name of an application control machine group -// - options - AdaptiveApplicationControlsClientDeleteOptions contains the optional parameters for the AdaptiveApplicationControlsClient.Delete -// method. -func (client *AdaptiveApplicationControlsClient) Delete(ctx context.Context, ascLocation string, groupName string, options *AdaptiveApplicationControlsClientDeleteOptions) (AdaptiveApplicationControlsClientDeleteResponse, error) { - var err error - const operationName = "AdaptiveApplicationControlsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, ascLocation, groupName, options) - if err != nil { - return AdaptiveApplicationControlsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AdaptiveApplicationControlsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return AdaptiveApplicationControlsClientDeleteResponse{}, err - } - return AdaptiveApplicationControlsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *AdaptiveApplicationControlsClient) deleteCreateRequest(ctx context.Context, ascLocation string, groupName string, options *AdaptiveApplicationControlsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}" - 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 groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets an application control VM/server group. -// 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 -// - groupName - Name of an application control machine group -// - options - AdaptiveApplicationControlsClientGetOptions contains the optional parameters for the AdaptiveApplicationControlsClient.Get -// method. -func (client *AdaptiveApplicationControlsClient) Get(ctx context.Context, ascLocation string, groupName string, options *AdaptiveApplicationControlsClientGetOptions) (AdaptiveApplicationControlsClientGetResponse, error) { - var err error - const operationName = "AdaptiveApplicationControlsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, ascLocation, groupName, options) - if err != nil { - return AdaptiveApplicationControlsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AdaptiveApplicationControlsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AdaptiveApplicationControlsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AdaptiveApplicationControlsClient) getCreateRequest(ctx context.Context, ascLocation string, groupName string, options *AdaptiveApplicationControlsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}" - 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 groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AdaptiveApplicationControlsClient) getHandleResponse(resp *http.Response) (AdaptiveApplicationControlsClientGetResponse, error) { - result := AdaptiveApplicationControlsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AdaptiveApplicationControlGroup); err != nil { - return AdaptiveApplicationControlsClientGetResponse{}, err - } - return result, nil -} - -// List - Gets a list of application control machine groups for the subscription. -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01 -// - options - AdaptiveApplicationControlsClientListOptions contains the optional parameters for the AdaptiveApplicationControlsClient.List -// method. -func (client *AdaptiveApplicationControlsClient) List(ctx context.Context, options *AdaptiveApplicationControlsClientListOptions) (AdaptiveApplicationControlsClientListResponse, error) { - var err error - const operationName = "AdaptiveApplicationControlsClient.List" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listCreateRequest(ctx, options) - if err != nil { - return AdaptiveApplicationControlsClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AdaptiveApplicationControlsClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AdaptiveApplicationControlsClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err -} - -// listCreateRequest creates the List request. -func (client *AdaptiveApplicationControlsClient) listCreateRequest(ctx context.Context, options *AdaptiveApplicationControlsClientListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applicationWhitelistings" - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-01-01") - if options != nil && options.IncludePathRecommendations != nil { - reqQP.Set("includePathRecommendations", strconv.FormatBool(*options.IncludePathRecommendations)) - } - if options != nil && options.Summary != nil { - reqQP.Set("summary", strconv.FormatBool(*options.Summary)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listHandleResponse handles the List response. -func (client *AdaptiveApplicationControlsClient) listHandleResponse(resp *http.Response) (AdaptiveApplicationControlsClientListResponse, error) { - result := AdaptiveApplicationControlsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AdaptiveApplicationControlGroups); err != nil { - return AdaptiveApplicationControlsClientListResponse{}, err - } - return result, nil -} - -// Put - Update an application control machine group -// 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 -// - groupName - Name of an application control machine group -// - options - AdaptiveApplicationControlsClientPutOptions contains the optional parameters for the AdaptiveApplicationControlsClient.Put -// method. -func (client *AdaptiveApplicationControlsClient) Put(ctx context.Context, ascLocation string, groupName string, body AdaptiveApplicationControlGroup, options *AdaptiveApplicationControlsClientPutOptions) (AdaptiveApplicationControlsClientPutResponse, error) { - var err error - const operationName = "AdaptiveApplicationControlsClient.Put" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.putCreateRequest(ctx, ascLocation, groupName, body, options) - if err != nil { - return AdaptiveApplicationControlsClientPutResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AdaptiveApplicationControlsClientPutResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AdaptiveApplicationControlsClientPutResponse{}, err - } - resp, err := client.putHandleResponse(httpResp) - return resp, err -} - -// putCreateRequest creates the Put request. -func (client *AdaptiveApplicationControlsClient) putCreateRequest(ctx context.Context, ascLocation string, groupName string, body AdaptiveApplicationControlGroup, options *AdaptiveApplicationControlsClientPutOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/applicationWhitelistings/{groupName}" - 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 groupName == "" { - return nil, errors.New("parameter groupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { - return nil, err - } - return req, nil -} - -// putHandleResponse handles the Put response. -func (client *AdaptiveApplicationControlsClient) putHandleResponse(resp *http.Response) (AdaptiveApplicationControlsClientPutResponse, error) { - result := AdaptiveApplicationControlsClientPutResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AdaptiveApplicationControlGroup); err != nil { - return AdaptiveApplicationControlsClientPutResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client.go b/sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client.go deleted file mode 100644 index 64fd3b3662ba..000000000000 --- a/sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client.go +++ /dev/null @@ -1,291 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurity - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// AdaptiveNetworkHardeningsClient contains the methods for the AdaptiveNetworkHardenings group. -// Don't use this type directly, use NewAdaptiveNetworkHardeningsClient() instead. -type AdaptiveNetworkHardeningsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewAdaptiveNetworkHardeningsClient creates a new instance of AdaptiveNetworkHardeningsClient 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 NewAdaptiveNetworkHardeningsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AdaptiveNetworkHardeningsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &AdaptiveNetworkHardeningsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// BeginEnforce - Enforces the given rules on the NSG(s) listed in the request -// 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. -// - resourceType - The type of the resource. -// - resourceName - Name of the resource. -// - adaptiveNetworkHardeningResourceName - The name of the Adaptive Network Hardening resource. -// - options - AdaptiveNetworkHardeningsClientBeginEnforceOptions contains the optional parameters for the AdaptiveNetworkHardeningsClient.BeginEnforce -// method. -func (client *AdaptiveNetworkHardeningsClient) BeginEnforce(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, adaptiveNetworkHardeningResourceName string, body AdaptiveNetworkHardeningEnforceRequest, options *AdaptiveNetworkHardeningsClientBeginEnforceOptions) (*runtime.Poller[AdaptiveNetworkHardeningsClientEnforceResponse], error) { - if options == nil || options.ResumeToken == "" { - resp, err := client.enforce(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName, body, options) - if err != nil { - return nil, err - } - poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AdaptiveNetworkHardeningsClientEnforceResponse]{ - Tracer: client.internal.Tracer(), - }) - return poller, err - } else { - return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[AdaptiveNetworkHardeningsClientEnforceResponse]{ - Tracer: client.internal.Tracer(), - }) - } -} - -// Enforce - Enforces the given rules on the NSG(s) listed in the request -// If the operation fails it returns an *azcore.ResponseError type. -// -// Generated from API version 2020-01-01 -func (client *AdaptiveNetworkHardeningsClient) enforce(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, adaptiveNetworkHardeningResourceName string, body AdaptiveNetworkHardeningEnforceRequest, options *AdaptiveNetworkHardeningsClientBeginEnforceOptions) (*http.Response, error) { - var err error - const operationName = "AdaptiveNetworkHardeningsClient.BeginEnforce" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.enforceCreateRequest(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName, body, options) - if err != nil { - return nil, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { - err = runtime.NewResponseError(httpResp) - return nil, err - } - return httpResp, nil -} - -// enforceCreateRequest creates the Enforce request. -func (client *AdaptiveNetworkHardeningsClient) enforceCreateRequest(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, adaptiveNetworkHardeningResourceName string, body AdaptiveNetworkHardeningEnforceRequest, options *AdaptiveNetworkHardeningsClientBeginEnforceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}/{adaptiveNetworkHardeningEnforceAction}" - 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 resourceNamespace == "" { - return nil, errors.New("parameter resourceNamespace cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceNamespace}", url.PathEscape(resourceNamespace)) - if resourceType == "" { - return nil, errors.New("parameter resourceType cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceType}", url.PathEscape(resourceType)) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - if adaptiveNetworkHardeningResourceName == "" { - return nil, errors.New("parameter adaptiveNetworkHardeningResourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{adaptiveNetworkHardeningResourceName}", url.PathEscape(adaptiveNetworkHardeningResourceName)) - urlPath = strings.ReplaceAll(urlPath, "{adaptiveNetworkHardeningEnforceAction}", url.PathEscape("enforce")) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, body); err != nil { - return nil, err - } - return req, nil -} - -// Get - Gets a single Adaptive Network Hardening 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. -// - resourceType - The type of the resource. -// - resourceName - Name of the resource. -// - adaptiveNetworkHardeningResourceName - The name of the Adaptive Network Hardening resource. -// - options - AdaptiveNetworkHardeningsClientGetOptions contains the optional parameters for the AdaptiveNetworkHardeningsClient.Get -// method. -func (client *AdaptiveNetworkHardeningsClient) Get(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, adaptiveNetworkHardeningResourceName string, options *AdaptiveNetworkHardeningsClientGetOptions) (AdaptiveNetworkHardeningsClientGetResponse, error) { - var err error - const operationName = "AdaptiveNetworkHardeningsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName, adaptiveNetworkHardeningResourceName, options) - if err != nil { - return AdaptiveNetworkHardeningsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return AdaptiveNetworkHardeningsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return AdaptiveNetworkHardeningsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *AdaptiveNetworkHardeningsClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, adaptiveNetworkHardeningResourceName string, options *AdaptiveNetworkHardeningsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings/{adaptiveNetworkHardeningResourceName}" - 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 resourceNamespace == "" { - return nil, errors.New("parameter resourceNamespace cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceNamespace}", url.PathEscape(resourceNamespace)) - if resourceType == "" { - return nil, errors.New("parameter resourceType cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceType}", url.PathEscape(resourceType)) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - if adaptiveNetworkHardeningResourceName == "" { - return nil, errors.New("parameter adaptiveNetworkHardeningResourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{adaptiveNetworkHardeningResourceName}", url.PathEscape(adaptiveNetworkHardeningResourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *AdaptiveNetworkHardeningsClient) getHandleResponse(resp *http.Response) (AdaptiveNetworkHardeningsClientGetResponse, error) { - result := AdaptiveNetworkHardeningsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AdaptiveNetworkHardening); err != nil { - return AdaptiveNetworkHardeningsClientGetResponse{}, err - } - return result, nil -} - -// NewListByExtendedResourcePager - Gets a list of Adaptive Network Hardenings resources in scope of an extended resource. -// -// 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. -// - resourceType - The type of the resource. -// - resourceName - Name of the resource. -// - options - AdaptiveNetworkHardeningsClientListByExtendedResourceOptions contains the optional parameters for the AdaptiveNetworkHardeningsClient.NewListByExtendedResourcePager -// method. -func (client *AdaptiveNetworkHardeningsClient) NewListByExtendedResourcePager(resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *AdaptiveNetworkHardeningsClientListByExtendedResourceOptions) *runtime.Pager[AdaptiveNetworkHardeningsClientListByExtendedResourceResponse] { - return runtime.NewPager(runtime.PagingHandler[AdaptiveNetworkHardeningsClientListByExtendedResourceResponse]{ - More: func(page AdaptiveNetworkHardeningsClientListByExtendedResourceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *AdaptiveNetworkHardeningsClientListByExtendedResourceResponse) (AdaptiveNetworkHardeningsClientListByExtendedResourceResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AdaptiveNetworkHardeningsClient.NewListByExtendedResourcePager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByExtendedResourceCreateRequest(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName, options) - }, nil) - if err != nil { - return AdaptiveNetworkHardeningsClientListByExtendedResourceResponse{}, err - } - return client.listByExtendedResourceHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByExtendedResourceCreateRequest creates the ListByExtendedResource request. -func (client *AdaptiveNetworkHardeningsClient) listByExtendedResourceCreateRequest(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *AdaptiveNetworkHardeningsClientListByExtendedResourceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/adaptiveNetworkHardenings" - 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 resourceNamespace == "" { - return nil, errors.New("parameter resourceNamespace cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceNamespace}", url.PathEscape(resourceNamespace)) - if resourceType == "" { - return nil, errors.New("parameter resourceType cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceType}", url.PathEscape(resourceType)) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2020-01-01") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByExtendedResourceHandleResponse handles the ListByExtendedResource response. -func (client *AdaptiveNetworkHardeningsClient) listByExtendedResourceHandleResponse(resp *http.Response) (AdaptiveNetworkHardeningsClientListByExtendedResourceResponse, error) { - result := AdaptiveNetworkHardeningsClientListByExtendedResourceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.AdaptiveNetworkHardeningsList); err != nil { - return AdaptiveNetworkHardeningsClientListByExtendedResourceResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/advancedthreatprotection_client.go b/sdk/resourcemanager/security/armsecurity/advancedthreatprotection_client.go index fc652ea8091c..657ffbdbd0b7 100644 --- a/sdk/resourcemanager/security/armsecurity/advancedthreatprotection_client.go +++ b/sdk/resourcemanager/security/armsecurity/advancedthreatprotection_client.go @@ -1,12 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. 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" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -24,7 +24,7 @@ type AdvancedThreatProtectionClient struct { // NewAdvancedThreatProtectionClient creates a new instance of AdvancedThreatProtectionClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewAdvancedThreatProtectionClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AdvancedThreatProtectionClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -40,7 +40,7 @@ func NewAdvancedThreatProtectionClient(credential azcore.TokenCredential, option // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-01-01 -// - resourceID - The identifier of the resource. +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. // - advancedThreatProtectionSetting - Advanced Threat Protection Settings // - options - AdvancedThreatProtectionClientCreateOptions contains the optional parameters for the AdvancedThreatProtectionClient.Create // method. @@ -67,8 +67,11 @@ func (client *AdvancedThreatProtectionClient) Create(ctx context.Context, resour } // createCreateRequest creates the Create request. -func (client *AdvancedThreatProtectionClient) createCreateRequest(ctx context.Context, resourceID string, advancedThreatProtectionSetting AdvancedThreatProtectionSetting, options *AdvancedThreatProtectionClientCreateOptions) (*policy.Request, error) { +func (client *AdvancedThreatProtectionClient) createCreateRequest(ctx context.Context, resourceID string, advancedThreatProtectionSetting AdvancedThreatProtectionSetting, _ *AdvancedThreatProtectionClientCreateOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) urlPath = strings.ReplaceAll(urlPath, "{settingName}", url.PathEscape("current")) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) @@ -79,6 +82,7 @@ func (client *AdvancedThreatProtectionClient) createCreateRequest(ctx context.Co reqQP.Set("api-version", "2019-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, advancedThreatProtectionSetting); err != nil { return nil, err } @@ -98,7 +102,7 @@ func (client *AdvancedThreatProtectionClient) createHandleResponse(resp *http.Re // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-01-01 -// - resourceID - The identifier of the resource. +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. // - options - AdvancedThreatProtectionClientGetOptions contains the optional parameters for the AdvancedThreatProtectionClient.Get // method. func (client *AdvancedThreatProtectionClient) Get(ctx context.Context, resourceID string, options *AdvancedThreatProtectionClientGetOptions) (AdvancedThreatProtectionClientGetResponse, error) { @@ -124,8 +128,11 @@ func (client *AdvancedThreatProtectionClient) Get(ctx context.Context, resourceI } // getCreateRequest creates the Get request. -func (client *AdvancedThreatProtectionClient) getCreateRequest(ctx context.Context, resourceID string, options *AdvancedThreatProtectionClientGetOptions) (*policy.Request, error) { +func (client *AdvancedThreatProtectionClient) getCreateRequest(ctx context.Context, resourceID string, _ *AdvancedThreatProtectionClientGetOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) urlPath = strings.ReplaceAll(urlPath, "{settingName}", url.PathEscape("current")) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) diff --git a/sdk/resourcemanager/security/armsecurity/alerts_client.go b/sdk/resourcemanager/security/armsecurity/alerts_client.go index f9cbb983db9e..818801cac37f 100644 --- a/sdk/resourcemanager/security/armsecurity/alerts_client.go +++ b/sdk/resourcemanager/security/armsecurity/alerts_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type AlertsClient struct { } // NewAlertsClient creates a new instance of AlertsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -44,7 +43,7 @@ func NewAlertsClient(subscriptionID string, credential azcore.TokenCredential, o // 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. +// - resourceGroupName - The name of the resource group. 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 - AlertsClientGetResourceGroupLevelOptions contains the optional parameters for the AlertsClient.GetResourceGroupLevel @@ -72,7 +71,7 @@ func (client *AlertsClient) GetResourceGroupLevel(ctx context.Context, resourceG } // getResourceGroupLevelCreateRequest creates the GetResourceGroupLevel request. -func (client *AlertsClient) getResourceGroupLevelCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientGetResourceGroupLevelOptions) (*policy.Request, error) { +func (client *AlertsClient) getResourceGroupLevelCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, _ *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") @@ -141,7 +140,7 @@ func (client *AlertsClient) GetSubscriptionLevel(ctx context.Context, ascLocatio } // getSubscriptionLevelCreateRequest creates the GetSubscriptionLevel request. -func (client *AlertsClient) getSubscriptionLevelCreateRequest(ctx context.Context, ascLocation string, alertName string, options *AlertsClientGetSubscriptionLevelOptions) (*policy.Request, error) { +func (client *AlertsClient) getSubscriptionLevelCreateRequest(ctx context.Context, ascLocation string, alertName string, _ *AlertsClientGetSubscriptionLevelOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -203,7 +202,7 @@ func (client *AlertsClient) NewListPager(options *AlertsClientListOptions) *runt } // listCreateRequest creates the List request. -func (client *AlertsClient) listCreateRequest(ctx context.Context, options *AlertsClientListOptions) (*policy.Request, error) { +func (client *AlertsClient) listCreateRequest(ctx context.Context, _ *AlertsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alerts" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -232,7 +231,7 @@ func (client *AlertsClient) listHandleResponse(resp *http.Response) (AlertsClien // NewListByResourceGroupPager - List all the alerts that are associated with the resource group // // Generated from API version 2022-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AlertsClientListByResourceGroupOptions contains the optional parameters for the AlertsClient.NewListByResourceGroupPager // method. func (client *AlertsClient) NewListByResourceGroupPager(resourceGroupName string, options *AlertsClientListByResourceGroupOptions) *runtime.Pager[AlertsClientListByResourceGroupResponse] { @@ -259,7 +258,7 @@ func (client *AlertsClient) NewListByResourceGroupPager(resourceGroupName string } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AlertsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AlertsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *AlertsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *AlertsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/alerts" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -294,7 +293,7 @@ func (client *AlertsClient) listByResourceGroupHandleResponse(resp *http.Respons // // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AlertsClientListResourceGroupLevelByRegionOptions contains the optional parameters for the AlertsClient.NewListResourceGroupLevelByRegionPager // method. func (client *AlertsClient) NewListResourceGroupLevelByRegionPager(ascLocation string, resourceGroupName string, options *AlertsClientListResourceGroupLevelByRegionOptions) *runtime.Pager[AlertsClientListResourceGroupLevelByRegionResponse] { @@ -321,7 +320,7 @@ func (client *AlertsClient) NewListResourceGroupLevelByRegionPager(ascLocation s } // listResourceGroupLevelByRegionCreateRequest creates the ListResourceGroupLevelByRegion request. -func (client *AlertsClient) listResourceGroupLevelByRegionCreateRequest(ctx context.Context, ascLocation string, resourceGroupName string, options *AlertsClientListResourceGroupLevelByRegionOptions) (*policy.Request, error) { +func (client *AlertsClient) listResourceGroupLevelByRegionCreateRequest(ctx context.Context, ascLocation string, resourceGroupName string, _ *AlertsClientListResourceGroupLevelByRegionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/alerts" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -386,7 +385,7 @@ func (client *AlertsClient) NewListSubscriptionLevelByRegionPager(ascLocation st } // listSubscriptionLevelByRegionCreateRequest creates the ListSubscriptionLevelByRegion request. -func (client *AlertsClient) listSubscriptionLevelByRegionCreateRequest(ctx context.Context, ascLocation string, options *AlertsClientListSubscriptionLevelByRegionOptions) (*policy.Request, error) { +func (client *AlertsClient) listSubscriptionLevelByRegionCreateRequest(ctx context.Context, ascLocation string, _ *AlertsClientListSubscriptionLevelByRegionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -421,7 +420,7 @@ func (client *AlertsClient) listSubscriptionLevelByRegionHandleResponse(resp *ht // // 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 +// - alertSimulatorRequestBody - The request body // - 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 == "" { @@ -467,7 +466,7 @@ func (client *AlertsClient) simulate(ctx context.Context, ascLocation string, al } // simulateCreateRequest creates the Simulate request. -func (client *AlertsClient) simulateCreateRequest(ctx context.Context, ascLocation string, alertSimulatorRequestBody AlertSimulatorRequestBody, options *AlertsClientBeginSimulateOptions) (*policy.Request, error) { +func (client *AlertsClient) simulateCreateRequest(ctx context.Context, ascLocation string, alertSimulatorRequestBody AlertSimulatorRequestBody, _ *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") @@ -484,7 +483,7 @@ func (client *AlertsClient) simulateCreateRequest(ctx context.Context, ascLocati 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"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, alertSimulatorRequestBody); err != nil { return nil, err } @@ -495,7 +494,7 @@ func (client *AlertsClient) simulateCreateRequest(ctx context.Context, ascLocati // 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. +// - resourceGroupName - The name of the resource group. 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 - AlertsClientUpdateResourceGroupLevelStateToActivateOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToActivate @@ -522,7 +521,7 @@ func (client *AlertsClient) UpdateResourceGroupLevelStateToActivate(ctx context. } // updateResourceGroupLevelStateToActivateCreateRequest creates the UpdateResourceGroupLevelStateToActivate request. -func (client *AlertsClient) updateResourceGroupLevelStateToActivateCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToActivateOptions) (*policy.Request, error) { +func (client *AlertsClient) updateResourceGroupLevelStateToActivateCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, _ *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") @@ -547,7 +546,6 @@ func (client *AlertsClient) updateResourceGroupLevelStateToActivateCreateRequest 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 } @@ -555,7 +553,7 @@ func (client *AlertsClient) updateResourceGroupLevelStateToActivateCreateRequest // 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. +// - resourceGroupName - The name of the resource group. 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 - AlertsClientUpdateResourceGroupLevelStateToDismissOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToDismiss @@ -582,7 +580,7 @@ func (client *AlertsClient) UpdateResourceGroupLevelStateToDismiss(ctx context.C } // updateResourceGroupLevelStateToDismissCreateRequest creates the UpdateResourceGroupLevelStateToDismiss request. -func (client *AlertsClient) updateResourceGroupLevelStateToDismissCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToDismissOptions) (*policy.Request, error) { +func (client *AlertsClient) updateResourceGroupLevelStateToDismissCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, _ *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") @@ -607,7 +605,6 @@ func (client *AlertsClient) updateResourceGroupLevelStateToDismissCreateRequest( 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 } @@ -615,7 +612,7 @@ func (client *AlertsClient) updateResourceGroupLevelStateToDismissCreateRequest( // 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. +// - resourceGroupName - The name of the resource group. 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 @@ -642,7 +639,7 @@ func (client *AlertsClient) UpdateResourceGroupLevelStateToInProgress(ctx contex } // updateResourceGroupLevelStateToInProgressCreateRequest creates the UpdateResourceGroupLevelStateToInProgress request. -func (client *AlertsClient) updateResourceGroupLevelStateToInProgressCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToInProgressOptions) (*policy.Request, error) { +func (client *AlertsClient) updateResourceGroupLevelStateToInProgressCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, _ *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") @@ -667,7 +664,6 @@ func (client *AlertsClient) updateResourceGroupLevelStateToInProgressCreateReque 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 } @@ -675,7 +671,7 @@ func (client *AlertsClient) updateResourceGroupLevelStateToInProgressCreateReque // 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. +// - resourceGroupName - The name of the resource group. 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 - AlertsClientUpdateResourceGroupLevelStateToResolveOptions contains the optional parameters for the AlertsClient.UpdateResourceGroupLevelStateToResolve @@ -702,7 +698,7 @@ func (client *AlertsClient) UpdateResourceGroupLevelStateToResolve(ctx context.C } // updateResourceGroupLevelStateToResolveCreateRequest creates the UpdateResourceGroupLevelStateToResolve request. -func (client *AlertsClient) updateResourceGroupLevelStateToResolveCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, options *AlertsClientUpdateResourceGroupLevelStateToResolveOptions) (*policy.Request, error) { +func (client *AlertsClient) updateResourceGroupLevelStateToResolveCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, alertName string, _ *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") @@ -727,7 +723,6 @@ func (client *AlertsClient) updateResourceGroupLevelStateToResolveCreateRequest( 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 } @@ -761,7 +756,7 @@ func (client *AlertsClient) UpdateSubscriptionLevelStateToActivate(ctx context.C } // updateSubscriptionLevelStateToActivateCreateRequest creates the UpdateSubscriptionLevelStateToActivate request. -func (client *AlertsClient) updateSubscriptionLevelStateToActivateCreateRequest(ctx context.Context, ascLocation string, alertName string, options *AlertsClientUpdateSubscriptionLevelStateToActivateOptions) (*policy.Request, error) { +func (client *AlertsClient) updateSubscriptionLevelStateToActivateCreateRequest(ctx context.Context, ascLocation string, alertName string, _ *AlertsClientUpdateSubscriptionLevelStateToActivateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/activate" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -782,7 +777,6 @@ func (client *AlertsClient) updateSubscriptionLevelStateToActivateCreateRequest( 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 } @@ -816,7 +810,7 @@ func (client *AlertsClient) UpdateSubscriptionLevelStateToDismiss(ctx context.Co } // updateSubscriptionLevelStateToDismissCreateRequest creates the UpdateSubscriptionLevelStateToDismiss request. -func (client *AlertsClient) updateSubscriptionLevelStateToDismissCreateRequest(ctx context.Context, ascLocation string, alertName string, options *AlertsClientUpdateSubscriptionLevelStateToDismissOptions) (*policy.Request, error) { +func (client *AlertsClient) updateSubscriptionLevelStateToDismissCreateRequest(ctx context.Context, ascLocation string, alertName string, _ *AlertsClientUpdateSubscriptionLevelStateToDismissOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/dismiss" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -837,7 +831,6 @@ func (client *AlertsClient) updateSubscriptionLevelStateToDismissCreateRequest(c 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 } @@ -871,7 +864,7 @@ func (client *AlertsClient) UpdateSubscriptionLevelStateToInProgress(ctx context } // updateSubscriptionLevelStateToInProgressCreateRequest creates the UpdateSubscriptionLevelStateToInProgress request. -func (client *AlertsClient) updateSubscriptionLevelStateToInProgressCreateRequest(ctx context.Context, ascLocation string, alertName string, options *AlertsClientUpdateSubscriptionLevelStateToInProgressOptions) (*policy.Request, error) { +func (client *AlertsClient) updateSubscriptionLevelStateToInProgressCreateRequest(ctx context.Context, ascLocation string, alertName string, _ *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") @@ -892,7 +885,6 @@ func (client *AlertsClient) updateSubscriptionLevelStateToInProgressCreateReques 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 } @@ -926,7 +918,7 @@ func (client *AlertsClient) UpdateSubscriptionLevelStateToResolve(ctx context.Co } // updateSubscriptionLevelStateToResolveCreateRequest creates the UpdateSubscriptionLevelStateToResolve request. -func (client *AlertsClient) updateSubscriptionLevelStateToResolveCreateRequest(ctx context.Context, ascLocation string, alertName string, options *AlertsClientUpdateSubscriptionLevelStateToResolveOptions) (*policy.Request, error) { +func (client *AlertsClient) updateSubscriptionLevelStateToResolveCreateRequest(ctx context.Context, ascLocation string, alertName string, _ *AlertsClientUpdateSubscriptionLevelStateToResolveOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/alerts/{alertName}/resolve" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -947,6 +939,5 @@ func (client *AlertsClient) updateSubscriptionLevelStateToResolveCreateRequest(c 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 } diff --git a/sdk/resourcemanager/security/armsecurity/alertssuppressionrules_client.go b/sdk/resourcemanager/security/armsecurity/alertssuppressionrules_client.go index cccecc08f912..a9bcf80fcbf3 100644 --- a/sdk/resourcemanager/security/armsecurity/alertssuppressionrules_client.go +++ b/sdk/resourcemanager/security/armsecurity/alertssuppressionrules_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type AlertsSuppressionRulesClient struct { } // NewAlertsSuppressionRulesClient creates a new instance of AlertsSuppressionRulesClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewAlertsSuppressionRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AlertsSuppressionRulesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -69,7 +68,7 @@ func (client *AlertsSuppressionRulesClient) Delete(ctx context.Context, alertsSu } // deleteCreateRequest creates the Delete request. -func (client *AlertsSuppressionRulesClient) deleteCreateRequest(ctx context.Context, alertsSuppressionRuleName string, options *AlertsSuppressionRulesClientDeleteOptions) (*policy.Request, error) { +func (client *AlertsSuppressionRulesClient) deleteCreateRequest(ctx context.Context, alertsSuppressionRuleName string, _ *AlertsSuppressionRulesClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -86,7 +85,6 @@ func (client *AlertsSuppressionRulesClient) deleteCreateRequest(ctx context.Cont reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -120,7 +118,7 @@ func (client *AlertsSuppressionRulesClient) Get(ctx context.Context, alertsSuppr } // getCreateRequest creates the Get request. -func (client *AlertsSuppressionRulesClient) getCreateRequest(ctx context.Context, alertsSuppressionRuleName string, options *AlertsSuppressionRulesClientGetOptions) (*policy.Request, error) { +func (client *AlertsSuppressionRulesClient) getCreateRequest(ctx context.Context, alertsSuppressionRuleName string, _ *AlertsSuppressionRulesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -239,7 +237,7 @@ func (client *AlertsSuppressionRulesClient) Update(ctx context.Context, alertsSu } // updateCreateRequest creates the Update request. -func (client *AlertsSuppressionRulesClient) updateCreateRequest(ctx context.Context, alertsSuppressionRuleName string, alertsSuppressionRule AlertsSuppressionRule, options *AlertsSuppressionRulesClientUpdateOptions) (*policy.Request, error) { +func (client *AlertsSuppressionRulesClient) updateCreateRequest(ctx context.Context, alertsSuppressionRuleName string, alertsSuppressionRule AlertsSuppressionRule, _ *AlertsSuppressionRulesClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/alertsSuppressionRules/{alertsSuppressionRuleName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -257,6 +255,7 @@ func (client *AlertsSuppressionRulesClient) updateCreateRequest(ctx context.Cont reqQP.Set("api-version", "2019-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, alertsSuppressionRule); err != nil { return nil, err } diff --git a/sdk/resourcemanager/security/armsecurity/allowedconnections_client.go b/sdk/resourcemanager/security/armsecurity/allowedconnections_client.go index d0a4c8612c9c..f3de7a4a4388 100644 --- a/sdk/resourcemanager/security/armsecurity/allowedconnections_client.go +++ b/sdk/resourcemanager/security/armsecurity/allowedconnections_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type AllowedConnectionsClient struct { } // NewAllowedConnectionsClient creates a new instance of AllowedConnectionsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewAllowedConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AllowedConnectionsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -44,7 +43,7 @@ func NewAllowedConnectionsClient(subscriptionID string, credential azcore.TokenC // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // - connectionType - The type of allowed connections (Internal, External) // - options - AllowedConnectionsClientGetOptions contains the optional parameters for the AllowedConnectionsClient.Get method. @@ -71,7 +70,7 @@ func (client *AllowedConnectionsClient) Get(ctx context.Context, resourceGroupNa } // getCreateRequest creates the Get request. -func (client *AllowedConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, connectionType ConnectionType, options *AllowedConnectionsClientGetOptions) (*policy.Request, error) { +func (client *AllowedConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, connectionType ConnectionType, _ *AllowedConnectionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections/{connectionType}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -138,7 +137,7 @@ func (client *AllowedConnectionsClient) NewListPager(options *AllowedConnections } // listCreateRequest creates the List request. -func (client *AllowedConnectionsClient) listCreateRequest(ctx context.Context, options *AllowedConnectionsClientListOptions) (*policy.Request, error) { +func (client *AllowedConnectionsClient) listCreateRequest(ctx context.Context, _ *AllowedConnectionsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/allowedConnections" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -194,7 +193,7 @@ func (client *AllowedConnectionsClient) NewListByHomeRegionPager(ascLocation str } // listByHomeRegionCreateRequest creates the ListByHomeRegion request. -func (client *AllowedConnectionsClient) listByHomeRegionCreateRequest(ctx context.Context, ascLocation string, options *AllowedConnectionsClientListByHomeRegionOptions) (*policy.Request, error) { +func (client *AllowedConnectionsClient) listByHomeRegionCreateRequest(ctx context.Context, ascLocation string, _ *AllowedConnectionsClientListByHomeRegionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/allowedConnections" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/apicollections_client.go b/sdk/resourcemanager/security/armsecurity/apicollections_client.go index 55780e2f9115..3582a430444f 100644 --- a/sdk/resourcemanager/security/armsecurity/apicollections_client.go +++ b/sdk/resourcemanager/security/armsecurity/apicollections_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type APICollectionsClient struct { } // NewAPICollectionsClient creates a new instance of APICollectionsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewAPICollectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*APICollectionsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -40,9 +39,11 @@ func NewAPICollectionsClient(subscriptionID string, credential azcore.TokenCrede return client, nil } -// GetByAzureAPIManagementService - Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. -// If an Azure API Management API is onboarded to Microsoft Defender for APIs, the system will monitor the -// operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been detected. +// GetByAzureAPIManagementService - Gets an onboarded Azure API Management API +// +// Gets an Azure API Management API if it has been onboarded to Microsoft Defender for APIs. If an Azure API Management API +// is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management API +// for intrusive behaviors and provide alerts for attacks that have been detected. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-11-15 @@ -75,7 +76,7 @@ func (client *APICollectionsClient) GetByAzureAPIManagementService(ctx context.C } // getByAzureAPIManagementServiceCreateRequest creates the GetByAzureAPIManagementService request. -func (client *APICollectionsClient) getByAzureAPIManagementServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *APICollectionsClientGetByAzureAPIManagementServiceOptions) (*policy.Request, error) { +func (client *APICollectionsClient) getByAzureAPIManagementServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, _ *APICollectionsClientGetByAzureAPIManagementServiceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -113,10 +114,11 @@ func (client *APICollectionsClient) getByAzureAPIManagementServiceHandleResponse return result, nil } -// NewListByAzureAPIManagementServicePager - Gets a list of Azure API Management APIs that have been onboarded to Microsoft -// Defender for APIs. If an Azure API Management API is onboarded to Microsoft Defender for APIs, the system will monitor -// the operations within the Azure API Management API for intrusive behaviors and provide alerts for attacks that have been -// detected. +// NewListByAzureAPIManagementServicePager - Gets a list of onboarded Azure API Management APIs +// +// Gets a list of Azure API Management APIs that have been onboarded to Microsoft Defender for APIs. If an Azure API Management +// API is onboarded to Microsoft Defender for APIs, the system will monitor the operations within the Azure API Management +// API for intrusive behaviors and provide alerts for attacks that have been detected. // // Generated from API version 2023-11-15 // - resourceGroupName - The name of the resource group. The name is case insensitive. @@ -147,7 +149,7 @@ func (client *APICollectionsClient) NewListByAzureAPIManagementServicePager(reso } // listByAzureAPIManagementServiceCreateRequest creates the ListByAzureAPIManagementService request. -func (client *APICollectionsClient) listByAzureAPIManagementServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, options *APICollectionsClientListByAzureAPIManagementServiceOptions) (*policy.Request, error) { +func (client *APICollectionsClient) listByAzureAPIManagementServiceCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, _ *APICollectionsClientListByAzureAPIManagementServiceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -181,8 +183,9 @@ func (client *APICollectionsClient) listByAzureAPIManagementServiceHandleRespons return result, nil } -// NewListByResourceGroupPager - Gets a list of API collections within a resource group that have been onboarded to Microsoft -// Defender for APIs. +// NewListByResourceGroupPager - Gets a list of API collections within a resource group +// +// Gets a list of API collections within a resource group that have been onboarded to Microsoft Defender for APIs. // // Generated from API version 2023-11-15 // - resourceGroupName - The name of the resource group. The name is case insensitive. @@ -212,7 +215,7 @@ func (client *APICollectionsClient) NewListByResourceGroupPager(resourceGroupNam } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *APICollectionsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *APICollectionsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *APICollectionsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *APICollectionsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/apiCollections" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -242,8 +245,9 @@ func (client *APICollectionsClient) listByResourceGroupHandleResponse(resp *http return result, nil } -// NewListBySubscriptionPager - Gets a list of API collections within a subscription that have been onboarded to Microsoft -// Defender for APIs. +// NewListBySubscriptionPager - Gets a list of API collections within a subscription +// +// Gets a list of API collections within a subscription that have been onboarded to Microsoft Defender for APIs. // // Generated from API version 2023-11-15 // - options - APICollectionsClientListBySubscriptionOptions contains the optional parameters for the APICollectionsClient.NewListBySubscriptionPager @@ -272,7 +276,7 @@ func (client *APICollectionsClient) NewListBySubscriptionPager(options *APIColle } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *APICollectionsClient) listBySubscriptionCreateRequest(ctx context.Context, options *APICollectionsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *APICollectionsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *APICollectionsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/apiCollections" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -298,8 +302,10 @@ func (client *APICollectionsClient) listBySubscriptionHandleResponse(resp *http. return result, nil } -// OffboardAzureAPIManagementAPI - Offboard an Azure API Management API from Microsoft Defender for APIs. The system will -// stop monitoring the operations within the Azure API Management API for intrusive behaviors. +// OffboardAzureAPIManagementAPI - Offboard an Azure API Management API from Microsoft Defender for APIs +// +// Offboard an Azure API Management API from Microsoft Defender for APIs. The system will stop monitoring the operations within +// the Azure API Management API for intrusive behaviors. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-11-15 @@ -331,7 +337,7 @@ func (client *APICollectionsClient) OffboardAzureAPIManagementAPI(ctx context.Co } // offboardAzureAPIManagementAPICreateRequest creates the OffboardAzureAPIManagementAPI request. -func (client *APICollectionsClient) offboardAzureAPIManagementAPICreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *APICollectionsClientOffboardAzureAPIManagementAPIOptions) (*policy.Request, error) { +func (client *APICollectionsClient) offboardAzureAPIManagementAPICreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, _ *APICollectionsClientOffboardAzureAPIManagementAPIOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -356,13 +362,13 @@ func (client *APICollectionsClient) offboardAzureAPIManagementAPICreateRequest(c reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2023-11-15") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } -// BeginOnboardAzureAPIManagementAPI - Onboard an Azure API Management API to Microsoft Defender for APIs. The system will -// start monitoring the operations within the Azure Management API for intrusive behaviors and provide alerts for -// attacks that have been detected. +// BeginOnboardAzureAPIManagementAPI - Onboard an Azure API Management API to Microsoft Defender for APIs +// +// Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the operations within +// the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-11-15 @@ -379,8 +385,7 @@ func (client *APICollectionsClient) BeginOnboardAzureAPIManagementAPI(ctx contex return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[APICollectionsClientOnboardAzureAPIManagementAPIResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -390,9 +395,10 @@ func (client *APICollectionsClient) BeginOnboardAzureAPIManagementAPI(ctx contex } } -// OnboardAzureAPIManagementAPI - Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start -// monitoring the operations within the Azure Management API for intrusive behaviors and provide alerts for -// attacks that have been detected. +// OnboardAzureAPIManagementAPI - Onboard an Azure API Management API to Microsoft Defender for APIs +// +// Onboard an Azure API Management API to Microsoft Defender for APIs. The system will start monitoring the operations within +// the Azure Management API for intrusive behaviors and provide alerts for attacks that have been detected. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-11-15 @@ -418,7 +424,7 @@ func (client *APICollectionsClient) onboardAzureAPIManagementAPI(ctx context.Con } // onboardAzureAPIManagementAPICreateRequest creates the OnboardAzureAPIManagementAPI request. -func (client *APICollectionsClient) onboardAzureAPIManagementAPICreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, options *APICollectionsClientBeginOnboardAzureAPIManagementAPIOptions) (*policy.Request, error) { +func (client *APICollectionsClient) onboardAzureAPIManagementAPICreateRequest(ctx context.Context, resourceGroupName string, serviceName string, apiID string, _ *APICollectionsClientBeginOnboardAzureAPIManagementAPIOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/providers/Microsoft.Security/apiCollections/{apiId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/application_client.go b/sdk/resourcemanager/security/armsecurity/application_client.go index 53feca0e46e4..eee39fa6b503 100644 --- a/sdk/resourcemanager/security/armsecurity/application_client.go +++ b/sdk/resourcemanager/security/armsecurity/application_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type ApplicationClient struct { } // NewApplicationClient creates a new instance of ApplicationClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewApplicationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplicationClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -71,7 +70,7 @@ func (client *ApplicationClient) CreateOrUpdate(ctx context.Context, application } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ApplicationClient) createOrUpdateCreateRequest(ctx context.Context, applicationID string, application Application, options *ApplicationClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ApplicationClient) createOrUpdateCreateRequest(ctx context.Context, applicationID string, application Application, _ *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") @@ -89,6 +88,7 @@ func (client *ApplicationClient) createOrUpdateCreateRequest(ctx context.Context reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, application); err != nil { return nil, err } @@ -132,7 +132,7 @@ func (client *ApplicationClient) Delete(ctx context.Context, applicationID strin } // deleteCreateRequest creates the Delete request. -func (client *ApplicationClient) deleteCreateRequest(ctx context.Context, applicationID string, options *ApplicationClientDeleteOptions) (*policy.Request, error) { +func (client *ApplicationClient) deleteCreateRequest(ctx context.Context, applicationID string, _ *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") @@ -181,7 +181,7 @@ func (client *ApplicationClient) Get(ctx context.Context, applicationID string, } // getCreateRequest creates the Get request. -func (client *ApplicationClient) getCreateRequest(ctx context.Context, applicationID string, options *ApplicationClientGetOptions) (*policy.Request, error) { +func (client *ApplicationClient) getCreateRequest(ctx context.Context, applicationID string, _ *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") diff --git a/sdk/resourcemanager/security/armsecurity/applications_client.go b/sdk/resourcemanager/security/armsecurity/applications_client.go index 7e720d847d23..7ea54c8a76c7 100644 --- a/sdk/resourcemanager/security/armsecurity/applications_client.go +++ b/sdk/resourcemanager/security/armsecurity/applications_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type ApplicationsClient struct { } // NewApplicationsClient creates a new instance of ApplicationsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewApplicationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ApplicationsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -68,7 +67,7 @@ func (client *ApplicationsClient) NewListPager(options *ApplicationsClientListOp } // listCreateRequest creates the List request. -func (client *ApplicationsClient) listCreateRequest(ctx context.Context, options *ApplicationsClientListOptions) (*policy.Request, error) { +func (client *ApplicationsClient) listCreateRequest(ctx context.Context, _ *ApplicationsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/applications" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/assessments_client.go b/sdk/resourcemanager/security/armsecurity/assessments_client.go index ad4b2056eb98..0f0d96440cdc 100644 --- a/sdk/resourcemanager/security/armsecurity/assessments_client.go +++ b/sdk/resourcemanager/security/armsecurity/assessments_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,7 +24,7 @@ type AssessmentsClient struct { // NewAssessmentsClient creates a new instance of AssessmentsClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewAssessmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*AssessmentsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,8 +40,8 @@ func NewAssessmentsClient(credential azcore.TokenCredential, options *arm.Client // be predefined with the same name before inserting the assessment result // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 -// - resourceID - The identifier of the resource. +// Generated from API version 2025-05-04 +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. // - assessmentName - The Assessment Key - Unique key for the assessment type // - assessment - Calculated assessment on a pre-defined assessment metadata // - options - AssessmentsClientCreateOrUpdateOptions contains the optional parameters for the AssessmentsClient.CreateOrUpdate @@ -70,8 +69,11 @@ func (client *AssessmentsClient) CreateOrUpdate(ctx context.Context, resourceID } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AssessmentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceID string, assessmentName string, assessment Assessment, options *AssessmentsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AssessmentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceID string, assessmentName string, assessment Assessment, _ *AssessmentsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if assessmentName == "" { return nil, errors.New("parameter assessmentName cannot be empty") @@ -82,9 +84,10 @@ func (client *AssessmentsClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2025-05-04") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, assessment); err != nil { return nil, err } @@ -104,8 +107,8 @@ func (client *AssessmentsClient) createOrUpdateHandleResponse(resp *http.Respons // with the same name before inserting the assessment result // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 -// - resourceID - The identifier of the resource. +// Generated from API version 2025-05-04 +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. // - assessmentName - The Assessment Key - Unique key for the assessment type // - options - AssessmentsClientDeleteOptions contains the optional parameters for the AssessmentsClient.Delete method. func (client *AssessmentsClient) Delete(ctx context.Context, resourceID string, assessmentName string, options *AssessmentsClientDeleteOptions) (AssessmentsClientDeleteResponse, error) { @@ -130,8 +133,11 @@ func (client *AssessmentsClient) Delete(ctx context.Context, resourceID string, } // deleteCreateRequest creates the Delete request. -func (client *AssessmentsClient) deleteCreateRequest(ctx context.Context, resourceID string, assessmentName string, options *AssessmentsClientDeleteOptions) (*policy.Request, error) { +func (client *AssessmentsClient) deleteCreateRequest(ctx context.Context, resourceID string, assessmentName string, _ *AssessmentsClientDeleteOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if assessmentName == "" { return nil, errors.New("parameter assessmentName cannot be empty") @@ -142,17 +148,16 @@ func (client *AssessmentsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2025-05-04") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Get a security assessment on your scanned resource // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 -// - resourceID - The identifier of the resource. +// Generated from API version 2025-05-04 +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. // - assessmentName - The Assessment Key - Unique key for the assessment type // - options - AssessmentsClientGetOptions contains the optional parameters for the AssessmentsClient.Get method. func (client *AssessmentsClient) Get(ctx context.Context, resourceID string, assessmentName string, options *AssessmentsClientGetOptions) (AssessmentsClientGetResponse, error) { @@ -180,6 +185,9 @@ func (client *AssessmentsClient) Get(ctx context.Context, resourceID string, ass // getCreateRequest creates the Get request. func (client *AssessmentsClient) getCreateRequest(ctx context.Context, resourceID string, assessmentName string, options *AssessmentsClientGetOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if assessmentName == "" { return nil, errors.New("parameter assessmentName cannot be empty") @@ -193,7 +201,7 @@ func (client *AssessmentsClient) getCreateRequest(ctx context.Context, resourceI if options != nil && options.Expand != nil { reqQP.Set("$expand", string(*options.Expand)) } - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2025-05-04") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -210,9 +218,8 @@ func (client *AssessmentsClient) getHandleResponse(resp *http.Response) (Assessm // NewListPager - Get security assessments on all your scanned resources inside a scope // -// 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). +// Generated from API version 2025-05-04 +// - scope - The fully qualified Azure Resource manager identifier of the resource. // - options - AssessmentsClientListOptions contains the optional parameters for the AssessmentsClient.NewListPager method. func (client *AssessmentsClient) NewListPager(scope string, options *AssessmentsClientListOptions) *runtime.Pager[AssessmentsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[AssessmentsClientListResponse]{ @@ -238,15 +245,18 @@ func (client *AssessmentsClient) NewListPager(scope string, options *Assessments } // listCreateRequest creates the List request. -func (client *AssessmentsClient) listCreateRequest(ctx context.Context, scope string, options *AssessmentsClientListOptions) (*policy.Request, error) { +func (client *AssessmentsClient) listCreateRequest(ctx context.Context, scope string, _ *AssessmentsClientListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/assessments" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2025-05-04") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/security/armsecurity/assessmentsmetadata_client.go b/sdk/resourcemanager/security/armsecurity/assessmentsmetadata_client.go index 167d1383cb55..6e05d434445b 100644 --- a/sdk/resourcemanager/security/armsecurity/assessmentsmetadata_client.go +++ b/sdk/resourcemanager/security/armsecurity/assessmentsmetadata_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type AssessmentsMetadataClient struct { } // NewAssessmentsMetadataClient creates a new instance of AssessmentsMetadataClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewAssessmentsMetadataClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssessmentsMetadataClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,7 +42,7 @@ func NewAssessmentsMetadataClient(subscriptionID string, credential azcore.Token // CreateInSubscription - Create metadata information on an assessment type in a specific subscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2025-05-04 // - assessmentMetadataName - The Assessment Key - Unique key for the assessment type // - assessmentMetadata - AssessmentMetadata object // - options - AssessmentsMetadataClientCreateInSubscriptionOptions contains the optional parameters for the AssessmentsMetadataClient.CreateInSubscription @@ -71,24 +70,25 @@ func (client *AssessmentsMetadataClient) CreateInSubscription(ctx context.Contex } // createInSubscriptionCreateRequest creates the CreateInSubscription request. -func (client *AssessmentsMetadataClient) createInSubscriptionCreateRequest(ctx context.Context, assessmentMetadataName string, assessmentMetadata AssessmentMetadataResponse, options *AssessmentsMetadataClientCreateInSubscriptionOptions) (*policy.Request, error) { +func (client *AssessmentsMetadataClient) createInSubscriptionCreateRequest(ctx context.Context, assessmentMetadataName string, assessmentMetadata AssessmentMetadataResponse, _ *AssessmentsMetadataClientCreateInSubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" - if assessmentMetadataName == "" { - return nil, errors.New("parameter assessmentMetadataName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentMetadataName}", url.PathEscape(assessmentMetadataName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if assessmentMetadataName == "" { + return nil, errors.New("parameter assessmentMetadataName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentMetadataName}", url.PathEscape(assessmentMetadataName)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2025-05-04") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, assessmentMetadata); err != nil { return nil, err } @@ -108,7 +108,7 @@ func (client *AssessmentsMetadataClient) createInSubscriptionHandleResponse(resp // of all the assessments of that type in that subscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2025-05-04 // - assessmentMetadataName - The Assessment Key - Unique key for the assessment type // - options - AssessmentsMetadataClientDeleteInSubscriptionOptions contains the optional parameters for the AssessmentsMetadataClient.DeleteInSubscription // method. @@ -134,31 +134,30 @@ func (client *AssessmentsMetadataClient) DeleteInSubscription(ctx context.Contex } // deleteInSubscriptionCreateRequest creates the DeleteInSubscription request. -func (client *AssessmentsMetadataClient) deleteInSubscriptionCreateRequest(ctx context.Context, assessmentMetadataName string, options *AssessmentsMetadataClientDeleteInSubscriptionOptions) (*policy.Request, error) { +func (client *AssessmentsMetadataClient) deleteInSubscriptionCreateRequest(ctx context.Context, assessmentMetadataName string, _ *AssessmentsMetadataClientDeleteInSubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" - if assessmentMetadataName == "" { - return nil, errors.New("parameter assessmentMetadataName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentMetadataName}", url.PathEscape(assessmentMetadataName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if assessmentMetadataName == "" { + return nil, errors.New("parameter assessmentMetadataName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentMetadataName}", url.PathEscape(assessmentMetadataName)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2025-05-04") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Get metadata information on an assessment type // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2025-05-04 // - assessmentMetadataName - The Assessment Key - Unique key for the assessment type // - options - AssessmentsMetadataClientGetOptions contains the optional parameters for the AssessmentsMetadataClient.Get method. func (client *AssessmentsMetadataClient) Get(ctx context.Context, assessmentMetadataName string, options *AssessmentsMetadataClientGetOptions) (AssessmentsMetadataClientGetResponse, error) { @@ -184,7 +183,7 @@ func (client *AssessmentsMetadataClient) Get(ctx context.Context, assessmentMeta } // getCreateRequest creates the Get request. -func (client *AssessmentsMetadataClient) getCreateRequest(ctx context.Context, assessmentMetadataName string, options *AssessmentsMetadataClientGetOptions) (*policy.Request, error) { +func (client *AssessmentsMetadataClient) getCreateRequest(ctx context.Context, assessmentMetadataName string, _ *AssessmentsMetadataClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" if assessmentMetadataName == "" { return nil, errors.New("parameter assessmentMetadataName cannot be empty") @@ -195,7 +194,7 @@ func (client *AssessmentsMetadataClient) getCreateRequest(ctx context.Context, a return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2025-05-04") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -213,7 +212,7 @@ func (client *AssessmentsMetadataClient) getHandleResponse(resp *http.Response) // GetInSubscription - Get metadata information on an assessment type in a specific subscription // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2021-06-01 +// Generated from API version 2025-05-04 // - assessmentMetadataName - The Assessment Key - Unique key for the assessment type // - options - AssessmentsMetadataClientGetInSubscriptionOptions contains the optional parameters for the AssessmentsMetadataClient.GetInSubscription // method. @@ -240,22 +239,22 @@ func (client *AssessmentsMetadataClient) GetInSubscription(ctx context.Context, } // getInSubscriptionCreateRequest creates the GetInSubscription request. -func (client *AssessmentsMetadataClient) getInSubscriptionCreateRequest(ctx context.Context, assessmentMetadataName string, options *AssessmentsMetadataClientGetInSubscriptionOptions) (*policy.Request, error) { +func (client *AssessmentsMetadataClient) getInSubscriptionCreateRequest(ctx context.Context, assessmentMetadataName string, _ *AssessmentsMetadataClientGetInSubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata/{assessmentMetadataName}" - if assessmentMetadataName == "" { - return nil, errors.New("parameter assessmentMetadataName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{assessmentMetadataName}", url.PathEscape(assessmentMetadataName)) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if assessmentMetadataName == "" { + return nil, errors.New("parameter assessmentMetadataName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assessmentMetadataName}", url.PathEscape(assessmentMetadataName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2025-05-04") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -272,7 +271,7 @@ func (client *AssessmentsMetadataClient) getInSubscriptionHandleResponse(resp *h // NewListPager - Get metadata information on all assessment types // -// Generated from API version 2021-06-01 +// Generated from API version 2025-05-04 // - options - AssessmentsMetadataClientListOptions contains the optional parameters for the AssessmentsMetadataClient.NewListPager // method. func (client *AssessmentsMetadataClient) NewListPager(options *AssessmentsMetadataClientListOptions) *runtime.Pager[AssessmentsMetadataClientListResponse] { @@ -299,14 +298,14 @@ func (client *AssessmentsMetadataClient) NewListPager(options *AssessmentsMetada } // listCreateRequest creates the List request. -func (client *AssessmentsMetadataClient) listCreateRequest(ctx context.Context, options *AssessmentsMetadataClientListOptions) (*policy.Request, error) { +func (client *AssessmentsMetadataClient) listCreateRequest(ctx context.Context, _ *AssessmentsMetadataClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Security/assessmentMetadata" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2025-05-04") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -323,7 +322,7 @@ func (client *AssessmentsMetadataClient) listHandleResponse(resp *http.Response) // NewListBySubscriptionPager - Get metadata information on all assessment types in a specific subscription // -// Generated from API version 2021-06-01 +// Generated from API version 2025-05-04 // - options - AssessmentsMetadataClientListBySubscriptionOptions contains the optional parameters for the AssessmentsMetadataClient.NewListBySubscriptionPager // method. func (client *AssessmentsMetadataClient) NewListBySubscriptionPager(options *AssessmentsMetadataClientListBySubscriptionOptions) *runtime.Pager[AssessmentsMetadataClientListBySubscriptionResponse] { @@ -350,7 +349,7 @@ func (client *AssessmentsMetadataClient) NewListBySubscriptionPager(options *Ass } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *AssessmentsMetadataClient) listBySubscriptionCreateRequest(ctx context.Context, options *AssessmentsMetadataClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *AssessmentsMetadataClient) listBySubscriptionCreateRequest(ctx context.Context, _ *AssessmentsMetadataClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assessmentMetadata" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -361,7 +360,7 @@ func (client *AssessmentsMetadataClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01") + reqQP.Set("api-version", "2025-05-04") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/security/armsecurity/assignments_client.go b/sdk/resourcemanager/security/armsecurity/assignments_client.go new file mode 100644 index 000000000000..531fa7f572e4 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/assignments_client.go @@ -0,0 +1,341 @@ +// 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) Go Code Generator. 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" + "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" +) + +// AssignmentsClient contains the methods for the Assignments group. +// Don't use this type directly, use NewAssignmentsClient() instead. +type AssignmentsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewAssignmentsClient creates a new instance of AssignmentsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssignmentsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &AssignmentsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create a security assignment on the given scope. Will create/update the required standard assignment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - assignmentID - The security assignment key - unique key for the standard assignment +// - assignment - Custom standard assignment over a pre-defined scope +// - options - AssignmentsClientCreateOrUpdateOptions contains the optional parameters for the AssignmentsClient.CreateOrUpdate +// method. +func (client *AssignmentsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, assignmentID string, assignment Assignment, options *AssignmentsClientCreateOrUpdateOptions) (AssignmentsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "AssignmentsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, assignmentID, assignment, options) + if err != nil { + return AssignmentsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AssignmentsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return AssignmentsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *AssignmentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, assignmentID string, assignment Assignment, _ *AssignmentsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/assignments/{assignmentId}" + 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 assignmentID == "" { + return nil, errors.New("parameter assignmentID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assignmentId}", url.PathEscape(assignmentID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, assignment); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *AssignmentsClient) createOrUpdateHandleResponse(resp *http.Response) (AssignmentsClientCreateOrUpdateResponse, error) { + result := AssignmentsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Assignment); err != nil { + return AssignmentsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a standard assignment over a given scope +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - assignmentID - The security assignment key - unique key for the standard assignment +// - options - AssignmentsClientDeleteOptions contains the optional parameters for the AssignmentsClient.Delete method. +func (client *AssignmentsClient) Delete(ctx context.Context, resourceGroupName string, assignmentID string, options *AssignmentsClientDeleteOptions) (AssignmentsClientDeleteResponse, error) { + var err error + const operationName = "AssignmentsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, assignmentID, options) + if err != nil { + return AssignmentsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AssignmentsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return AssignmentsClientDeleteResponse{}, err + } + return AssignmentsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *AssignmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, assignmentID string, _ *AssignmentsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/assignments/{assignmentId}" + 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 assignmentID == "" { + return nil, errors.New("parameter assignmentID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assignmentId}", url.PathEscape(assignmentID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Get a specific standard assignment for the requested scope by resourceId +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - assignmentID - The security assignment key - unique key for the standard assignment +// - options - AssignmentsClientGetOptions contains the optional parameters for the AssignmentsClient.Get method. +func (client *AssignmentsClient) Get(ctx context.Context, resourceGroupName string, assignmentID string, options *AssignmentsClientGetOptions) (AssignmentsClientGetResponse, error) { + var err error + const operationName = "AssignmentsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, assignmentID, options) + if err != nil { + return AssignmentsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return AssignmentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return AssignmentsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *AssignmentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, assignmentID string, _ *AssignmentsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/assignments/{assignmentId}" + 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 assignmentID == "" { + return nil, errors.New("parameter assignmentID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{assignmentId}", url.PathEscape(assignmentID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-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 *AssignmentsClient) getHandleResponse(resp *http.Response) (AssignmentsClientGetResponse, error) { + result := AssignmentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Assignment); err != nil { + return AssignmentsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get a list of all relevant standardAssignments available for scope +// +// Generated from API version 2021-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - AssignmentsClientListOptions contains the optional parameters for the AssignmentsClient.NewListPager method. +func (client *AssignmentsClient) NewListPager(resourceGroupName string, options *AssignmentsClientListOptions) *runtime.Pager[AssignmentsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[AssignmentsClientListResponse]{ + More: func(page AssignmentsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AssignmentsClientListResponse) (AssignmentsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AssignmentsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return AssignmentsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *AssignmentsClient) listCreateRequest(ctx context.Context, resourceGroupName string, _ *AssignmentsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/assignments" + 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)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-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 *AssignmentsClient) listHandleResponse(resp *http.Response) (AssignmentsClientListResponse, error) { + result := AssignmentsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AssignmentList); err != nil { + return AssignmentsClientListResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Get a list of all relevant standardAssignments over a subscription level scope +// +// Generated from API version 2021-08-01-preview +// - options - AssignmentsClientListBySubscriptionOptions contains the optional parameters for the AssignmentsClient.NewListBySubscriptionPager +// method. +func (client *AssignmentsClient) NewListBySubscriptionPager(options *AssignmentsClientListBySubscriptionOptions) *runtime.Pager[AssignmentsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[AssignmentsClientListBySubscriptionResponse]{ + More: func(page AssignmentsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *AssignmentsClientListBySubscriptionResponse) (AssignmentsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "AssignmentsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return AssignmentsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *AssignmentsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *AssignmentsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/assignments" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *AssignmentsClient) listBySubscriptionHandleResponse(resp *http.Response) (AssignmentsClientListBySubscriptionResponse, error) { + result := AssignmentsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.AssignmentList); err != nil { + return AssignmentsClientListBySubscriptionResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/automations_client.go b/sdk/resourcemanager/security/armsecurity/automations_client.go index 1caf1d7c3fac..7b9939502db8 100644 --- a/sdk/resourcemanager/security/armsecurity/automations_client.go +++ b/sdk/resourcemanager/security/armsecurity/automations_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type AutomationsClient struct { } // NewAutomationsClient creates a new instance of AutomationsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewAutomationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AutomationsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -45,7 +44,7 @@ func NewAutomationsClient(subscriptionID string, credential azcore.TokenCredenti // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-12-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - automationName - The security automation name. // - automation - The security automation resource // - options - AutomationsClientCreateOrUpdateOptions contains the optional parameters for the AutomationsClient.CreateOrUpdate @@ -73,7 +72,7 @@ func (client *AutomationsClient) CreateOrUpdate(ctx context.Context, resourceGro } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AutomationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, automationName string, automation Automation, options *AutomationsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AutomationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, automationName string, automation Automation, _ *AutomationsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -95,6 +94,7 @@ func (client *AutomationsClient) createOrUpdateCreateRequest(ctx context.Context reqQP.Set("api-version", "2023-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, automation); err != nil { return nil, err } @@ -114,7 +114,7 @@ func (client *AutomationsClient) createOrUpdateHandleResponse(resp *http.Respons // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-12-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - automationName - The security automation name. // - options - AutomationsClientDeleteOptions contains the optional parameters for the AutomationsClient.Delete method. func (client *AutomationsClient) Delete(ctx context.Context, resourceGroupName string, automationName string, options *AutomationsClientDeleteOptions) (AutomationsClientDeleteResponse, error) { @@ -139,7 +139,7 @@ func (client *AutomationsClient) Delete(ctx context.Context, resourceGroupName s } // deleteCreateRequest creates the Delete request. -func (client *AutomationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, automationName string, options *AutomationsClientDeleteOptions) (*policy.Request, error) { +func (client *AutomationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, automationName string, _ *AutomationsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -160,7 +160,6 @@ func (client *AutomationsClient) deleteCreateRequest(ctx context.Context, resour reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2023-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -168,7 +167,7 @@ func (client *AutomationsClient) deleteCreateRequest(ctx context.Context, resour // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-12-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - automationName - The security automation name. // - options - AutomationsClientGetOptions contains the optional parameters for the AutomationsClient.Get method. func (client *AutomationsClient) Get(ctx context.Context, resourceGroupName string, automationName string, options *AutomationsClientGetOptions) (AutomationsClientGetResponse, error) { @@ -194,7 +193,7 @@ func (client *AutomationsClient) Get(ctx context.Context, resourceGroupName stri } // getCreateRequest creates the Get request. -func (client *AutomationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, automationName string, options *AutomationsClientGetOptions) (*policy.Request, error) { +func (client *AutomationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, automationName string, _ *AutomationsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -257,7 +256,7 @@ func (client *AutomationsClient) NewListPager(options *AutomationsClientListOpti } // listCreateRequest creates the List request. -func (client *AutomationsClient) listCreateRequest(ctx context.Context, options *AutomationsClientListOptions) (*policy.Request, error) { +func (client *AutomationsClient) listCreateRequest(ctx context.Context, _ *AutomationsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/automations" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -287,7 +286,7 @@ func (client *AutomationsClient) listHandleResponse(resp *http.Response) (Automa // in the response to get the next page of security automations for the specified resource group. // // Generated from API version 2023-12-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - AutomationsClientListByResourceGroupOptions contains the optional parameters for the AutomationsClient.NewListByResourceGroupPager // method. func (client *AutomationsClient) NewListByResourceGroupPager(resourceGroupName string, options *AutomationsClientListByResourceGroupOptions) *runtime.Pager[AutomationsClientListByResourceGroupResponse] { @@ -314,7 +313,7 @@ func (client *AutomationsClient) NewListByResourceGroupPager(resourceGroupName s } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *AutomationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *AutomationsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *AutomationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *AutomationsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -348,7 +347,7 @@ func (client *AutomationsClient) listByResourceGroupHandleResponse(resp *http.Re // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-12-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - automationName - The security automation name. // - automation - The update model of security automation resource // - options - AutomationsClientUpdateOptions contains the optional parameters for the AutomationsClient.Update method. @@ -375,7 +374,7 @@ func (client *AutomationsClient) Update(ctx context.Context, resourceGroupName s } // updateCreateRequest creates the Update request. -func (client *AutomationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, automationName string, automation AutomationUpdateModel, options *AutomationsClientUpdateOptions) (*policy.Request, error) { +func (client *AutomationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, automationName string, automation AutomationUpdateModel, _ *AutomationsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -397,6 +396,7 @@ func (client *AutomationsClient) updateCreateRequest(ctx context.Context, resour reqQP.Set("api-version", "2023-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, automation); err != nil { return nil, err } @@ -416,7 +416,7 @@ func (client *AutomationsClient) updateHandleResponse(resp *http.Response) (Auto // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-12-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - automationName - The security automation name. // - automation - The security automation resource // - options - AutomationsClientValidateOptions contains the optional parameters for the AutomationsClient.Validate method. @@ -443,7 +443,7 @@ func (client *AutomationsClient) Validate(ctx context.Context, resourceGroupName } // validateCreateRequest creates the Validate request. -func (client *AutomationsClient) validateCreateRequest(ctx context.Context, resourceGroupName string, automationName string, automation Automation, options *AutomationsClientValidateOptions) (*policy.Request, error) { +func (client *AutomationsClient) validateCreateRequest(ctx context.Context, resourceGroupName string, automationName string, automation Automation, _ *AutomationsClientValidateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/automations/{automationName}/validate" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -465,6 +465,7 @@ func (client *AutomationsClient) validateCreateRequest(ctx context.Context, reso reqQP.Set("api-version", "2023-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, automation); err != nil { return nil, err } diff --git a/sdk/resourcemanager/security/armsecurity/autoprovisioningsettings_client.go b/sdk/resourcemanager/security/armsecurity/autoprovisioningsettings_client.go index e216e8e8374c..193eb5470013 100644 --- a/sdk/resourcemanager/security/armsecurity/autoprovisioningsettings_client.go +++ b/sdk/resourcemanager/security/armsecurity/autoprovisioningsettings_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type AutoProvisioningSettingsClient struct { } // NewAutoProvisioningSettingsClient creates a new instance of AutoProvisioningSettingsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewAutoProvisioningSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AutoProvisioningSettingsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -71,7 +70,7 @@ func (client *AutoProvisioningSettingsClient) Create(ctx context.Context, settin } // createCreateRequest creates the Create request. -func (client *AutoProvisioningSettingsClient) createCreateRequest(ctx context.Context, settingName string, setting AutoProvisioningSetting, options *AutoProvisioningSettingsClientCreateOptions) (*policy.Request, error) { +func (client *AutoProvisioningSettingsClient) createCreateRequest(ctx context.Context, settingName string, setting AutoProvisioningSetting, _ *AutoProvisioningSettingsClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -89,6 +88,7 @@ func (client *AutoProvisioningSettingsClient) createCreateRequest(ctx context.Co reqQP.Set("api-version", "2017-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, setting); err != nil { return nil, err } @@ -134,7 +134,7 @@ func (client *AutoProvisioningSettingsClient) Get(ctx context.Context, settingNa } // getCreateRequest creates the Get request. -func (client *AutoProvisioningSettingsClient) getCreateRequest(ctx context.Context, settingName string, options *AutoProvisioningSettingsClientGetOptions) (*policy.Request, error) { +func (client *AutoProvisioningSettingsClient) getCreateRequest(ctx context.Context, settingName string, _ *AutoProvisioningSettingsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings/{settingName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -193,7 +193,7 @@ func (client *AutoProvisioningSettingsClient) NewListPager(options *AutoProvisio } // listCreateRequest creates the List request. -func (client *AutoProvisioningSettingsClient) listCreateRequest(ctx context.Context, options *AutoProvisioningSettingsClientListOptions) (*policy.Request, error) { +func (client *AutoProvisioningSettingsClient) listCreateRequest(ctx context.Context, _ *AutoProvisioningSettingsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/autoProvisioningSettings" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/autorest.md b/sdk/resourcemanager/security/armsecurity/autorest.md deleted file mode 100644 index 110930e58447..000000000000 --- a/sdk/resourcemanager/security/armsecurity/autorest.md +++ /dev/null @@ -1,55 +0,0 @@ -### AutoRest Configuration - -> see https://aka.ms/autorest - -``` yaml -azure-arm: true -tag: package-composite-v3 -require: -- https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/readme.go.md -license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.14.0 -directive: -- from: externalSecuritySolutions.json - where: $.definitions['ExternalSecuritySolutionKind'] - transform: > - $ = { - "type": "string", - "description": "The kind of the external solution", - "enum": [ - "CEF", - "ATA", - "AAD" - ], - "x-ms-enum": { - "name": "ExternalSecuritySolutionKind", - "modelAsString": true, - "values": [ - { - "value": "CEF" - }, - { - "value": "ATA" - }, - { - "value": "AAD" - } - ] - } - }; -- from: externalSecuritySolutions.json - where: $.definitions['ExternalSecuritySolution'] - transform: > - $.properties['kind'] = { - "$ref": "#/definitions/ExternalSecuritySolutionKind" - }; - $.allOf = [ - { - "$ref": "../../../common/v1/types.json#/definitions/Resource" - }, - { - "$ref": "../../../common/v1/types.json#/definitions/Location" - } - ] -``` \ No newline at end of file diff --git a/sdk/resourcemanager/security/armsecurity/azuredevopsorgs_client.go b/sdk/resourcemanager/security/armsecurity/azuredevopsorgs_client.go index 0136345b30ed..a19d00ac1bb6 100644 --- a/sdk/resourcemanager/security/armsecurity/azuredevopsorgs_client.go +++ b/sdk/resourcemanager/security/armsecurity/azuredevopsorgs_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type AzureDevOpsOrgsClient struct { } // NewAzureDevOpsOrgsClient creates a new instance of AzureDevOpsOrgsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewAzureDevOpsOrgsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureDevOpsOrgsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,12 +40,13 @@ func NewAzureDevOpsOrgsClient(subscriptionID string, credential azcore.TokenCred } // BeginCreateOrUpdate - Creates or updates monitored Azure DevOps organization details. +// +// Creates or updates monitored Azure DevOps organization details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - orgName - The Azure DevOps organization name. // - azureDevOpsOrg - The Azure DevOps organization resource payload. // - options - AzureDevOpsOrgsClientBeginCreateOrUpdateOptions contains the optional parameters for the AzureDevOpsOrgsClient.BeginCreateOrUpdate // method. @@ -57,8 +57,7 @@ func (client *AzureDevOpsOrgsClient) BeginCreateOrUpdate(ctx context.Context, re return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureDevOpsOrgsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -69,9 +68,11 @@ func (client *AzureDevOpsOrgsClient) BeginCreateOrUpdate(ctx context.Context, re } // CreateOrUpdate - Creates or updates monitored Azure DevOps organization details. +// +// Creates or updates monitored Azure DevOps organization details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview func (client *AzureDevOpsOrgsClient) createOrUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, azureDevOpsOrg AzureDevOpsOrg, options *AzureDevOpsOrgsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AzureDevOpsOrgsClient.BeginCreateOrUpdate" @@ -94,7 +95,7 @@ func (client *AzureDevOpsOrgsClient) createOrUpdate(ctx context.Context, resourc } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AzureDevOpsOrgsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, azureDevOpsOrg AzureDevOpsOrg, options *AzureDevOpsOrgsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AzureDevOpsOrgsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, azureDevOpsOrg AzureDevOpsOrg, _ *AzureDevOpsOrgsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -117,9 +118,10 @@ func (client *AzureDevOpsOrgsClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, azureDevOpsOrg); err != nil { return nil, err } @@ -127,12 +129,13 @@ func (client *AzureDevOpsOrgsClient) createOrUpdateCreateRequest(ctx context.Con } // Get - Returns a monitored Azure DevOps organization resource. +// +// Returns a monitored Azure DevOps organization resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - orgName - The Azure DevOps organization name. // - options - AzureDevOpsOrgsClientGetOptions contains the optional parameters for the AzureDevOpsOrgsClient.Get method. func (client *AzureDevOpsOrgsClient) Get(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, options *AzureDevOpsOrgsClientGetOptions) (AzureDevOpsOrgsClientGetResponse, error) { var err error @@ -157,7 +160,7 @@ func (client *AzureDevOpsOrgsClient) Get(ctx context.Context, resourceGroupName } // getCreateRequest creates the Get request. -func (client *AzureDevOpsOrgsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, options *AzureDevOpsOrgsClientGetOptions) (*policy.Request, error) { +func (client *AzureDevOpsOrgsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, _ *AzureDevOpsOrgsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -180,7 +183,7 @@ func (client *AzureDevOpsOrgsClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -197,7 +200,9 @@ func (client *AzureDevOpsOrgsClient) getHandleResponse(resp *http.Response) (Azu // NewListPager - Returns a list of Azure DevOps organizations onboarded to the connector. // -// Generated from API version 2023-09-01-preview +// Returns a list of Azure DevOps organizations onboarded to the connector. +// +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. // - options - AzureDevOpsOrgsClientListOptions contains the optional parameters for the AzureDevOpsOrgsClient.NewListPager @@ -226,7 +231,7 @@ func (client *AzureDevOpsOrgsClient) NewListPager(resourceGroupName string, secu } // listCreateRequest creates the List request. -func (client *AzureDevOpsOrgsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *AzureDevOpsOrgsClientListOptions) (*policy.Request, error) { +func (client *AzureDevOpsOrgsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, _ *AzureDevOpsOrgsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -245,7 +250,7 @@ func (client *AzureDevOpsOrgsClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -261,9 +266,11 @@ func (client *AzureDevOpsOrgsClient) listHandleResponse(resp *http.Response) (Az } // ListAvailable - Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. +// +// Returns a list of all Azure DevOps organizations accessible by the user token consumed by the connector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. // - options - AzureDevOpsOrgsClientListAvailableOptions contains the optional parameters for the AzureDevOpsOrgsClient.ListAvailable @@ -291,7 +298,7 @@ func (client *AzureDevOpsOrgsClient) ListAvailable(ctx context.Context, resource } // listAvailableCreateRequest creates the ListAvailable request. -func (client *AzureDevOpsOrgsClient) listAvailableCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *AzureDevOpsOrgsClientListAvailableOptions) (*policy.Request, error) { +func (client *AzureDevOpsOrgsClient) listAvailableCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, _ *AzureDevOpsOrgsClientListAvailableOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/listAvailableAzureDevOpsOrgs" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -310,7 +317,7 @@ func (client *AzureDevOpsOrgsClient) listAvailableCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -326,12 +333,13 @@ func (client *AzureDevOpsOrgsClient) listAvailableHandleResponse(resp *http.Resp } // BeginUpdate - Updates monitored Azure DevOps organization details. +// +// Updates monitored Azure DevOps organization details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - orgName - The Azure DevOps organization name. // - azureDevOpsOrg - The Azure DevOps organization resource payload. // - options - AzureDevOpsOrgsClientBeginUpdateOptions contains the optional parameters for the AzureDevOpsOrgsClient.BeginUpdate // method. @@ -342,8 +350,7 @@ func (client *AzureDevOpsOrgsClient) BeginUpdate(ctx context.Context, resourceGr return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureDevOpsOrgsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -354,9 +361,11 @@ func (client *AzureDevOpsOrgsClient) BeginUpdate(ctx context.Context, resourceGr } // Update - Updates monitored Azure DevOps organization details. +// +// Updates monitored Azure DevOps organization details. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview func (client *AzureDevOpsOrgsClient) update(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, azureDevOpsOrg AzureDevOpsOrg, options *AzureDevOpsOrgsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "AzureDevOpsOrgsClient.BeginUpdate" @@ -379,7 +388,7 @@ func (client *AzureDevOpsOrgsClient) update(ctx context.Context, resourceGroupNa } // updateCreateRequest creates the Update request. -func (client *AzureDevOpsOrgsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, azureDevOpsOrg AzureDevOpsOrg, options *AzureDevOpsOrgsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *AzureDevOpsOrgsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, azureDevOpsOrg AzureDevOpsOrg, _ *AzureDevOpsOrgsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -402,9 +411,10 @@ func (client *AzureDevOpsOrgsClient) updateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, azureDevOpsOrg); err != nil { return nil, err } diff --git a/sdk/resourcemanager/security/armsecurity/azuredevopsprojects_client.go b/sdk/resourcemanager/security/armsecurity/azuredevopsprojects_client.go index ca49a77d1110..c829309841bc 100644 --- a/sdk/resourcemanager/security/armsecurity/azuredevopsprojects_client.go +++ b/sdk/resourcemanager/security/armsecurity/azuredevopsprojects_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type AzureDevOpsProjectsClient struct { } // NewAzureDevOpsProjectsClient creates a new instance of AzureDevOpsProjectsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewAzureDevOpsProjectsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureDevOpsProjectsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,13 +40,13 @@ func NewAzureDevOpsProjectsClient(subscriptionID string, credential azcore.Token } // BeginCreateOrUpdate - Creates or updates a monitored Azure DevOps project resource. +// +// Creates or updates a monitored Azure DevOps project resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - orgName - The Azure DevOps organization name. -// - projectName - The project name. // - azureDevOpsProject - The Azure DevOps project resource payload. // - options - AzureDevOpsProjectsClientBeginCreateOrUpdateOptions contains the optional parameters for the AzureDevOpsProjectsClient.BeginCreateOrUpdate // method. @@ -58,8 +57,7 @@ func (client *AzureDevOpsProjectsClient) BeginCreateOrUpdate(ctx context.Context return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureDevOpsProjectsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -70,9 +68,11 @@ func (client *AzureDevOpsProjectsClient) BeginCreateOrUpdate(ctx context.Context } // CreateOrUpdate - Creates or updates a monitored Azure DevOps project resource. +// +// Creates or updates a monitored Azure DevOps project resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview func (client *AzureDevOpsProjectsClient) createOrUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, azureDevOpsProject AzureDevOpsProject, options *AzureDevOpsProjectsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AzureDevOpsProjectsClient.BeginCreateOrUpdate" @@ -95,7 +95,7 @@ func (client *AzureDevOpsProjectsClient) createOrUpdate(ctx context.Context, res } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AzureDevOpsProjectsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, azureDevOpsProject AzureDevOpsProject, options *AzureDevOpsProjectsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AzureDevOpsProjectsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, azureDevOpsProject AzureDevOpsProject, _ *AzureDevOpsProjectsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -122,9 +122,10 @@ func (client *AzureDevOpsProjectsClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, azureDevOpsProject); err != nil { return nil, err } @@ -132,13 +133,13 @@ func (client *AzureDevOpsProjectsClient) createOrUpdateCreateRequest(ctx context } // Get - Returns a monitored Azure DevOps project resource. +// +// Returns a monitored Azure DevOps project resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - orgName - The Azure DevOps organization name. -// - projectName - The project name. // - options - AzureDevOpsProjectsClientGetOptions contains the optional parameters for the AzureDevOpsProjectsClient.Get method. func (client *AzureDevOpsProjectsClient) Get(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, options *AzureDevOpsProjectsClientGetOptions) (AzureDevOpsProjectsClientGetResponse, error) { var err error @@ -163,7 +164,7 @@ func (client *AzureDevOpsProjectsClient) Get(ctx context.Context, resourceGroupN } // getCreateRequest creates the Get request. -func (client *AzureDevOpsProjectsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, options *AzureDevOpsProjectsClientGetOptions) (*policy.Request, error) { +func (client *AzureDevOpsProjectsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, _ *AzureDevOpsProjectsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -190,7 +191,7 @@ func (client *AzureDevOpsProjectsClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -207,10 +208,11 @@ func (client *AzureDevOpsProjectsClient) getHandleResponse(resp *http.Response) // NewListPager - Returns a list of Azure DevOps projects onboarded to the connector. // -// Generated from API version 2023-09-01-preview +// Returns a list of Azure DevOps projects onboarded to the connector. +// +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - orgName - The Azure DevOps organization name. // - options - AzureDevOpsProjectsClientListOptions contains the optional parameters for the AzureDevOpsProjectsClient.NewListPager // method. func (client *AzureDevOpsProjectsClient) NewListPager(resourceGroupName string, securityConnectorName string, orgName string, options *AzureDevOpsProjectsClientListOptions) *runtime.Pager[AzureDevOpsProjectsClientListResponse] { @@ -237,7 +239,7 @@ func (client *AzureDevOpsProjectsClient) NewListPager(resourceGroupName string, } // listCreateRequest creates the List request. -func (client *AzureDevOpsProjectsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, options *AzureDevOpsProjectsClientListOptions) (*policy.Request, error) { +func (client *AzureDevOpsProjectsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, _ *AzureDevOpsProjectsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -260,7 +262,7 @@ func (client *AzureDevOpsProjectsClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -276,13 +278,13 @@ func (client *AzureDevOpsProjectsClient) listHandleResponse(resp *http.Response) } // BeginUpdate - Updates a monitored Azure DevOps project resource. +// +// Updates a monitored Azure DevOps project resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - orgName - The Azure DevOps organization name. -// - projectName - The project name. // - azureDevOpsProject - The Azure DevOps project resource payload. // - options - AzureDevOpsProjectsClientBeginUpdateOptions contains the optional parameters for the AzureDevOpsProjectsClient.BeginUpdate // method. @@ -293,8 +295,7 @@ func (client *AzureDevOpsProjectsClient) BeginUpdate(ctx context.Context, resour return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureDevOpsProjectsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -305,9 +306,11 @@ func (client *AzureDevOpsProjectsClient) BeginUpdate(ctx context.Context, resour } // Update - Updates a monitored Azure DevOps project resource. +// +// Updates a monitored Azure DevOps project resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview func (client *AzureDevOpsProjectsClient) update(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, azureDevOpsProject AzureDevOpsProject, options *AzureDevOpsProjectsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "AzureDevOpsProjectsClient.BeginUpdate" @@ -330,7 +333,7 @@ func (client *AzureDevOpsProjectsClient) update(ctx context.Context, resourceGro } // updateCreateRequest creates the Update request. -func (client *AzureDevOpsProjectsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, azureDevOpsProject AzureDevOpsProject, options *AzureDevOpsProjectsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *AzureDevOpsProjectsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, azureDevOpsProject AzureDevOpsProject, _ *AzureDevOpsProjectsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -357,9 +360,10 @@ func (client *AzureDevOpsProjectsClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, azureDevOpsProject); err != nil { return nil, err } diff --git a/sdk/resourcemanager/security/armsecurity/azuredevopsrepos_client.go b/sdk/resourcemanager/security/armsecurity/azuredevopsrepos_client.go index a14d88686758..ff4d48adba06 100644 --- a/sdk/resourcemanager/security/armsecurity/azuredevopsrepos_client.go +++ b/sdk/resourcemanager/security/armsecurity/azuredevopsrepos_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type AzureDevOpsReposClient struct { } // NewAzureDevOpsReposClient creates a new instance of AzureDevOpsReposClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewAzureDevOpsReposClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AzureDevOpsReposClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,14 +40,13 @@ func NewAzureDevOpsReposClient(subscriptionID string, credential azcore.TokenCre } // BeginCreateOrUpdate - Creates or updates a monitored Azure DevOps repository resource. +// +// Creates or updates a monitored Azure DevOps repository resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - orgName - The Azure DevOps organization name. -// - projectName - The project name. -// - repoName - The repository name. // - azureDevOpsRepository - The Azure DevOps repository resource payload. // - options - AzureDevOpsReposClientBeginCreateOrUpdateOptions contains the optional parameters for the AzureDevOpsReposClient.BeginCreateOrUpdate // method. @@ -59,8 +57,7 @@ func (client *AzureDevOpsReposClient) BeginCreateOrUpdate(ctx context.Context, r return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureDevOpsReposClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -71,9 +68,11 @@ func (client *AzureDevOpsReposClient) BeginCreateOrUpdate(ctx context.Context, r } // CreateOrUpdate - Creates or updates a monitored Azure DevOps repository resource. +// +// Creates or updates a monitored Azure DevOps repository resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview func (client *AzureDevOpsReposClient) createOrUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, repoName string, azureDevOpsRepository AzureDevOpsRepository, options *AzureDevOpsReposClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "AzureDevOpsReposClient.BeginCreateOrUpdate" @@ -96,7 +95,7 @@ func (client *AzureDevOpsReposClient) createOrUpdate(ctx context.Context, resour } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *AzureDevOpsReposClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, repoName string, azureDevOpsRepository AzureDevOpsRepository, options *AzureDevOpsReposClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *AzureDevOpsReposClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, repoName string, azureDevOpsRepository AzureDevOpsRepository, _ *AzureDevOpsReposClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -127,9 +126,10 @@ func (client *AzureDevOpsReposClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, azureDevOpsRepository); err != nil { return nil, err } @@ -137,14 +137,13 @@ func (client *AzureDevOpsReposClient) createOrUpdateCreateRequest(ctx context.Co } // Get - Returns a monitored Azure DevOps repository resource. +// +// Returns a monitored Azure DevOps repository resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - orgName - The Azure DevOps organization name. -// - projectName - The project name. -// - repoName - The repository name. // - options - AzureDevOpsReposClientGetOptions contains the optional parameters for the AzureDevOpsReposClient.Get method. func (client *AzureDevOpsReposClient) Get(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, repoName string, options *AzureDevOpsReposClientGetOptions) (AzureDevOpsReposClientGetResponse, error) { var err error @@ -169,7 +168,7 @@ func (client *AzureDevOpsReposClient) Get(ctx context.Context, resourceGroupName } // getCreateRequest creates the Get request. -func (client *AzureDevOpsReposClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, repoName string, options *AzureDevOpsReposClientGetOptions) (*policy.Request, error) { +func (client *AzureDevOpsReposClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, repoName string, _ *AzureDevOpsReposClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -200,7 +199,7 @@ func (client *AzureDevOpsReposClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -217,11 +216,11 @@ func (client *AzureDevOpsReposClient) getHandleResponse(resp *http.Response) (Az // NewListPager - Returns a list of Azure DevOps repositories onboarded to the connector. // -// Generated from API version 2023-09-01-preview +// Returns a list of Azure DevOps repositories onboarded to the connector. +// +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - orgName - The Azure DevOps organization name. -// - projectName - The project name. // - options - AzureDevOpsReposClientListOptions contains the optional parameters for the AzureDevOpsReposClient.NewListPager // method. func (client *AzureDevOpsReposClient) NewListPager(resourceGroupName string, securityConnectorName string, orgName string, projectName string, options *AzureDevOpsReposClientListOptions) *runtime.Pager[AzureDevOpsReposClientListResponse] { @@ -248,7 +247,7 @@ func (client *AzureDevOpsReposClient) NewListPager(resourceGroupName string, sec } // listCreateRequest creates the List request. -func (client *AzureDevOpsReposClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, options *AzureDevOpsReposClientListOptions) (*policy.Request, error) { +func (client *AzureDevOpsReposClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, _ *AzureDevOpsReposClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -275,7 +274,7 @@ func (client *AzureDevOpsReposClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -291,14 +290,13 @@ func (client *AzureDevOpsReposClient) listHandleResponse(resp *http.Response) (A } // BeginUpdate - Updates a monitored Azure DevOps repository resource. +// +// Updates a monitored Azure DevOps repository resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - orgName - The Azure DevOps organization name. -// - projectName - The project name. -// - repoName - The repository name. // - azureDevOpsRepository - The Azure DevOps repository resource payload. // - options - AzureDevOpsReposClientBeginUpdateOptions contains the optional parameters for the AzureDevOpsReposClient.BeginUpdate // method. @@ -309,8 +307,7 @@ func (client *AzureDevOpsReposClient) BeginUpdate(ctx context.Context, resourceG return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[AzureDevOpsReposClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -321,9 +318,11 @@ func (client *AzureDevOpsReposClient) BeginUpdate(ctx context.Context, resourceG } // Update - Updates a monitored Azure DevOps repository resource. +// +// Updates a monitored Azure DevOps repository resource. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview func (client *AzureDevOpsReposClient) update(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, repoName string, azureDevOpsRepository AzureDevOpsRepository, options *AzureDevOpsReposClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "AzureDevOpsReposClient.BeginUpdate" @@ -346,7 +345,7 @@ func (client *AzureDevOpsReposClient) update(ctx context.Context, resourceGroupN } // updateCreateRequest creates the Update request. -func (client *AzureDevOpsReposClient) updateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, repoName string, azureDevOpsRepository AzureDevOpsRepository, options *AzureDevOpsReposClientBeginUpdateOptions) (*policy.Request, error) { +func (client *AzureDevOpsReposClient) updateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, orgName string, projectName string, repoName string, azureDevOpsRepository AzureDevOpsRepository, _ *AzureDevOpsReposClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/azureDevOpsOrgs/{orgName}/projects/{projectName}/repos/{repoName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -377,9 +376,10 @@ func (client *AzureDevOpsReposClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, azureDevOpsRepository); err != nil { return nil, err } diff --git a/sdk/resourcemanager/security/armsecurity/build.go b/sdk/resourcemanager/security/armsecurity/build.go deleted file mode 100644 index 1699c862d02b..000000000000 --- a/sdk/resourcemanager/security/armsecurity/build.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. - -// This file enables 'go generate' to regenerate this specific SDK -//go:generate pwsh ../../../../eng/scripts/build.ps1 -skipBuild -cleanGenerated -format -tidy -generate resourcemanager/security/armsecurity - -package armsecurity diff --git a/sdk/resourcemanager/security/armsecurity/client_factory.go b/sdk/resourcemanager/security/armsecurity/client_factory.go index 9705929dd3ec..d82142ce65f5 100644 --- a/sdk/resourcemanager/security/armsecurity/client_factory.go +++ b/sdk/resourcemanager/security/armsecurity/client_factory.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -19,7 +18,7 @@ type ClientFactory struct { // NewClientFactory creates a new instance of ClientFactory with the specified values. // The parameter values will be propagated to any client created from this factory. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. // - options - pass nil to accept the default values. func NewClientFactory(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ClientFactory, error) { @@ -41,30 +40,6 @@ func (c *ClientFactory) NewAPICollectionsClient() *APICollectionsClient { } } -// NewAccountConnectorsClient creates a new instance of AccountConnectorsClient. -func (c *ClientFactory) NewAccountConnectorsClient() *AccountConnectorsClient { - return &AccountConnectorsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewAdaptiveApplicationControlsClient creates a new instance of AdaptiveApplicationControlsClient. -func (c *ClientFactory) NewAdaptiveApplicationControlsClient() *AdaptiveApplicationControlsClient { - return &AdaptiveApplicationControlsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewAdaptiveNetworkHardeningsClient creates a new instance of AdaptiveNetworkHardeningsClient. -func (c *ClientFactory) NewAdaptiveNetworkHardeningsClient() *AdaptiveNetworkHardeningsClient { - return &AdaptiveNetworkHardeningsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - // NewAdvancedThreatProtectionClient creates a new instance of AdvancedThreatProtectionClient. func (c *ClientFactory) NewAdvancedThreatProtectionClient() *AdvancedThreatProtectionClient { return &AdvancedThreatProtectionClient{ @@ -127,6 +102,14 @@ func (c *ClientFactory) NewAssessmentsMetadataClient() *AssessmentsMetadataClien } } +// NewAssignmentsClient creates a new instance of AssignmentsClient. +func (c *ClientFactory) NewAssignmentsClient() *AssignmentsClient { + return &AssignmentsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewAutoProvisioningSettingsClient creates a new instance of AutoProvisioningSettingsClient. func (c *ClientFactory) NewAutoProvisioningSettingsClient() *AutoProvisioningSettingsClient { return &AutoProvisioningSettingsClient{ @@ -213,19 +196,10 @@ func (c *ClientFactory) NewContactsClient() *ContactsClient { } } -// NewCustomAssessmentAutomationsClient creates a new instance of CustomAssessmentAutomationsClient. -func (c *ClientFactory) NewCustomAssessmentAutomationsClient() *CustomAssessmentAutomationsClient { - return &CustomAssessmentAutomationsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - -// NewCustomEntityStoreAssignmentsClient creates a new instance of CustomEntityStoreAssignmentsClient. -func (c *ClientFactory) NewCustomEntityStoreAssignmentsClient() *CustomEntityStoreAssignmentsClient { - return &CustomEntityStoreAssignmentsClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, +// NewCustomRecommendationsClient creates a new instance of CustomRecommendationsClient. +func (c *ClientFactory) NewCustomRecommendationsClient() *CustomRecommendationsClient { + return &CustomRecommendationsClient{ + internal: c.internal, } } @@ -275,6 +249,14 @@ func (c *ClientFactory) NewExternalSecuritySolutionsClient() *ExternalSecuritySo } } +// NewGitHubIssuesClient creates a new instance of GitHubIssuesClient. +func (c *ClientFactory) NewGitHubIssuesClient() *GitHubIssuesClient { + return &GitHubIssuesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewGitHubOwnersClient creates a new instance of GitHubOwnersClient. func (c *ClientFactory) NewGitHubOwnersClient() *GitHubOwnersClient { return &GitHubOwnersClient{ @@ -399,6 +381,22 @@ func (c *ClientFactory) NewMdeOnboardingsClient() *MdeOnboardingsClient { } } +// NewOperationResultsClient creates a new instance of OperationResultsClient. +func (c *ClientFactory) NewOperationResultsClient() *OperationResultsClient { + return &OperationResultsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewOperationStatusesClient creates a new instance of OperationStatusesClient. +func (c *ClientFactory) NewOperationStatusesClient() *OperationStatusesClient { + return &OperationStatusesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewOperationsClient creates a new instance of OperationsClient. func (c *ClientFactory) NewOperationsClient() *OperationsClient { return &OperationsClient{ @@ -421,6 +419,30 @@ func (c *ClientFactory) NewPricingsClient() *PricingsClient { } } +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient. +func (c *ClientFactory) NewPrivateEndpointConnectionsClient() *PrivateEndpointConnectionsClient { + return &PrivateEndpointConnectionsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient. +func (c *ClientFactory) NewPrivateLinkResourcesClient() *PrivateLinkResourcesClient { + return &PrivateLinkResourcesClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + +// NewPrivateLinksClient creates a new instance of PrivateLinksClient. +func (c *ClientFactory) NewPrivateLinksClient() *PrivateLinksClient { + return &PrivateLinksClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewRegulatoryComplianceAssessmentsClient creates a new instance of RegulatoryComplianceAssessmentsClient. func (c *ClientFactory) NewRegulatoryComplianceAssessmentsClient() *RegulatoryComplianceAssessmentsClient { return &RegulatoryComplianceAssessmentsClient{ @@ -466,6 +488,13 @@ func (c *ClientFactory) NewSQLVulnerabilityAssessmentScansClient() *SQLVulnerabi } } +// NewSQLVulnerabilityAssessmentSettingsClient creates a new instance of SQLVulnerabilityAssessmentSettingsClient. +func (c *ClientFactory) NewSQLVulnerabilityAssessmentSettingsClient() *SQLVulnerabilityAssessmentSettingsClient { + return &SQLVulnerabilityAssessmentSettingsClient{ + internal: c.internal, + } +} + // NewSecureScoreControlDefinitionsClient creates a new instance of SecureScoreControlDefinitionsClient. func (c *ClientFactory) NewSecureScoreControlDefinitionsClient() *SecureScoreControlDefinitionsClient { return &SecureScoreControlDefinitionsClient{ @@ -521,14 +550,6 @@ func (c *ClientFactory) NewSettingsClient() *SettingsClient { } } -// NewSoftwareInventoriesClient creates a new instance of SoftwareInventoriesClient. -func (c *ClientFactory) NewSoftwareInventoriesClient() *SoftwareInventoriesClient { - return &SoftwareInventoriesClient{ - subscriptionID: c.subscriptionID, - internal: c.internal, - } -} - // NewSolutionsClient creates a new instance of SolutionsClient. func (c *ClientFactory) NewSolutionsClient() *SolutionsClient { return &SolutionsClient{ @@ -545,6 +566,28 @@ func (c *ClientFactory) NewSolutionsReferenceDataClient() *SolutionsReferenceDat } } +// NewStandardAssignmentsClient creates a new instance of StandardAssignmentsClient. +func (c *ClientFactory) NewStandardAssignmentsClient() *StandardAssignmentsClient { + return &StandardAssignmentsClient{ + internal: c.internal, + } +} + +// NewStandardsClient creates a new instance of StandardsClient. +func (c *ClientFactory) NewStandardsClient() *StandardsClient { + return &StandardsClient{ + internal: c.internal, + } +} + +// NewStandardsClient creates a new instance of StandardsClient. +func (c *ClientFactory) NewStandardsClient() *StandardsClient { + return &StandardsClient{ + subscriptionID: c.subscriptionID, + internal: c.internal, + } +} + // NewSubAssessmentsClient creates a new instance of SubAssessmentsClient. func (c *ClientFactory) NewSubAssessmentsClient() *SubAssessmentsClient { return &SubAssessmentsClient{ diff --git a/sdk/resourcemanager/security/armsecurity/complianceresults_client.go b/sdk/resourcemanager/security/armsecurity/complianceresults_client.go index 07ada5e97983..9a23c0b89cd0 100644 --- a/sdk/resourcemanager/security/armsecurity/complianceresults_client.go +++ b/sdk/resourcemanager/security/armsecurity/complianceresults_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,7 +24,7 @@ type ComplianceResultsClient struct { // NewComplianceResultsClient creates a new instance of ComplianceResultsClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewComplianceResultsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ComplianceResultsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,8 +40,8 @@ func NewComplianceResultsClient(credential azcore.TokenCredential, options *arm. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2017-08-01 -// - resourceID - The identifier of the resource. -// - complianceResultName - name of the desired assessment compliance result +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. +// - complianceResultName - The compliance result key. // - options - ComplianceResultsClientGetOptions contains the optional parameters for the ComplianceResultsClient.Get method. func (client *ComplianceResultsClient) Get(ctx context.Context, resourceID string, complianceResultName string, options *ComplianceResultsClientGetOptions) (ComplianceResultsClientGetResponse, error) { var err error @@ -67,8 +66,11 @@ func (client *ComplianceResultsClient) Get(ctx context.Context, resourceID strin } // getCreateRequest creates the Get request. -func (client *ComplianceResultsClient) getCreateRequest(ctx context.Context, resourceID string, complianceResultName string, options *ComplianceResultsClientGetOptions) (*policy.Request, error) { +func (client *ComplianceResultsClient) getCreateRequest(ctx context.Context, resourceID string, complianceResultName string, _ *ComplianceResultsClientGetOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if complianceResultName == "" { return nil, errors.New("parameter complianceResultName cannot be empty") @@ -97,8 +99,7 @@ func (client *ComplianceResultsClient) getHandleResponse(resp *http.Response) (C // NewListPager - Security compliance results in the subscription // // 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). +// - scope - The fully qualified Azure Resource manager identifier of the resource. // - options - ComplianceResultsClientListOptions contains the optional parameters for the ComplianceResultsClient.NewListPager // method. func (client *ComplianceResultsClient) NewListPager(scope string, options *ComplianceResultsClientListOptions) *runtime.Pager[ComplianceResultsClientListResponse] { @@ -125,8 +126,11 @@ func (client *ComplianceResultsClient) NewListPager(scope string, options *Compl } // listCreateRequest creates the List request. -func (client *ComplianceResultsClient) listCreateRequest(ctx context.Context, scope string, options *ComplianceResultsClientListOptions) (*policy.Request, error) { +func (client *ComplianceResultsClient) listCreateRequest(ctx context.Context, scope string, _ *ComplianceResultsClientListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/complianceResults" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/sdk/resourcemanager/security/armsecurity/compliances_client.go b/sdk/resourcemanager/security/armsecurity/compliances_client.go index 6d525116194f..b75e0e1c149a 100644 --- a/sdk/resourcemanager/security/armsecurity/compliances_client.go +++ b/sdk/resourcemanager/security/armsecurity/compliances_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,7 +24,7 @@ type CompliancesClient struct { // NewCompliancesClient creates a new instance of CompliancesClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewCompliancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*CompliancesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,8 +40,7 @@ func NewCompliancesClient(credential azcore.TokenCredential, options *arm.Client // 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). +// - scope - The fully qualified Azure Resource manager identifier of the resource. // - complianceName - name of the Compliance // - options - CompliancesClientGetOptions contains the optional parameters for the CompliancesClient.Get method. func (client *CompliancesClient) Get(ctx context.Context, scope string, complianceName string, options *CompliancesClientGetOptions) (CompliancesClientGetResponse, error) { @@ -68,8 +66,11 @@ func (client *CompliancesClient) Get(ctx context.Context, scope string, complian } // getCreateRequest creates the Get request. -func (client *CompliancesClient) getCreateRequest(ctx context.Context, scope string, complianceName string, options *CompliancesClientGetOptions) (*policy.Request, error) { +func (client *CompliancesClient) getCreateRequest(ctx context.Context, scope string, complianceName string, _ *CompliancesClientGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/compliances/{complianceName}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if complianceName == "" { return nil, errors.New("parameter complianceName cannot be empty") @@ -98,8 +99,7 @@ func (client *CompliancesClient) getHandleResponse(resp *http.Response) (Complia // NewListPager - The Compliance scores of the specific management group. // // 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). +// - scope - The fully qualified Azure Resource manager identifier of the resource. // - options - CompliancesClientListOptions contains the optional parameters for the CompliancesClient.NewListPager method. func (client *CompliancesClient) NewListPager(scope string, options *CompliancesClientListOptions) *runtime.Pager[CompliancesClientListResponse] { return runtime.NewPager(runtime.PagingHandler[CompliancesClientListResponse]{ @@ -125,8 +125,11 @@ func (client *CompliancesClient) NewListPager(scope string, options *Compliances } // listCreateRequest creates the List request. -func (client *CompliancesClient) listCreateRequest(ctx context.Context, scope string, options *CompliancesClientListOptions) (*policy.Request, error) { +func (client *CompliancesClient) listCreateRequest(ctx context.Context, scope string, _ *CompliancesClientListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/compliances" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/sdk/resourcemanager/security/armsecurity/connectorapplication_client.go b/sdk/resourcemanager/security/armsecurity/connectorapplication_client.go index 922d939fcaf4..3fe76f1be30e 100644 --- a/sdk/resourcemanager/security/armsecurity/connectorapplication_client.go +++ b/sdk/resourcemanager/security/armsecurity/connectorapplication_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -17,7 +16,7 @@ import ( "strings" ) -// ConnectorApplicationClient contains the methods for the SecurityConnectorApplication group. +// ConnectorApplicationClient contains the methods for the ConnectorApplication group. // Don't use this type directly, use NewConnectorApplicationClient() instead. type ConnectorApplicationClient struct { internal *arm.Client @@ -25,9 +24,9 @@ type ConnectorApplicationClient struct { } // NewConnectorApplicationClient creates a new instance of ConnectorApplicationClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewConnectorApplicationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectorApplicationClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -44,7 +43,7 @@ func NewConnectorApplicationClient(subscriptionID string, credential azcore.Toke // 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. +// - resourceGroupName - The name of the resource group. 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 @@ -73,7 +72,7 @@ func (client *ConnectorApplicationClient) CreateOrUpdate(ctx context.Context, re } // 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) { +func (client *ConnectorApplicationClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, application Application, _ *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") @@ -99,6 +98,7 @@ func (client *ConnectorApplicationClient) createOrUpdateCreateRequest(ctx contex reqQP.Set("api-version", "2022-07-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, application); err != nil { return nil, err } @@ -118,7 +118,7 @@ func (client *ConnectorApplicationClient) createOrUpdateHandleResponse(resp *htt // 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. +// - resourceGroupName - The name of the resource group. 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 @@ -145,7 +145,7 @@ func (client *ConnectorApplicationClient) Delete(ctx context.Context, resourceGr } // deleteCreateRequest creates the Delete request. -func (client *ConnectorApplicationClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, options *ConnectorApplicationClientDeleteOptions) (*policy.Request, error) { +func (client *ConnectorApplicationClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, _ *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") @@ -177,7 +177,7 @@ func (client *ConnectorApplicationClient) deleteCreateRequest(ctx context.Contex // 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. +// - resourceGroupName - The name of the resource group. 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 @@ -205,7 +205,7 @@ func (client *ConnectorApplicationClient) Get(ctx context.Context, resourceGroup } // getCreateRequest creates the Get request. -func (client *ConnectorApplicationClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, options *ConnectorApplicationClientGetOptions) (*policy.Request, error) { +func (client *ConnectorApplicationClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, applicationID string, _ *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") diff --git a/sdk/resourcemanager/security/armsecurity/connectorapplications_client.go b/sdk/resourcemanager/security/armsecurity/connectorapplications_client.go index c491aefa5f84..85c0a4d468b3 100644 --- a/sdk/resourcemanager/security/armsecurity/connectorapplications_client.go +++ b/sdk/resourcemanager/security/armsecurity/connectorapplications_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -17,7 +16,7 @@ import ( "strings" ) -// ConnectorApplicationsClient contains the methods for the SecurityConnectorApplications group. +// ConnectorApplicationsClient contains the methods for the ConnectorApplications group. // Don't use this type directly, use NewConnectorApplicationsClient() instead. type ConnectorApplicationsClient struct { internal *arm.Client @@ -25,9 +24,9 @@ type ConnectorApplicationsClient struct { } // NewConnectorApplicationsClient creates a new instance of ConnectorApplicationsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewConnectorApplicationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectorApplicationsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -43,7 +42,7 @@ func NewConnectorApplicationsClient(subscriptionID string, credential azcore.Tok // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. // - options - ConnectorApplicationsClientListOptions contains the optional parameters for the ConnectorApplicationsClient.NewListPager // method. @@ -71,7 +70,7 @@ func (client *ConnectorApplicationsClient) NewListPager(resourceGroupName string } // listCreateRequest creates the List request. -func (client *ConnectorApplicationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *ConnectorApplicationsClientListOptions) (*policy.Request, error) { +func (client *ConnectorApplicationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, _ *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") diff --git a/sdk/resourcemanager/security/armsecurity/connectors_client.go b/sdk/resourcemanager/security/armsecurity/connectors_client.go index 037e14e28122..0a740e089c0a 100644 --- a/sdk/resourcemanager/security/armsecurity/connectors_client.go +++ b/sdk/resourcemanager/security/armsecurity/connectors_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -17,7 +16,7 @@ import ( "strings" ) -// ConnectorsClient contains the methods for the SecurityConnectors group. +// ConnectorsClient contains the methods for the Connectors group. // Don't use this type directly, use NewConnectorsClient() instead. type ConnectorsClient struct { internal *arm.Client @@ -25,9 +24,9 @@ type ConnectorsClient struct { } // NewConnectorsClient creates a new instance of ConnectorsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewConnectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ConnectorsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -44,8 +43,8 @@ func NewConnectorsClient(subscriptionID string, credential azcore.TokenCredentia // 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 2024-03-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// Generated from API version 2024-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. // - securityConnector - The security connector resource // - options - ConnectorsClientCreateOrUpdateOptions contains the optional parameters for the ConnectorsClient.CreateOrUpdate @@ -73,7 +72,7 @@ func (client *ConnectorsClient) CreateOrUpdate(ctx context.Context, resourceGrou } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ConnectorsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, securityConnector Connector, options *ConnectorsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ConnectorsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, securityConnector Connector, _ *ConnectorsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -92,9 +91,10 @@ func (client *ConnectorsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, securityConnector); err != nil { return nil, err } @@ -113,8 +113,8 @@ 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 2024-03-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// Generated from API version 2024-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. // - options - ConnectorsClientDeleteOptions contains the optional parameters for the ConnectorsClient.Delete method. func (client *ConnectorsClient) Delete(ctx context.Context, resourceGroupName string, securityConnectorName string, options *ConnectorsClientDeleteOptions) (ConnectorsClientDeleteResponse, error) { @@ -139,7 +139,7 @@ func (client *ConnectorsClient) Delete(ctx context.Context, resourceGroupName st } // deleteCreateRequest creates the Delete request. -func (client *ConnectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *ConnectorsClientDeleteOptions) (*policy.Request, error) { +func (client *ConnectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, _ *ConnectorsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -158,17 +158,16 @@ func (client *ConnectorsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Retrieves details of a specific security connector // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2024-03-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// Generated from API version 2024-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. // - options - ConnectorsClientGetOptions contains the optional parameters for the ConnectorsClient.Get method. func (client *ConnectorsClient) Get(ctx context.Context, resourceGroupName string, securityConnectorName string, options *ConnectorsClientGetOptions) (ConnectorsClientGetResponse, error) { @@ -194,7 +193,7 @@ func (client *ConnectorsClient) Get(ctx context.Context, resourceGroupName strin } // getCreateRequest creates the Get request. -func (client *ConnectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *ConnectorsClientGetOptions) (*policy.Request, error) { +func (client *ConnectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, _ *ConnectorsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -213,7 +212,7 @@ func (client *ConnectorsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -231,7 +230,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. // -// Generated from API version 2024-03-01-preview +// Generated from API version 2024-08-01-preview // - options - ConnectorsClientListOptions contains the optional parameters for the ConnectorsClient.NewListPager method. func (client *ConnectorsClient) NewListPager(options *ConnectorsClientListOptions) *runtime.Pager[ConnectorsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[ConnectorsClientListResponse]{ @@ -257,7 +256,7 @@ func (client *ConnectorsClient) NewListPager(options *ConnectorsClientListOption } // listCreateRequest creates the List request. -func (client *ConnectorsClient) listCreateRequest(ctx context.Context, options *ConnectorsClientListOptions) (*policy.Request, error) { +func (client *ConnectorsClient) listCreateRequest(ctx context.Context, _ *ConnectorsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -268,7 +267,7 @@ func (client *ConnectorsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -286,8 +285,8 @@ 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. // -// Generated from API version 2024-03-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// Generated from API version 2024-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - ConnectorsClientListByResourceGroupOptions contains the optional parameters for the ConnectorsClient.NewListByResourceGroupPager // method. func (client *ConnectorsClient) NewListByResourceGroupPager(resourceGroupName string, options *ConnectorsClientListByResourceGroupOptions) *runtime.Pager[ConnectorsClientListByResourceGroupResponse] { @@ -314,7 +313,7 @@ func (client *ConnectorsClient) NewListByResourceGroupPager(resourceGroupName st } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *ConnectorsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *ConnectorsClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *ConnectorsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *ConnectorsClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -329,7 +328,7 @@ func (client *ConnectorsClient) listByResourceGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -347,8 +346,8 @@ 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 2024-03-01-preview -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// Generated from API version 2024-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. // - securityConnector - The security connector resource // - options - ConnectorsClientUpdateOptions contains the optional parameters for the ConnectorsClient.Update method. @@ -375,7 +374,7 @@ func (client *ConnectorsClient) Update(ctx context.Context, resourceGroupName st } // updateCreateRequest creates the Update request. -func (client *ConnectorsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, securityConnector Connector, options *ConnectorsClientUpdateOptions) (*policy.Request, error) { +func (client *ConnectorsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, securityConnector Connector, _ *ConnectorsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -394,9 +393,10 @@ func (client *ConnectorsClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2024-03-01-preview") + reqQP.Set("api-version", "2024-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, securityConnector); err != nil { return nil, err } diff --git a/sdk/resourcemanager/security/armsecurity/constants.go b/sdk/resourcemanager/security/armsecurity/constants.go index 6315e464d106..984c7f1bf767 100644 --- a/sdk/resourcemanager/security/armsecurity/constants.go +++ b/sdk/resourcemanager/security/armsecurity/constants.go @@ -1,21 +1,18 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity -const ( - moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" - moduleVersion = "v0.14.0" -) - // AADConnectivityState - The connectivity state of the external AAD solution type AADConnectivityState string const ( - AADConnectivityStateConnected AADConnectivityState = "Connected" - AADConnectivityStateDiscovered AADConnectivityState = "Discovered" + // AADConnectivityStateConnected - Connected + AADConnectivityStateConnected AADConnectivityState = "Connected" + // AADConnectivityStateDiscovered - Discovered + AADConnectivityStateDiscovered AADConnectivityState = "Discovered" + // AADConnectivityStateNotLicensed - NotLicensed AADConnectivityStateNotLicensed AADConnectivityState = "NotLicensed" ) @@ -28,12 +25,17 @@ func PossibleAADConnectivityStateValues() []AADConnectivityState { } } -// ActionType - The type of the action that will be triggered by the Automation +// ActionType - Enum. Indicates the action type. type ActionType string const ( - ActionTypeEventHub ActionType = "EventHub" - ActionTypeLogicApp ActionType = "LogicApp" + // ActionTypeEventHub - EventHub + ActionTypeEventHub ActionType = "EventHub" + // ActionTypeInternal - Internal + ActionTypeInternal ActionType = "Internal" + // ActionTypeLogicApp - LogicApp + ActionTypeLogicApp ActionType = "LogicApp" + // ActionTypeWorkspace - Workspace ActionTypeWorkspace ActionType = "Workspace" ) @@ -41,19 +43,49 @@ const ( func PossibleActionTypeValues() []ActionType { return []ActionType{ ActionTypeEventHub, + ActionTypeInternal, ActionTypeLogicApp, ActionTypeWorkspace, } } -// ActionableRemediationState - ActionableRemediation Setting. None - the setting was never set. Enabled - ActionableRemediation -// is enabled. Disabled - ActionableRemediation is disabled. +// ActionType - Enum. Indicates the action type. +type ActionType string + +const ( + // ActionTypeEventHub - EventHub + ActionTypeEventHub ActionType = "EventHub" + // ActionTypeInternal - Internal + ActionTypeInternal ActionType = "Internal" + // ActionTypeLogicApp - LogicApp + ActionTypeLogicApp ActionType = "LogicApp" + // ActionTypeWorkspace - Workspace + ActionTypeWorkspace ActionType = "Workspace" +) + +// PossibleActionTypeValues returns the possible values for the ActionType const type. +func PossibleActionTypeValues() []ActionType { + return []ActionType{ + ActionTypeEventHub, + ActionTypeInternal, + ActionTypeLogicApp, + ActionTypeWorkspace, + } +} + +// ActionableRemediationState - ActionableRemediation Setting. +// None - the setting was never set. +// Enabled - ActionableRemediation is enabled. +// Disabled - ActionableRemediation is disabled. type ActionableRemediationState string const ( + // ActionableRemediationStateDisabled - Disabled ActionableRemediationStateDisabled ActionableRemediationState = "Disabled" - ActionableRemediationStateEnabled ActionableRemediationState = "Enabled" - ActionableRemediationStateNone ActionableRemediationState = "None" + // ActionableRemediationStateEnabled - Enabled + ActionableRemediationStateEnabled ActionableRemediationState = "Enabled" + // ActionableRemediationStateNone - None + ActionableRemediationStateNone ActionableRemediationState = "None" ) // PossibleActionableRemediationStateValues returns the possible values for the ActionableRemediationState const type. @@ -65,35 +97,13 @@ func PossibleActionableRemediationStateValues() []ActionableRemediationState { } } -// AdaptiveApplicationControlIssue - An alert that machines within a group can have -type AdaptiveApplicationControlIssue string - -const ( - AdaptiveApplicationControlIssueExecutableViolationsAudited AdaptiveApplicationControlIssue = "ExecutableViolationsAudited" - AdaptiveApplicationControlIssueMsiAndScriptViolationsAudited AdaptiveApplicationControlIssue = "MsiAndScriptViolationsAudited" - AdaptiveApplicationControlIssueMsiAndScriptViolationsBlocked AdaptiveApplicationControlIssue = "MsiAndScriptViolationsBlocked" - AdaptiveApplicationControlIssueRulesViolatedManually AdaptiveApplicationControlIssue = "RulesViolatedManually" - AdaptiveApplicationControlIssueViolationsAudited AdaptiveApplicationControlIssue = "ViolationsAudited" - AdaptiveApplicationControlIssueViolationsBlocked AdaptiveApplicationControlIssue = "ViolationsBlocked" -) - -// PossibleAdaptiveApplicationControlIssueValues returns the possible values for the AdaptiveApplicationControlIssue const type. -func PossibleAdaptiveApplicationControlIssueValues() []AdaptiveApplicationControlIssue { - return []AdaptiveApplicationControlIssue{ - AdaptiveApplicationControlIssueExecutableViolationsAudited, - AdaptiveApplicationControlIssueMsiAndScriptViolationsAudited, - AdaptiveApplicationControlIssueMsiAndScriptViolationsBlocked, - AdaptiveApplicationControlIssueRulesViolatedManually, - AdaptiveApplicationControlIssueViolationsAudited, - AdaptiveApplicationControlIssueViolationsBlocked, - } -} - // AdditionalWorkspaceDataType - Data types sent to workspace. type AdditionalWorkspaceDataType string const ( - AdditionalWorkspaceDataTypeAlerts AdditionalWorkspaceDataType = "Alerts" + // AdditionalWorkspaceDataTypeAlerts - Alerts + AdditionalWorkspaceDataTypeAlerts AdditionalWorkspaceDataType = "Alerts" + // AdditionalWorkspaceDataTypeRawEvents - RawEvents AdditionalWorkspaceDataTypeRawEvents AdditionalWorkspaceDataType = "RawEvents" ) @@ -109,6 +119,7 @@ func PossibleAdditionalWorkspaceDataTypeValues() []AdditionalWorkspaceDataType { type AdditionalWorkspaceType string const ( + // AdditionalWorkspaceTypeSentinel - Sentinel AdditionalWorkspaceTypeSentinel AdditionalWorkspaceType = "Sentinel" ) @@ -119,6 +130,27 @@ func PossibleAdditionalWorkspaceTypeValues() []AdditionalWorkspaceType { } } +// AgentlessEnablement - Agentless Enablement states. +type AgentlessEnablement string + +const ( + // AgentlessEnablementDisabled - Disabled + AgentlessEnablementDisabled AgentlessEnablement = "Disabled" + // AgentlessEnablementEnabled - Enabled + AgentlessEnablementEnabled AgentlessEnablement = "Enabled" + // AgentlessEnablementNotApplicable - NotApplicable + AgentlessEnablementNotApplicable AgentlessEnablement = "NotApplicable" +) + +// PossibleAgentlessEnablementValues returns the possible values for the AgentlessEnablement const type. +func PossibleAgentlessEnablementValues() []AgentlessEnablement { + return []AgentlessEnablement{ + AgentlessEnablementDisabled, + AgentlessEnablementEnabled, + AgentlessEnablementNotApplicable, + } +} + // 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 @@ -168,13 +200,15 @@ func PossibleAlertStatusValues() []AlertStatus { } // AnnotateDefaultBranchState - Configuration of PR Annotations on default branch. -// Enabled - PR Annotations are enabled on the resource's default branch. Disabled - PR Annotations are disabled on the resource's -// default branch. +// Enabled - PR Annotations are enabled on the resource's default branch. +// Disabled - PR Annotations are disabled on the resource's default branch. type AnnotateDefaultBranchState string const ( + // AnnotateDefaultBranchStateDisabled - Disabled AnnotateDefaultBranchStateDisabled AnnotateDefaultBranchState = "Disabled" - AnnotateDefaultBranchStateEnabled AnnotateDefaultBranchState = "Enabled" + // AnnotateDefaultBranchStateEnabled - Enabled + AnnotateDefaultBranchStateEnabled AnnotateDefaultBranchState = "Enabled" ) // PossibleAnnotateDefaultBranchStateValues returns the possible values for the AnnotateDefaultBranchState const type. @@ -185,30 +219,6 @@ func PossibleAnnotateDefaultBranchStateValues() []AnnotateDefaultBranchState { } } -// ApplicationConditionOperator - The application Condition's Operator, for example Contains for id or In for list of possible -// IDs, see examples -type ApplicationConditionOperator string - -const ( - // ApplicationConditionOperatorContains - Checks that the string value of the data defined in Property contains the given - // value - ApplicationConditionOperatorContains ApplicationConditionOperator = "Contains" - // ApplicationConditionOperatorEquals - Checks that the string value of the data defined in Property equals the given value - ApplicationConditionOperatorEquals ApplicationConditionOperator = "Equals" - // ApplicationConditionOperatorIn - Checks that the string value of the data defined in Property equals any of the given values - // (exact fit) - ApplicationConditionOperatorIn ApplicationConditionOperator = "In" -) - -// PossibleApplicationConditionOperatorValues returns the possible values for the ApplicationConditionOperator const type. -func PossibleApplicationConditionOperatorValues() []ApplicationConditionOperator { - return []ApplicationConditionOperator{ - ApplicationConditionOperatorContains, - ApplicationConditionOperatorEquals, - ApplicationConditionOperatorIn, - } -} - // ApplicationSourceResourceType - The application source, what it affects, e.g. Assessments type ApplicationSourceResourceType string @@ -228,9 +238,14 @@ func PossibleApplicationSourceResourceTypeValues() []ApplicationSourceResourceTy type AssessedResourceType string const ( + // AssessedResourceTypeContainerRegistryVulnerability - ContainerRegistryVulnerability AssessedResourceTypeContainerRegistryVulnerability AssessedResourceType = "ContainerRegistryVulnerability" - AssessedResourceTypeSQLServerVulnerability AssessedResourceType = "SqlServerVulnerability" - AssessedResourceTypeServerVulnerability AssessedResourceType = "ServerVulnerability" + // AssessedResourceTypeSQLServerVulnerability - SqlServerVulnerability + AssessedResourceTypeSQLServerVulnerability AssessedResourceType = "SqlServerVulnerability" + // AssessedResourceTypeServerVulnerability - ServerVulnerability + AssessedResourceTypeServerVulnerability AssessedResourceType = "ServerVulnerability" + // AssessedResourceTypeServerVulnerabilityAssessment - ServerVulnerabilityAssessment + AssessedResourceTypeServerVulnerabilityAssessment AssessedResourceType = "ServerVulnerabilityAssessment" ) // PossibleAssessedResourceTypeValues returns the possible values for the AssessedResourceType const type. @@ -239,6 +254,7 @@ func PossibleAssessedResourceTypeValues() []AssessedResourceType { AssessedResourceTypeContainerRegistryVulnerability, AssessedResourceTypeSQLServerVulnerability, AssessedResourceTypeServerVulnerability, + AssessedResourceTypeServerVulnerabilityAssessment, } } @@ -270,13 +286,27 @@ type AssessmentType string const ( // AssessmentTypeBuiltIn - Microsoft Defender for Cloud managed assessments AssessmentTypeBuiltIn AssessmentType = "BuiltIn" + // AssessmentTypeBuiltInPolicy - Microsoft Defender for Cloud managed policies + AssessmentTypeBuiltInPolicy AssessmentType = "BuiltInPolicy" + // AssessmentTypeCustom - User defined custom assessments + AssessmentTypeCustom AssessmentType = "Custom" // AssessmentTypeCustomPolicy - User defined policies that are automatically ingested from Azure Policy to Microsoft Defender // for Cloud AssessmentTypeCustomPolicy AssessmentType = "CustomPolicy" // AssessmentTypeCustomerManaged - User assessments pushed directly by the user or other third party to Microsoft Defender // for Cloud AssessmentTypeCustomerManaged AssessmentType = "CustomerManaged" - // AssessmentTypeVerifiedPartner - An assessment that was created by a verified 3rd party if the user connected it to ASC + // AssessmentTypeDynamicBuiltIn - Microsoft Defender for Cloud managed assessments that are dynamically created by the system + AssessmentTypeDynamicBuiltIn AssessmentType = "DynamicBuiltIn" + // AssessmentTypeManualBuiltIn - Microsoft Defender for Cloud managed assessments that are manually created by the user + AssessmentTypeManualBuiltIn AssessmentType = "ManualBuiltIn" + // AssessmentTypeManualBuiltInPolicy - Microsoft Defender for Cloud managed policies that are manually created by the user + AssessmentTypeManualBuiltInPolicy AssessmentType = "ManualBuiltInPolicy" + // AssessmentTypeManualCustomPolicy - User defined policies that are manually created by the user + AssessmentTypeManualCustomPolicy AssessmentType = "ManualCustomPolicy" + // AssessmentTypeUnknown - Unknown assessment type + AssessmentTypeUnknown AssessmentType = "Unknown" + // AssessmentTypeVerifiedPartner - Third party assessments that are verified by Microsoft Defender for Cloud AssessmentTypeVerifiedPartner AssessmentType = "VerifiedPartner" ) @@ -284,55 +314,52 @@ const ( func PossibleAssessmentTypeValues() []AssessmentType { return []AssessmentType{ AssessmentTypeBuiltIn, + AssessmentTypeBuiltInPolicy, + AssessmentTypeCustom, AssessmentTypeCustomPolicy, AssessmentTypeCustomerManaged, + AssessmentTypeDynamicBuiltIn, + AssessmentTypeManualBuiltIn, + AssessmentTypeManualBuiltInPolicy, + AssessmentTypeManualCustomPolicy, + AssessmentTypeUnknown, AssessmentTypeVerifiedPartner, } } -// AuthenticationProvisioningState - State of the multi-cloud connector -type AuthenticationProvisioningState string +// AttestationComplianceState - Attest category of this assignment +type AttestationComplianceState string const ( - // AuthenticationProvisioningStateExpired - the connection has expired - AuthenticationProvisioningStateExpired AuthenticationProvisioningState = "Expired" - // AuthenticationProvisioningStateIncorrectPolicy - Incorrect policy of the connector - AuthenticationProvisioningStateIncorrectPolicy AuthenticationProvisioningState = "IncorrectPolicy" - // AuthenticationProvisioningStateInvalid - Invalid connector - AuthenticationProvisioningStateInvalid AuthenticationProvisioningState = "Invalid" - // AuthenticationProvisioningStateValid - Valid connector - AuthenticationProvisioningStateValid AuthenticationProvisioningState = "Valid" + // AttestationComplianceStateCompliant - compliant + AttestationComplianceStateCompliant AttestationComplianceState = "compliant" + // AttestationComplianceStateNonCompliant - nonCompliant + AttestationComplianceStateNonCompliant AttestationComplianceState = "nonCompliant" + // AttestationComplianceStateUnknown - unknown + AttestationComplianceStateUnknown AttestationComplianceState = "unknown" ) -// PossibleAuthenticationProvisioningStateValues returns the possible values for the AuthenticationProvisioningState const type. -func PossibleAuthenticationProvisioningStateValues() []AuthenticationProvisioningState { - return []AuthenticationProvisioningState{ - AuthenticationProvisioningStateExpired, - AuthenticationProvisioningStateIncorrectPolicy, - AuthenticationProvisioningStateInvalid, - AuthenticationProvisioningStateValid, +// PossibleAttestationComplianceStateValues returns the possible values for the AttestationComplianceState const type. +func PossibleAttestationComplianceStateValues() []AttestationComplianceState { + return []AttestationComplianceState{ + AttestationComplianceStateCompliant, + AttestationComplianceStateNonCompliant, + AttestationComplianceStateUnknown, } } -// AuthenticationType - Connect to your cloud account, for AWS use either account credentials or role-based authentication. -// For GCP use account organization credentials. +// AuthenticationType - The authentication type type AuthenticationType string const ( - // AuthenticationTypeAwsAssumeRole - AWS account connector assume role authentication - AuthenticationTypeAwsAssumeRole AuthenticationType = "awsAssumeRole" - // AuthenticationTypeAwsCreds - AWS cloud account connector user credentials authentication - AuthenticationTypeAwsCreds AuthenticationType = "awsCreds" - // AuthenticationTypeGcpCredentials - GCP account connector service to service authentication - AuthenticationTypeGcpCredentials AuthenticationType = "gcpCredentials" + // AuthenticationTypeAccessToken - AccessToken + AuthenticationTypeAccessToken AuthenticationType = "AccessToken" ) // PossibleAuthenticationTypeValues returns the possible values for the AuthenticationType const type. func PossibleAuthenticationTypeValues() []AuthenticationType { return []AuthenticationType{ - AuthenticationTypeAwsAssumeRole, - AuthenticationTypeAwsCreds, - AuthenticationTypeGcpCredentials, + AuthenticationTypeAccessToken, } } @@ -340,8 +367,11 @@ func PossibleAuthenticationTypeValues() []AuthenticationType { type AutoDiscovery string const ( - AutoDiscoveryDisabled AutoDiscovery = "Disabled" - AutoDiscoveryEnabled AutoDiscovery = "Enabled" + // AutoDiscoveryDisabled - Disabled + AutoDiscoveryDisabled AutoDiscovery = "Disabled" + // AutoDiscoveryEnabled - Enabled + AutoDiscoveryEnabled AutoDiscovery = "Enabled" + // AutoDiscoveryNotApplicable - NotApplicable AutoDiscoveryNotApplicable AutoDiscovery = "NotApplicable" ) @@ -372,19 +402,64 @@ func PossibleAutoProvisionValues() []AutoProvision { } } +// AutomatedResponseType - Optional. Specifies the automated response action to take when malware is detected. +type AutomatedResponseType string + +const ( + // AutomatedResponseTypeBlobSoftDelete - The blob will be soft deleted when malware is detected. + AutomatedResponseTypeBlobSoftDelete AutomatedResponseType = "BlobSoftDelete" + // AutomatedResponseTypeNone - No automated response will be taken when malware is detected. + AutomatedResponseTypeNone AutomatedResponseType = "None" +) + +// PossibleAutomatedResponseTypeValues returns the possible values for the AutomatedResponseType const type. +func PossibleAutomatedResponseTypeValues() []AutomatedResponseType { + return []AutomatedResponseType{ + AutomatedResponseTypeBlobSoftDelete, + AutomatedResponseTypeNone, + } +} + +// BlobScanResultsOptions - Optional. Write scan result on BlobIndexTags by default. +type BlobScanResultsOptions string + +const ( + // BlobScanResultsOptionsBlobIndexTags - Write scan results on the blobs index tags. + BlobScanResultsOptionsBlobIndexTags BlobScanResultsOptions = "BlobIndexTags" + // BlobScanResultsOptionsNone - Do not write scan results on the blobs index tags. + BlobScanResultsOptionsNone BlobScanResultsOptions = "None" +) + +// PossibleBlobScanResultsOptionsValues returns the possible values for the BlobScanResultsOptions const type. +func PossibleBlobScanResultsOptionsValues() []BlobScanResultsOptions { + return []BlobScanResultsOptions{ + BlobScanResultsOptionsBlobIndexTags, + BlobScanResultsOptionsNone, + } +} + // BundleType - Alert Simulator supported bundles. type BundleType string const ( - BundleTypeAppServices BundleType = "AppServices" - BundleTypeCosmosDbs BundleType = "CosmosDbs" - BundleTypeDNS BundleType = "DNS" - BundleTypeKeyVaults BundleType = "KeyVaults" + // BundleTypeAppServices - AppServices + BundleTypeAppServices BundleType = "AppServices" + // BundleTypeCosmosDbs - CosmosDbs + BundleTypeCosmosDbs BundleType = "CosmosDbs" + // BundleTypeDNS - DNS + BundleTypeDNS BundleType = "DNS" + // BundleTypeKeyVaults - KeyVaults + BundleTypeKeyVaults BundleType = "KeyVaults" + // BundleTypeKubernetesService - KubernetesService BundleTypeKubernetesService BundleType = "KubernetesService" - BundleTypeResourceManager BundleType = "ResourceManager" - BundleTypeSQLServers BundleType = "SqlServers" - BundleTypeStorageAccounts BundleType = "StorageAccounts" - BundleTypeVirtualMachines BundleType = "VirtualMachines" + // BundleTypeResourceManager - ResourceManager + BundleTypeResourceManager BundleType = "ResourceManager" + // BundleTypeSQLServers - SqlServers + BundleTypeSQLServers BundleType = "SqlServers" + // BundleTypeStorageAccounts - StorageAccounts + BundleTypeStorageAccounts BundleType = "StorageAccounts" + // BundleTypeVirtualMachines - VirtualMachines + BundleTypeVirtualMachines BundleType = "VirtualMachines" ) // PossibleBundleTypeValues returns the possible values for the BundleType const type. @@ -406,17 +481,28 @@ func PossibleBundleTypeValues() []BundleType { type Categories string const ( - CategoriesCompute Categories = "Compute" - CategoriesData Categories = "Data" + // CategoriesAppServices - AppServices + CategoriesAppServices Categories = "AppServices" + // CategoriesCompute - Compute + CategoriesCompute Categories = "Compute" + // CategoriesContainer - Container + CategoriesContainer Categories = "Container" + // CategoriesData - Data + CategoriesData Categories = "Data" + // CategoriesIdentityAndAccess - IdentityAndAccess CategoriesIdentityAndAccess Categories = "IdentityAndAccess" - CategoriesIoT Categories = "IoT" - CategoriesNetworking Categories = "Networking" + // CategoriesIoT - IoT + CategoriesIoT Categories = "IoT" + // CategoriesNetworking - Networking + CategoriesNetworking Categories = "Networking" ) // PossibleCategoriesValues returns the possible values for the Categories const type. func PossibleCategoriesValues() []Categories { return []Categories{ + CategoriesAppServices, CategoriesCompute, + CategoriesContainer, CategoriesData, CategoriesIdentityAndAccess, CategoriesIoT, @@ -428,12 +514,22 @@ func PossibleCategoriesValues() []Categories { type CloudName string const ( - CloudNameAWS CloudName = "AWS" - CloudNameAzure CloudName = "Azure" + // CloudNameAWS - AWS + CloudNameAWS CloudName = "AWS" + // CloudNameAzure - Azure + CloudNameAzure CloudName = "Azure" + // CloudNameAzureDevOps - AzureDevOps CloudNameAzureDevOps CloudName = "AzureDevOps" - CloudNameGCP CloudName = "GCP" - CloudNameGitLab CloudName = "GitLab" - CloudNameGithub CloudName = "Github" + // CloudNameDockerHub - DockerHub + CloudNameDockerHub CloudName = "DockerHub" + // CloudNameGCP - GCP + CloudNameGCP CloudName = "GCP" + // CloudNameGitLab - GitLab + CloudNameGitLab CloudName = "GitLab" + // CloudNameGithub - Github + CloudNameGithub CloudName = "Github" + // CloudNameJFrog - JFrog + CloudNameJFrog CloudName = "JFrog" ) // PossibleCloudNameValues returns the possible values for the CloudName const type. @@ -442,56 +538,20 @@ func PossibleCloudNameValues() []CloudName { CloudNameAWS, CloudNameAzure, CloudNameAzureDevOps, + CloudNameDockerHub, CloudNameGCP, CloudNameGitLab, CloudNameGithub, - } -} - -// Code - The operation status code. -type Code string - -const ( - // CodeFailed - Extension was not created/updated successfully. See operation status message for more details. - CodeFailed Code = "Failed" - // CodeSucceeded - Extension was created/updated successfully. - CodeSucceeded Code = "Succeeded" -) - -// PossibleCodeValues returns the possible values for the Code const type. -func PossibleCodeValues() []Code { - return []Code{ - CodeFailed, - CodeSucceeded, - } -} - -// ConfigurationStatus - The configuration status of the machines group or machine or rule -type ConfigurationStatus string - -const ( - ConfigurationStatusConfigured ConfigurationStatus = "Configured" - ConfigurationStatusFailed ConfigurationStatus = "Failed" - ConfigurationStatusInProgress ConfigurationStatus = "InProgress" - ConfigurationStatusNoStatus ConfigurationStatus = "NoStatus" - ConfigurationStatusNotConfigured ConfigurationStatus = "NotConfigured" -) - -// PossibleConfigurationStatusValues returns the possible values for the ConfigurationStatus const type. -func PossibleConfigurationStatusValues() []ConfigurationStatus { - return []ConfigurationStatus{ - ConfigurationStatusConfigured, - ConfigurationStatusFailed, - ConfigurationStatusInProgress, - ConfigurationStatusNoStatus, - ConfigurationStatusNotConfigured, + CloudNameJFrog, } } type ConnectionType string const ( + // ConnectionTypeExternal - External ConnectionTypeExternal ConnectionType = "External" + // ConnectionTypeInternal - Internal ConnectionTypeInternal ConnectionType = "Internal" ) @@ -521,14 +581,18 @@ func PossibleControlTypeValues() []ControlType { } } -// CreatedByType - The type of identity that created the resource. +// CreatedByType - The kind of entity that created the resource. type CreatedByType string const ( - CreatedByTypeApplication CreatedByType = "Application" - CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeApplication - The entity was created by an application. + CreatedByTypeApplication CreatedByType = "Application" + // CreatedByTypeKey - The entity was created by a key. + CreatedByTypeKey CreatedByType = "Key" + // CreatedByTypeManagedIdentity - The entity was created by a managed identity. CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" - CreatedByTypeUser CreatedByType = "User" + // CreatedByTypeUser - The entity was created by a user. + CreatedByTypeUser CreatedByType = "User" ) // PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. @@ -555,36 +619,31 @@ func PossibleDataSourceValues() []DataSource { } } -// DesiredOnboardingState - Onboarding states. -type DesiredOnboardingState string - -const ( - DesiredOnboardingStateDisabled DesiredOnboardingState = "Disabled" - DesiredOnboardingStateEnabled DesiredOnboardingState = "Enabled" -) - -// PossibleDesiredOnboardingStateValues returns the possible values for the DesiredOnboardingState const type. -func PossibleDesiredOnboardingStateValues() []DesiredOnboardingState { - return []DesiredOnboardingState{ - DesiredOnboardingStateDisabled, - DesiredOnboardingStateEnabled, - } -} - // DevOpsProvisioningState - The provisioning state of the resource. -// Pending - Provisioning pending. Failed - Provisioning failed. Succeeded - Successful provisioning. Canceled - Provisioning -// canceled. PendingDeletion - Deletion pending. DeletionSuccess - Deletion -// successful. DeletionFailure - Deletion failure. +// Pending - Provisioning pending. +// Failed - Provisioning failed. +// Succeeded - Successful provisioning. +// Canceled - Provisioning canceled. +// PendingDeletion - Deletion pending. +// DeletionSuccess - Deletion successful. +// DeletionFailure - Deletion failure. type DevOpsProvisioningState string const ( - DevOpsProvisioningStateCanceled DevOpsProvisioningState = "Canceled" + // DevOpsProvisioningStateCanceled - Canceled + DevOpsProvisioningStateCanceled DevOpsProvisioningState = "Canceled" + // DevOpsProvisioningStateDeletionFailure - DeletionFailure DevOpsProvisioningStateDeletionFailure DevOpsProvisioningState = "DeletionFailure" + // DevOpsProvisioningStateDeletionSuccess - DeletionSuccess DevOpsProvisioningStateDeletionSuccess DevOpsProvisioningState = "DeletionSuccess" - DevOpsProvisioningStateFailed DevOpsProvisioningState = "Failed" - DevOpsProvisioningStatePending DevOpsProvisioningState = "Pending" + // DevOpsProvisioningStateFailed - Failed + DevOpsProvisioningStateFailed DevOpsProvisioningState = "Failed" + // DevOpsProvisioningStatePending - Pending + DevOpsProvisioningStatePending DevOpsProvisioningState = "Pending" + // DevOpsProvisioningStatePendingDeletion - PendingDeletion DevOpsProvisioningStatePendingDeletion DevOpsProvisioningState = "PendingDeletion" - DevOpsProvisioningStateSucceeded DevOpsProvisioningState = "Succeeded" + // DevOpsProvisioningStateSucceeded - Succeeded + DevOpsProvisioningStateSucceeded DevOpsProvisioningState = "Succeeded" ) // PossibleDevOpsProvisioningStateValues returns the possible values for the DevOpsProvisioningState const type. @@ -600,48 +659,30 @@ func PossibleDevOpsProvisioningStateValues() []DevOpsProvisioningState { } } -// Direction - The rule's direction -type Direction string - -const ( - DirectionInbound Direction = "Inbound" - DirectionOutbound Direction = "Outbound" -) - -// PossibleDirectionValues returns the possible values for the Direction const type. -func PossibleDirectionValues() []Direction { - return []Direction{ - DirectionInbound, - DirectionOutbound, - } -} - -// EndOfSupportStatus - End of support status. -type EndOfSupportStatus string +// Effect - Expected effect of this assignment (Audit/Exempt/Attest) +type Effect string const ( - EndOfSupportStatusNoLongerSupported EndOfSupportStatus = "noLongerSupported" - EndOfSupportStatusNone EndOfSupportStatus = "None" - EndOfSupportStatusUpcomingNoLongerSupported EndOfSupportStatus = "upcomingNoLongerSupported" - EndOfSupportStatusUpcomingVersionNoLongerSupported EndOfSupportStatus = "upcomingVersionNoLongerSupported" - EndOfSupportStatusVersionNoLongerSupported EndOfSupportStatus = "versionNoLongerSupported" + // EffectAttest - Attest + EffectAttest Effect = "Attest" + // EffectAudit - Audit + EffectAudit Effect = "Audit" + // EffectExempt - Exempt + EffectExempt Effect = "Exempt" ) -// PossibleEndOfSupportStatusValues returns the possible values for the EndOfSupportStatus const type. -func PossibleEndOfSupportStatusValues() []EndOfSupportStatus { - return []EndOfSupportStatus{ - EndOfSupportStatusNoLongerSupported, - EndOfSupportStatusNone, - EndOfSupportStatusUpcomingNoLongerSupported, - EndOfSupportStatusUpcomingVersionNoLongerSupported, - EndOfSupportStatusVersionNoLongerSupported, +// PossibleEffectValues returns the possible values for the Effect const type. +func PossibleEffectValues() []Effect { + return []Effect{ + EffectAttest, + EffectAudit, + EffectExempt, } } // Enforce - If set to "False", it allows the descendants of this scope to override the pricing configuration set on this -// scope (allows setting inherited="False"). If set to "True", it prevents overrides and -// forces this pricing configuration on all the descendants of this scope. This field is only available for subscription-level -// pricing. +// scope (allows setting inherited="False"). If set to "True", it prevents overrides and forces this pricing configuration +// on all the descendants of this scope. This field is only available for subscription-level pricing. type Enforce string const ( @@ -660,51 +701,24 @@ func PossibleEnforceValues() []Enforce { } } -// EnforcementMode - The application control policy enforcement/protection mode of the machine group -type EnforcementMode string - -const ( - EnforcementModeAudit EnforcementMode = "Audit" - EnforcementModeEnforce EnforcementMode = "Enforce" - EnforcementModeNone EnforcementMode = "None" -) - -// PossibleEnforcementModeValues returns the possible values for the EnforcementMode const type. -func PossibleEnforcementModeValues() []EnforcementMode { - return []EnforcementMode{ - EnforcementModeAudit, - EnforcementModeEnforce, - EnforcementModeNone, - } -} - -// EnforcementSupport - The machine supportability of Enforce feature -type EnforcementSupport string - -const ( - EnforcementSupportNotSupported EnforcementSupport = "NotSupported" - EnforcementSupportSupported EnforcementSupport = "Supported" - EnforcementSupportUnknown EnforcementSupport = "Unknown" -) - -// PossibleEnforcementSupportValues returns the possible values for the EnforcementSupport const type. -func PossibleEnforcementSupportValues() []EnforcementSupport { - return []EnforcementSupport{ - EnforcementSupportNotSupported, - EnforcementSupportSupported, - EnforcementSupportUnknown, - } -} - // EnvironmentType - The type of the environment data. type EnvironmentType string const ( - EnvironmentTypeAwsAccount EnvironmentType = "AwsAccount" + // EnvironmentTypeAwsAccount - AwsAccount + EnvironmentTypeAwsAccount EnvironmentType = "AwsAccount" + // EnvironmentTypeAzureDevOpsScope - AzureDevOpsScope EnvironmentTypeAzureDevOpsScope EnvironmentType = "AzureDevOpsScope" - EnvironmentTypeGcpProject EnvironmentType = "GcpProject" - EnvironmentTypeGithubScope EnvironmentType = "GithubScope" - EnvironmentTypeGitlabScope EnvironmentType = "GitlabScope" + // EnvironmentTypeDockerHubOrganization - DockerHubOrganization + EnvironmentTypeDockerHubOrganization EnvironmentType = "DockerHubOrganization" + // EnvironmentTypeGcpProject - GcpProject + EnvironmentTypeGcpProject EnvironmentType = "GcpProject" + // EnvironmentTypeGithubScope - GithubScope + EnvironmentTypeGithubScope EnvironmentType = "GithubScope" + // EnvironmentTypeGitlabScope - GitlabScope + EnvironmentTypeGitlabScope EnvironmentType = "GitlabScope" + // EnvironmentTypeJFrogArtifactory - JFrogArtifactory + EnvironmentTypeJFrogArtifactory EnvironmentType = "JFrogArtifactory" ) // PossibleEnvironmentTypeValues returns the possible values for the EnvironmentType const type. @@ -712,9 +726,11 @@ func PossibleEnvironmentTypeValues() []EnvironmentType { return []EnvironmentType{ EnvironmentTypeAwsAccount, EnvironmentTypeAzureDevOpsScope, + EnvironmentTypeDockerHubOrganization, EnvironmentTypeGcpProject, EnvironmentTypeGithubScope, EnvironmentTypeGitlabScope, + EnvironmentTypeJFrogArtifactory, } } @@ -722,19 +738,32 @@ func PossibleEnvironmentTypeValues() []EnvironmentType { type EventSource string const ( - EventSourceAlerts EventSource = "Alerts" - EventSourceAssessments EventSource = "Assessments" - EventSourceAssessmentsSnapshot EventSource = "AssessmentsSnapshot" - EventSourceAttackPaths EventSource = "AttackPaths" - EventSourceAttackPathsSnapshot EventSource = "AttackPathsSnapshot" - EventSourceRegulatoryComplianceAssessment EventSource = "RegulatoryComplianceAssessment" + // EventSourceAlerts - Alerts + EventSourceAlerts EventSource = "Alerts" + // EventSourceAssessments - Assessments + EventSourceAssessments EventSource = "Assessments" + // EventSourceAssessmentsSnapshot - AssessmentsSnapshot + EventSourceAssessmentsSnapshot EventSource = "AssessmentsSnapshot" + // EventSourceAttackPaths - AttackPaths + EventSourceAttackPaths EventSource = "AttackPaths" + // EventSourceAttackPathsSnapshot - AttackPathsSnapshot + EventSourceAttackPathsSnapshot EventSource = "AttackPathsSnapshot" + // EventSourceRegulatoryComplianceAssessment - RegulatoryComplianceAssessment + EventSourceRegulatoryComplianceAssessment EventSource = "RegulatoryComplianceAssessment" + // EventSourceRegulatoryComplianceAssessmentSnapshot - RegulatoryComplianceAssessmentSnapshot EventSourceRegulatoryComplianceAssessmentSnapshot EventSource = "RegulatoryComplianceAssessmentSnapshot" - EventSourceSecureScoreControls EventSource = "SecureScoreControls" - EventSourceSecureScoreControlsSnapshot EventSource = "SecureScoreControlsSnapshot" - EventSourceSecureScores EventSource = "SecureScores" - EventSourceSecureScoresSnapshot EventSource = "SecureScoresSnapshot" - EventSourceSubAssessments EventSource = "SubAssessments" - EventSourceSubAssessmentsSnapshot EventSource = "SubAssessmentsSnapshot" + // EventSourceSecureScoreControls - SecureScoreControls + EventSourceSecureScoreControls EventSource = "SecureScoreControls" + // EventSourceSecureScoreControlsSnapshot - SecureScoreControlsSnapshot + EventSourceSecureScoreControlsSnapshot EventSource = "SecureScoreControlsSnapshot" + // EventSourceSecureScores - SecureScores + EventSourceSecureScores EventSource = "SecureScores" + // EventSourceSecureScoresSnapshot - SecureScoresSnapshot + EventSourceSecureScoresSnapshot EventSource = "SecureScoresSnapshot" + // EventSourceSubAssessments - SubAssessments + EventSourceSubAssessments EventSource = "SubAssessments" + // EventSourceSubAssessmentsSnapshot - SubAssessmentsSnapshot + EventSourceSubAssessmentsSnapshot EventSource = "SubAssessmentsSnapshot" ) // PossibleEventSourceValues returns the possible values for the EventSource const type. @@ -756,6 +785,24 @@ func PossibleEventSourceValues() []EventSource { } } +// ExemptionCategory - Exemption category of this assignment +type ExemptionCategory string + +const ( + // ExemptionCategoryMitigated - mitigated + ExemptionCategoryMitigated ExemptionCategory = "mitigated" + // ExemptionCategoryWaiver - waiver + ExemptionCategoryWaiver ExemptionCategory = "waiver" +) + +// PossibleExemptionCategoryValues returns the possible values for the ExemptionCategory const type. +func PossibleExemptionCategoryValues() []ExemptionCategory { + return []ExemptionCategory{ + ExemptionCategoryMitigated, + ExemptionCategoryWaiver, + } +} + type ExpandControlsEnum string const ( @@ -805,8 +852,11 @@ func PossibleExportDataValues() []ExportData { type ExternalSecuritySolutionKind string const ( + // ExternalSecuritySolutionKindAAD - AAD ExternalSecuritySolutionKindAAD ExternalSecuritySolutionKind = "AAD" + // ExternalSecuritySolutionKindATA - ATA ExternalSecuritySolutionKindATA ExternalSecuritySolutionKind = "ATA" + // ExternalSecuritySolutionKindCEF - CEF ExternalSecuritySolutionKindCEF ExternalSecuritySolutionKind = "CEF" ) @@ -819,51 +869,6 @@ func PossibleExternalSecuritySolutionKindValues() []ExternalSecuritySolutionKind } } -// FileType - The type of the file (for Linux files - Executable is used) -type FileType string - -const ( - FileTypeDll FileType = "Dll" - FileTypeExe FileType = "Exe" - FileTypeExecutable FileType = "Executable" - FileTypeMsi FileType = "Msi" - FileTypeScript FileType = "Script" - FileTypeUnknown FileType = "Unknown" -) - -// PossibleFileTypeValues returns the possible values for the FileType const type. -func PossibleFileTypeValues() []FileType { - return []FileType{ - FileTypeDll, - FileTypeExe, - FileTypeExecutable, - FileTypeMsi, - FileTypeScript, - FileTypeUnknown, - } -} - -// 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 @@ -915,33 +920,15 @@ func PossibleGovernanceRuleTypeValues() []GovernanceRuleType { } } -// HybridComputeProvisioningState - State of the service principal and its secret -type HybridComputeProvisioningState string - -const ( - // HybridComputeProvisioningStateExpired - the service principal details are expired - HybridComputeProvisioningStateExpired HybridComputeProvisioningState = "Expired" - // HybridComputeProvisioningStateInvalid - Invalid service principal details. - HybridComputeProvisioningStateInvalid HybridComputeProvisioningState = "Invalid" - // HybridComputeProvisioningStateValid - Valid service principal details. - HybridComputeProvisioningStateValid HybridComputeProvisioningState = "Valid" -) - -// PossibleHybridComputeProvisioningStateValues returns the possible values for the HybridComputeProvisioningState const type. -func PossibleHybridComputeProvisioningStateValues() []HybridComputeProvisioningState { - return []HybridComputeProvisioningState{ - HybridComputeProvisioningStateExpired, - HybridComputeProvisioningStateInvalid, - HybridComputeProvisioningStateValid, - } -} - // ImplementationEffort - The implementation effort required to remediate this assessment type ImplementationEffort string const ( - ImplementationEffortHigh ImplementationEffort = "High" - ImplementationEffortLow ImplementationEffort = "Low" + // ImplementationEffortHigh - High + ImplementationEffortHigh ImplementationEffort = "High" + // ImplementationEffortLow - Low + ImplementationEffortLow ImplementationEffort = "Low" + // ImplementationEffortModerate - Moderate ImplementationEffortModerate ImplementationEffort = "Moderate" ) @@ -957,7 +944,9 @@ func PossibleImplementationEffortValues() []ImplementationEffort { type InformationProtectionPolicyName string const ( - InformationProtectionPolicyNameCustom InformationProtectionPolicyName = "custom" + // InformationProtectionPolicyNameCustom - custom + InformationProtectionPolicyNameCustom InformationProtectionPolicyName = "custom" + // InformationProtectionPolicyNameEffective - effective InformationProtectionPolicyNameEffective InformationProtectionPolicyName = "effective" ) @@ -970,13 +959,15 @@ func PossibleInformationProtectionPolicyNameValues() []InformationProtectionPoli } // InheritFromParentState - Update Settings. -// Enabled - Resource should inherit configurations from parent. Disabled - Resource should not inherit configurations from -// parent. +// Enabled - Resource should inherit configurations from parent. +// Disabled - Resource should not inherit configurations from parent. type InheritFromParentState string const ( + // InheritFromParentStateDisabled - Disabled InheritFromParentStateDisabled InheritFromParentState = "Disabled" - InheritFromParentStateEnabled InheritFromParentState = "Enabled" + // InheritFromParentStateEnabled - Enabled + InheritFromParentStateEnabled InheritFromParentState = "Enabled" ) // PossibleInheritFromParentStateValues returns the possible values for the InheritFromParentState const type. @@ -988,10 +979,9 @@ func PossibleInheritFromParentStateValues() []InheritFromParentState { } // Inherited - "inherited" = "True" indicates that the current scope inherits its pricing configuration from its parent. The -// ID of the parent scope that provides the inherited configuration is displayed in the -// "inheritedFrom" field. On the other hand, "inherited" = "False" indicates that the current scope has its own pricing configuration -// explicitly set, and does not inherit from its parent. This field is -// read only and available only for resource-level pricing. +// ID of the parent scope that provides the inherited configuration is displayed in the "inheritedFrom" field. On the other +// hand, "inherited" = "False" indicates that the current scope has its own pricing configuration explicitly set, and does +// not inherit from its parent. This field is read only and available only for resource-level pricing. type Inherited string const ( @@ -1085,6 +1075,51 @@ func PossibleIntentValues() []Intent { } } +// InventoryKind - Types for inventory kind. +type InventoryKind string + +const ( + // InventoryKindAzureDevOpsOrganization - AzureDevOpsOrganization + InventoryKindAzureDevOpsOrganization InventoryKind = "AzureDevOpsOrganization" + // InventoryKindAzureDevOpsProject - AzureDevOpsProject + InventoryKindAzureDevOpsProject InventoryKind = "AzureDevOpsProject" + // InventoryKindAzureDevOpsRepository - AzureDevOpsRepository + InventoryKindAzureDevOpsRepository InventoryKind = "AzureDevOpsRepository" + // InventoryKindGitHubOwner - GitHubOwner + InventoryKindGitHubOwner InventoryKind = "GitHubOwner" + // InventoryKindGitHubRepository - GitHubRepository + InventoryKindGitHubRepository InventoryKind = "GitHubRepository" +) + +// PossibleInventoryKindValues returns the possible values for the InventoryKind const type. +func PossibleInventoryKindValues() []InventoryKind { + return []InventoryKind{ + InventoryKindAzureDevOpsOrganization, + InventoryKindAzureDevOpsProject, + InventoryKindAzureDevOpsRepository, + InventoryKindGitHubOwner, + InventoryKindGitHubRepository, + } +} + +// InventoryListKind - Types for inventory list. +type InventoryListKind string + +const ( + // InventoryListKindExclusion - Exclusion + InventoryListKindExclusion InventoryListKind = "Exclusion" + // InventoryListKindInclusion - Inclusion + InventoryListKindInclusion InventoryListKind = "Inclusion" +) + +// PossibleInventoryListKindValues returns the possible values for the InventoryListKind const type. +func PossibleInventoryListKindValues() []InventoryListKind { + return []InventoryListKind{ + InventoryListKindExclusion, + InventoryListKindInclusion, + } +} + // IsEnabled - Indicates whether the extension is enabled. type IsEnabled string @@ -1167,10 +1202,14 @@ func PossibleMinimalSeverityValues() []MinimalSeverity { type MipIntegrationStatus string const ( + // MipIntegrationStatusNoAutoLabelingRules - noAutoLabelingRules MipIntegrationStatusNoAutoLabelingRules MipIntegrationStatus = "noAutoLabelingRules" - MipIntegrationStatusNoConsent MipIntegrationStatus = "noConsent" - MipIntegrationStatusNoMipLabels MipIntegrationStatus = "noMipLabels" - MipIntegrationStatusOk MipIntegrationStatus = "Ok" + // MipIntegrationStatusNoConsent - noConsent + MipIntegrationStatusNoConsent MipIntegrationStatus = "noConsent" + // MipIntegrationStatusNoMipLabels - noMipLabels + MipIntegrationStatusNoMipLabels MipIntegrationStatus = "noMipLabels" + // MipIntegrationStatusOk - Ok + MipIntegrationStatusOk MipIntegrationStatus = "Ok" ) // PossibleMipIntegrationStatusValues returns the possible values for the MipIntegrationStatus const type. @@ -1187,19 +1226,44 @@ func PossibleMipIntegrationStatusValues() []MipIntegrationStatus { type OfferingType string const ( - OfferingTypeCspmMonitorAws OfferingType = "CspmMonitorAws" - OfferingTypeCspmMonitorAzureDevOps OfferingType = "CspmMonitorAzureDevOps" - OfferingTypeCspmMonitorGcp OfferingType = "CspmMonitorGcp" - OfferingTypeCspmMonitorGitLab OfferingType = "CspmMonitorGitLab" - OfferingTypeCspmMonitorGithub OfferingType = "CspmMonitorGithub" - OfferingTypeDefenderCspmAws OfferingType = "DefenderCspmAws" - OfferingTypeDefenderCspmGcp OfferingType = "DefenderCspmGcp" + // OfferingTypeCspmMonitorAws - CspmMonitorAws + OfferingTypeCspmMonitorAws OfferingType = "CspmMonitorAws" + // OfferingTypeCspmMonitorAzureDevOps - CspmMonitorAzureDevOps + OfferingTypeCspmMonitorAzureDevOps OfferingType = "CspmMonitorAzureDevOps" + // OfferingTypeCspmMonitorDockerHub - CspmMonitorDockerHub + OfferingTypeCspmMonitorDockerHub OfferingType = "CspmMonitorDockerHub" + // OfferingTypeCspmMonitorGcp - CspmMonitorGcp + OfferingTypeCspmMonitorGcp OfferingType = "CspmMonitorGcp" + // OfferingTypeCspmMonitorGitLab - CspmMonitorGitLab + OfferingTypeCspmMonitorGitLab OfferingType = "CspmMonitorGitLab" + // OfferingTypeCspmMonitorGithub - CspmMonitorGithub + OfferingTypeCspmMonitorGithub OfferingType = "CspmMonitorGithub" + // OfferingTypeCspmMonitorJFrog - CspmMonitorJFrog + OfferingTypeCspmMonitorJFrog OfferingType = "CspmMonitorJFrog" + // OfferingTypeDefenderCspmAws - DefenderCspmAws + OfferingTypeDefenderCspmAws OfferingType = "DefenderCspmAws" + // OfferingTypeDefenderCspmDockerHub - DefenderCspmDockerHub + OfferingTypeDefenderCspmDockerHub OfferingType = "DefenderCspmDockerHub" + // OfferingTypeDefenderCspmGcp - DefenderCspmGcp + OfferingTypeDefenderCspmGcp OfferingType = "DefenderCspmGcp" + // OfferingTypeDefenderCspmJFrog - DefenderCspmJFrog + OfferingTypeDefenderCspmJFrog OfferingType = "DefenderCspmJFrog" + // OfferingTypeDefenderForContainersAws - DefenderForContainersAws OfferingTypeDefenderForContainersAws OfferingType = "DefenderForContainersAws" + // OfferingTypeDefenderForContainersDockerHub - DefenderForContainersDockerHub + OfferingTypeDefenderForContainersDockerHub OfferingType = "DefenderForContainersDockerHub" + // OfferingTypeDefenderForContainersGcp - DefenderForContainersGcp OfferingTypeDefenderForContainersGcp OfferingType = "DefenderForContainersGcp" - OfferingTypeDefenderForDatabasesAws OfferingType = "DefenderForDatabasesAws" - OfferingTypeDefenderForDatabasesGcp OfferingType = "DefenderForDatabasesGcp" - OfferingTypeDefenderForServersAws OfferingType = "DefenderForServersAws" - OfferingTypeDefenderForServersGcp OfferingType = "DefenderForServersGcp" + // OfferingTypeDefenderForContainersJFrog - DefenderForContainersJFrog + OfferingTypeDefenderForContainersJFrog OfferingType = "DefenderForContainersJFrog" + // OfferingTypeDefenderForDatabasesAws - DefenderForDatabasesAws + OfferingTypeDefenderForDatabasesAws OfferingType = "DefenderForDatabasesAws" + // OfferingTypeDefenderForDatabasesGcp - DefenderForDatabasesGcp + OfferingTypeDefenderForDatabasesGcp OfferingType = "DefenderForDatabasesGcp" + // OfferingTypeDefenderForServersAws - DefenderForServersAws + OfferingTypeDefenderForServersAws OfferingType = "DefenderForServersAws" + // OfferingTypeDefenderForServersGcp - DefenderForServersGcp + OfferingTypeDefenderForServersGcp OfferingType = "DefenderForServersGcp" ) // PossibleOfferingTypeValues returns the possible values for the OfferingType const type. @@ -1207,13 +1271,19 @@ func PossibleOfferingTypeValues() []OfferingType { return []OfferingType{ OfferingTypeCspmMonitorAws, OfferingTypeCspmMonitorAzureDevOps, + OfferingTypeCspmMonitorDockerHub, OfferingTypeCspmMonitorGcp, OfferingTypeCspmMonitorGitLab, OfferingTypeCspmMonitorGithub, + OfferingTypeCspmMonitorJFrog, OfferingTypeDefenderCspmAws, + OfferingTypeDefenderCspmDockerHub, OfferingTypeDefenderCspmGcp, + OfferingTypeDefenderCspmJFrog, OfferingTypeDefenderForContainersAws, + OfferingTypeDefenderForContainersDockerHub, OfferingTypeDefenderForContainersGcp, + OfferingTypeDefenderForContainersJFrog, OfferingTypeDefenderForDatabasesAws, OfferingTypeDefenderForDatabasesGcp, OfferingTypeDefenderForServersAws, @@ -1223,15 +1293,20 @@ func PossibleOfferingTypeValues() []OfferingType { // OnboardingState - Details about resource onboarding status across all connectors. // OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level -// resources. Onboarded - this resource has already been onboarded by the -// specified connector. NotOnboarded - this resource has not been onboarded to any connector. NotApplicable - the onboarding -// state is not applicable to the current endpoint. +// resources. +// Onboarded - this resource has already been onboarded by the specified connector. +// NotOnboarded - this resource has not been onboarded to any connector. +// NotApplicable - the onboarding state is not applicable to the current endpoint. type OnboardingState string const ( - OnboardingStateNotApplicable OnboardingState = "NotApplicable" - OnboardingStateNotOnboarded OnboardingState = "NotOnboarded" - OnboardingStateOnboarded OnboardingState = "Onboarded" + // OnboardingStateNotApplicable - NotApplicable + OnboardingStateNotApplicable OnboardingState = "NotApplicable" + // OnboardingStateNotOnboarded - NotOnboarded + OnboardingStateNotOnboarded OnboardingState = "NotOnboarded" + // OnboardingStateOnboarded - Onboarded + OnboardingStateOnboarded OnboardingState = "Onboarded" + // OnboardingStateOnboardedByOtherConnector - OnboardedByOtherConnector OnboardingStateOnboardedByOtherConnector OnboardingState = "OnboardedByOtherConnector" ) @@ -1245,24 +1320,24 @@ func PossibleOnboardingStateValues() []OnboardingState { } } -// OperationResult - The status of the long run operation result of governance rule -type OperationResult string +// OperationResultStatus - The status of the long run operation result of governance rule +type OperationResultStatus string const ( - // OperationResultCanceled - The operation canceled - OperationResultCanceled OperationResult = "Canceled" - // OperationResultFailed - The operation failed - OperationResultFailed OperationResult = "Failed" - // OperationResultSucceeded - The operation succeeded - OperationResultSucceeded OperationResult = "Succeeded" + // OperationResultStatusCanceled - The operation canceled + OperationResultStatusCanceled OperationResultStatus = "Canceled" + // OperationResultStatusFailed - The operation failed + OperationResultStatusFailed OperationResultStatus = "Failed" + // OperationResultStatusSucceeded - The operation succeeded + OperationResultStatusSucceeded OperationResultStatus = "Succeeded" ) -// PossibleOperationResultValues returns the possible values for the OperationResult const type. -func PossibleOperationResultValues() []OperationResult { - return []OperationResult{ - OperationResultCanceled, - OperationResultFailed, - OperationResultSucceeded, +// PossibleOperationResultStatusValues returns the possible values for the OperationResultStatus const type. +func PossibleOperationResultStatusValues() []OperationResultStatus { + return []OperationResultStatus{ + OperationResultStatusCanceled, + OperationResultStatusFailed, + OperationResultStatusSucceeded, } } @@ -1309,7 +1384,9 @@ func PossibleOperatorValues() []Operator { type OrganizationMembershipType string const ( - OrganizationMembershipTypeMember OrganizationMembershipType = "Member" + // OrganizationMembershipTypeMember - Member + OrganizationMembershipTypeMember OrganizationMembershipType = "Member" + // OrganizationMembershipTypeOrganization - Organization OrganizationMembershipTypeOrganization OrganizationMembershipType = "Organization" ) @@ -1321,34 +1398,31 @@ func PossibleOrganizationMembershipTypeValues() []OrganizationMembershipType { } } -// PermissionProperty - A permission detected in the cloud account. -type PermissionProperty string +// Origin - The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default +// value is "user,system" +type Origin string const ( - // PermissionPropertyAWSAWSSecurityHubReadOnlyAccess - This permission provides read only access to AWS Security Hub resources. - PermissionPropertyAWSAWSSecurityHubReadOnlyAccess PermissionProperty = "AWS::AWSSecurityHubReadOnlyAccess" - // PermissionPropertyAWSAmazonSSMAutomationRole - The permission provides for EC2 Automation service to execute activities - // defined within Automation documents. - PermissionPropertyAWSAmazonSSMAutomationRole PermissionProperty = "AWS::AmazonSSMAutomationRole" - // PermissionPropertyAWSSecurityAudit - This permission grants access to read security configuration metadata. - PermissionPropertyAWSSecurityAudit PermissionProperty = "AWS::SecurityAudit" - // PermissionPropertyGCPSecurityCenterAdminViewer - This permission provides read only access to GCP Security Command Center. - PermissionPropertyGCPSecurityCenterAdminViewer PermissionProperty = "GCP::Security Center Admin Viewer" + // OriginSystem - Indicates the operation is initiated by a system. + OriginSystem Origin = "system" + // OriginUser - Indicates the operation is initiated by a user. + OriginUser Origin = "user" + // OriginUserSystem - Indicates the operation is initiated by a user or system. + OriginUserSystem Origin = "user,system" ) -// PossiblePermissionPropertyValues returns the possible values for the PermissionProperty const type. -func PossiblePermissionPropertyValues() []PermissionProperty { - return []PermissionProperty{ - PermissionPropertyAWSAWSSecurityHubReadOnlyAccess, - PermissionPropertyAWSAmazonSSMAutomationRole, - PermissionPropertyAWSSecurityAudit, - PermissionPropertyGCPSecurityCenterAdminViewer, +// PossibleOriginValues returns the possible values for the Origin const type. +func PossibleOriginValues() []Origin { + return []Origin{ + OriginSystem, + OriginUser, + OriginUserSystem, } } // PricingTier - Indicates whether the Defender plan is enabled on the selected scope. Microsoft Defender for Cloud is provided -// in two pricing tiers: free and standard. The standard tier offers advanced security -// capabilities, while the free tier offers basic security features. +// in two pricing tiers: free and standard. The standard tier offers advanced security capabilities, while the free tier offers +// basic security features. type PricingTier string const ( @@ -1366,14 +1440,63 @@ func PossiblePricingTierValues() []PricingTier { } } +// PrivateEndpointConnectionProvisioningState - The current provisioning state. +type PrivateEndpointConnectionProvisioningState string + +const ( + // PrivateEndpointConnectionProvisioningStateCreating - Connection is being created + PrivateEndpointConnectionProvisioningStateCreating PrivateEndpointConnectionProvisioningState = "Creating" + // PrivateEndpointConnectionProvisioningStateDeleting - Connection is being deleted + PrivateEndpointConnectionProvisioningStateDeleting PrivateEndpointConnectionProvisioningState = "Deleting" + // PrivateEndpointConnectionProvisioningStateFailed - Connection provisioning has failed + PrivateEndpointConnectionProvisioningStateFailed PrivateEndpointConnectionProvisioningState = "Failed" + // PrivateEndpointConnectionProvisioningStateSucceeded - Connection has been provisioned + PrivateEndpointConnectionProvisioningStateSucceeded PrivateEndpointConnectionProvisioningState = "Succeeded" +) + +// PossiblePrivateEndpointConnectionProvisioningStateValues returns the possible values for the PrivateEndpointConnectionProvisioningState const type. +func PossiblePrivateEndpointConnectionProvisioningStateValues() []PrivateEndpointConnectionProvisioningState { + return []PrivateEndpointConnectionProvisioningState{ + PrivateEndpointConnectionProvisioningStateCreating, + PrivateEndpointConnectionProvisioningStateDeleting, + PrivateEndpointConnectionProvisioningStateFailed, + PrivateEndpointConnectionProvisioningStateSucceeded, + } +} + +// PrivateEndpointServiceConnectionStatus - The private endpoint connection status. +type PrivateEndpointServiceConnectionStatus string + +const ( + // PrivateEndpointServiceConnectionStatusApproved - Connection approved + PrivateEndpointServiceConnectionStatusApproved PrivateEndpointServiceConnectionStatus = "Approved" + // PrivateEndpointServiceConnectionStatusPending - Connection waiting for approval or rejection + PrivateEndpointServiceConnectionStatusPending PrivateEndpointServiceConnectionStatus = "Pending" + // PrivateEndpointServiceConnectionStatusRejected - Connection Rejected + PrivateEndpointServiceConnectionStatusRejected PrivateEndpointServiceConnectionStatus = "Rejected" +) + +// PossiblePrivateEndpointServiceConnectionStatusValues returns the possible values for the PrivateEndpointServiceConnectionStatus const type. +func PossiblePrivateEndpointServiceConnectionStatusValues() []PrivateEndpointServiceConnectionStatus { + return []PrivateEndpointServiceConnectionStatus{ + PrivateEndpointServiceConnectionStatusApproved, + PrivateEndpointServiceConnectionStatusPending, + PrivateEndpointServiceConnectionStatusRejected, + } +} + // PropertyType - The data type of the compared operands (string, integer, floating point number or a boolean [true/false]] type PropertyType string const ( + // PropertyTypeBoolean - Boolean PropertyTypeBoolean PropertyType = "Boolean" + // PropertyTypeInteger - Integer PropertyTypeInteger PropertyType = "Integer" - PropertyTypeNumber PropertyType = "Number" - PropertyTypeString PropertyType = "String" + // PropertyTypeNumber - Number + PropertyTypeNumber PropertyType = "Number" + // PropertyTypeString - String + PropertyTypeString PropertyType = "String" ) // PossiblePropertyTypeValues returns the possible values for the PropertyType const type. @@ -1389,8 +1512,11 @@ func PossiblePropertyTypeValues() []PropertyType { type Protocol string const ( + // ProtocolAll - * ProtocolAll Protocol = "*" + // ProtocolTCP - TCP ProtocolTCP Protocol = "TCP" + // ProtocolUDP - UDP ProtocolUDP Protocol = "UDP" ) @@ -1403,33 +1529,72 @@ func PossibleProtocolValues() []Protocol { } } -// ProvisioningState - The security family provisioning State +// ProvisioningState - The current provisioning state of the resource. Indicates the status of the last operation performed +// on the resource. type ProvisioningState string const ( - ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateCanceled - The operation was canceled before completion. + ProvisioningStateCanceled ProvisioningState = "Canceled" + // ProvisioningStateCreating - The resource is being created. This is a transitional state. + ProvisioningStateCreating ProvisioningState = "Creating" + // ProvisioningStateDeleting - The resource is being deleted. This is a transitional state. + ProvisioningStateDeleting ProvisioningState = "Deleting" + // ProvisioningStateFailed - The last operation on the resource failed. Check the error details for more information. + ProvisioningStateFailed ProvisioningState = "Failed" + // ProvisioningStateInProgress - InProgress + ProvisioningStateInProgress ProvisioningState = "InProgress" + // ProvisioningStateSucceeded - The resource has been successfully provisioned and is ready for use. ProvisioningStateSucceeded ProvisioningState = "Succeeded" - ProvisioningStateUpdating ProvisioningState = "Updating" + // ProvisioningStateUpdating - The resource is being updated. This is a transitional state. + ProvisioningStateUpdating ProvisioningState = "Updating" ) // PossibleProvisioningStateValues returns the possible values for the ProvisioningState const type. func PossibleProvisioningStateValues() []ProvisioningState { return []ProvisioningState{ + ProvisioningStateCanceled, + ProvisioningStateCreating, + ProvisioningStateDeleting, ProvisioningStateFailed, + ProvisioningStateInProgress, ProvisioningStateSucceeded, ProvisioningStateUpdating, } } +// PublicNetworkAccess - This determines if traffic is allowed over public network. By default it is disabled. +type PublicNetworkAccess string + +const ( + // PublicNetworkAccessDisabled - Disabled + PublicNetworkAccessDisabled PublicNetworkAccess = "Disabled" + // PublicNetworkAccessEnabled - Enabled + PublicNetworkAccessEnabled PublicNetworkAccess = "Enabled" +) + +// PossiblePublicNetworkAccessValues returns the possible values for the PublicNetworkAccess const type. +func PossiblePublicNetworkAccessValues() []PublicNetworkAccess { + return []PublicNetworkAccess{ + PublicNetworkAccessDisabled, + PublicNetworkAccessEnabled, + } +} + // Rank - The rank of the sensitivity label. type Rank string const ( + // RankCritical - Critical RankCritical Rank = "Critical" - RankHigh Rank = "High" - RankLow Rank = "Low" - RankMedium Rank = "Medium" - RankNone Rank = "None" + // RankHigh - High + RankHigh Rank = "High" + // RankLow - Low + RankLow Rank = "Low" + // RankMedium - Medium + RankMedium Rank = "Medium" + // RankNone - None + RankNone Rank = "None" ) // PossibleRankValues returns the possible values for the Rank const type. @@ -1443,31 +1608,15 @@ func PossibleRankValues() []Rank { } } -// RecommendationAction - The recommendation action of the machine or rule -type RecommendationAction string - -const ( - RecommendationActionAdd RecommendationAction = "Add" - RecommendationActionRecommended RecommendationAction = "Recommended" - RecommendationActionRemove RecommendationAction = "Remove" -) - -// PossibleRecommendationActionValues returns the possible values for the RecommendationAction const type. -func PossibleRecommendationActionValues() []RecommendationAction { - return []RecommendationAction{ - RecommendationActionAdd, - RecommendationActionRecommended, - RecommendationActionRemove, - } -} - // RecommendationConfigStatus - Recommendation status. When the recommendation status is disabled recommendations are not // generated. type RecommendationConfigStatus string const ( + // RecommendationConfigStatusDisabled - Disabled RecommendationConfigStatusDisabled RecommendationConfigStatus = "Disabled" - RecommendationConfigStatusEnabled RecommendationConfigStatus = "Enabled" + // RecommendationConfigStatusEnabled - Enabled + RecommendationConfigStatusEnabled RecommendationConfigStatus = "Enabled" ) // PossibleRecommendationConfigStatusValues returns the possible values for the RecommendationConfigStatus const type. @@ -1478,23 +1627,24 @@ func PossibleRecommendationConfigStatusValues() []RecommendationConfigStatus { } } -// RecommendationStatus - The initial recommendation status of the machine group or machine -type RecommendationStatus string +// RecommendationSupportedClouds - The cloud that the recommendation is supported on. +type RecommendationSupportedClouds string const ( - RecommendationStatusNoStatus RecommendationStatus = "NoStatus" - RecommendationStatusNotAvailable RecommendationStatus = "NotAvailable" - RecommendationStatusNotRecommended RecommendationStatus = "NotRecommended" - RecommendationStatusRecommended RecommendationStatus = "Recommended" + // RecommendationSupportedCloudsAWS - AWS + RecommendationSupportedCloudsAWS RecommendationSupportedClouds = "AWS" + // RecommendationSupportedCloudsAzure - Azure + RecommendationSupportedCloudsAzure RecommendationSupportedClouds = "Azure" + // RecommendationSupportedCloudsGCP - GCP + RecommendationSupportedCloudsGCP RecommendationSupportedClouds = "GCP" ) -// PossibleRecommendationStatusValues returns the possible values for the RecommendationStatus const type. -func PossibleRecommendationStatusValues() []RecommendationStatus { - return []RecommendationStatus{ - RecommendationStatusNoStatus, - RecommendationStatusNotAvailable, - RecommendationStatusNotRecommended, - RecommendationStatusRecommended, +// PossibleRecommendationSupportedCloudsValues returns the possible values for the RecommendationSupportedClouds const type. +func PossibleRecommendationSupportedCloudsValues() []RecommendationSupportedClouds { + return []RecommendationSupportedClouds{ + RecommendationSupportedCloudsAWS, + RecommendationSupportedCloudsAzure, + RecommendationSupportedCloudsGCP, } } @@ -1574,10 +1724,14 @@ func PossibleRecommendationTypeValues() []RecommendationType { type ReportedSeverity string const ( - ReportedSeverityHigh ReportedSeverity = "High" + // ReportedSeverityHigh - High + ReportedSeverityHigh ReportedSeverity = "High" + // ReportedSeverityInformational - Informational ReportedSeverityInformational ReportedSeverity = "Informational" - ReportedSeverityLow ReportedSeverity = "Low" - ReportedSeverityMedium ReportedSeverity = "Medium" + // ReportedSeverityLow - Low + ReportedSeverityLow ReportedSeverity = "Low" + // ReportedSeverityMedium - Medium + ReportedSeverityMedium ReportedSeverity = "Medium" ) // PossibleReportedSeverityValues returns the possible values for the ReportedSeverity const type. @@ -1595,8 +1749,10 @@ func PossibleReportedSeverityValues() []ReportedSeverity { type ResourceIdentifierType string const ( + // ResourceIdentifierTypeAzureResource - AzureResource ResourceIdentifierTypeAzureResource ResourceIdentifierType = "AzureResource" - ResourceIdentifierTypeLogAnalytics ResourceIdentifierType = "LogAnalytics" + // ResourceIdentifierTypeLogAnalytics - LogAnalytics + ResourceIdentifierTypeLogAnalytics ResourceIdentifierType = "LogAnalytics" ) // PossibleResourceIdentifierTypeValues returns the possible values for the ResourceIdentifierType const type. @@ -1632,10 +1788,9 @@ func PossibleResourceStatusValues() []ResourceStatus { } // ResourcesCoverageStatus - This field is available for subscription-level only, and reflects the coverage status of the -// resources under the subscription. Please note: The "pricingTier" field reflects the plan status of the -// subscription. However, since the plan status can also be defined at the resource level, there might be misalignment between -// the subscription's plan status and the resource status. This field helps -// indicate the coverage status of the resources. +// resources under the subscription. Please note: The "pricingTier" field reflects the plan status of the subscription. However, +// since the plan status can also be defined at the resource level, there might be misalignment between the subscription's +// plan status and the resource status. This field helps indicate the coverage status of the resources. type ResourcesCoverageStatus string const ( @@ -1659,17 +1814,55 @@ func PossibleResourcesCoverageStatusValues() []ResourcesCoverageStatus { } } -// RuleCategory - Rule categories. Code - code scanning results. Artifact scanning results. Dependencies scanning results. -// IaC results. Secrets scanning results. Container scanning results. +// RiskLevel - The risk level +type RiskLevel string + +const ( + // RiskLevelCritical - Critical + RiskLevelCritical RiskLevel = "Critical" + // RiskLevelHigh - High + RiskLevelHigh RiskLevel = "High" + // RiskLevelLow - Low + RiskLevelLow RiskLevel = "Low" + // RiskLevelMedium - Medium + RiskLevelMedium RiskLevel = "Medium" + // RiskLevelNone - None + RiskLevelNone RiskLevel = "None" +) + +// PossibleRiskLevelValues returns the possible values for the RiskLevel const type. +func PossibleRiskLevelValues() []RiskLevel { + return []RiskLevel{ + RiskLevelCritical, + RiskLevelHigh, + RiskLevelLow, + RiskLevelMedium, + RiskLevelNone, + } +} + +// RuleCategory - Rule categories. +// Code - code scanning results. +// Artifact scanning results. +// Dependencies scanning results. +// IaC results. +// Secrets scanning results. +// Container scanning results. type RuleCategory string const ( - RuleCategoryArtifacts RuleCategory = "Artifacts" - RuleCategoryCode RuleCategory = "Code" - RuleCategoryContainers RuleCategory = "Containers" + // RuleCategoryArtifacts - Artifacts + RuleCategoryArtifacts RuleCategory = "Artifacts" + // RuleCategoryCode - Code + RuleCategoryCode RuleCategory = "Code" + // RuleCategoryContainers - Containers + RuleCategoryContainers RuleCategory = "Containers" + // RuleCategoryDependencies - Dependencies RuleCategoryDependencies RuleCategory = "Dependencies" - RuleCategoryIaC RuleCategory = "IaC" - RuleCategorySecrets RuleCategory = "Secrets" + // RuleCategoryIaC - IaC + RuleCategoryIaC RuleCategory = "IaC" + // RuleCategorySecrets - Secrets + RuleCategorySecrets RuleCategory = "Secrets" ) // PossibleRuleCategoryValues returns the possible values for the RuleCategory const type. @@ -1688,15 +1881,15 @@ func PossibleRuleCategoryValues() []RuleCategory { type RuleSeverity string const ( - // RuleSeverityHigh - High + // RuleSeverityHigh - High severity vulnerability requiring immediate attention. RuleSeverityHigh RuleSeverity = "High" - // RuleSeverityInformational - Informational + // RuleSeverityInformational - Informational finding that does not indicate a vulnerability. RuleSeverityInformational RuleSeverity = "Informational" - // RuleSeverityLow - Low + // RuleSeverityLow - Low severity vulnerability with minimal risk. RuleSeverityLow RuleSeverity = "Low" - // RuleSeverityMedium - Medium + // RuleSeverityMedium - Medium severity vulnerability that should be addressed. RuleSeverityMedium RuleSeverity = "Medium" - // RuleSeverityObsolete - Obsolete + // RuleSeverityObsolete - The rule is obsolete and no longer applicable. RuleSeverityObsolete RuleSeverity = "Obsolete" ) @@ -1715,9 +1908,12 @@ func PossibleRuleSeverityValues() []RuleSeverity { type RuleState string const ( + // RuleStateDisabled - Disabled RuleStateDisabled RuleState = "Disabled" - RuleStateEnabled RuleState = "Enabled" - RuleStateExpired RuleState = "Expired" + // RuleStateEnabled - Enabled + RuleStateEnabled RuleState = "Enabled" + // RuleStateExpired - Expired + RuleStateExpired RuleState = "Expired" ) // PossibleRuleStateValues returns the possible values for the RuleState const type. @@ -1733,12 +1929,14 @@ func PossibleRuleStateValues() []RuleState { type RuleStatus string const ( - // RuleStatusFinding - Finding + // RuleStatusFinding - A vulnerability was found for this rule. RuleStatusFinding RuleStatus = "Finding" - // RuleStatusInternalError - InternalError + // RuleStatusInternalError - An internal error occurred while evaluating this rule. RuleStatusInternalError RuleStatus = "InternalError" - // RuleStatusNonFinding - NonFinding + // RuleStatusNonFinding - No vulnerability was found for this rule. RuleStatusNonFinding RuleStatus = "NonFinding" + // RuleStatusNotApplicable - The rule is not applicable to the assessed resource. + RuleStatusNotApplicable RuleStatus = "NotApplicable" ) // PossibleRuleStatusValues returns the possible values for the RuleStatus const type. @@ -1747,6 +1945,7 @@ func PossibleRuleStatusValues() []RuleStatus { RuleStatusFinding, RuleStatusInternalError, RuleStatusNonFinding, + RuleStatusNotApplicable, } } @@ -1774,6 +1973,48 @@ func PossibleRuleTypeValues() []RuleType { } } +// SQLVulnerabilityAssessmentState - Represents the state of a SQL Vulnerability Assessment. +type SQLVulnerabilityAssessmentState string + +const ( + // SQLVulnerabilityAssessmentStateDisabled - Disabled + SQLVulnerabilityAssessmentStateDisabled SQLVulnerabilityAssessmentState = "Disabled" + // SQLVulnerabilityAssessmentStateEnabled - Enabled + SQLVulnerabilityAssessmentStateEnabled SQLVulnerabilityAssessmentState = "Enabled" +) + +// PossibleSQLVulnerabilityAssessmentStateValues returns the possible values for the SQLVulnerabilityAssessmentState const type. +func PossibleSQLVulnerabilityAssessmentStateValues() []SQLVulnerabilityAssessmentState { + return []SQLVulnerabilityAssessmentState{ + SQLVulnerabilityAssessmentStateDisabled, + SQLVulnerabilityAssessmentStateEnabled, + } +} + +// ScanOperationStatus - The scan operation status. +type ScanOperationStatus string + +const ( + // ScanOperationStatusFailed - The scan completed but found vulnerabilities. + ScanOperationStatusFailed ScanOperationStatus = "Failed" + // ScanOperationStatusFailedToRun - The scan failed to execute. + ScanOperationStatusFailedToRun ScanOperationStatus = "FailedToRun" + // ScanOperationStatusInProgress - The scan is currently running. + ScanOperationStatusInProgress ScanOperationStatus = "InProgress" + // ScanOperationStatusPassed - The scan completed successfully with no vulnerabilities found. + ScanOperationStatusPassed ScanOperationStatus = "Passed" +) + +// PossibleScanOperationStatusValues returns the possible values for the ScanOperationStatus const type. +func PossibleScanOperationStatusValues() []ScanOperationStatus { + return []ScanOperationStatus{ + ScanOperationStatusFailed, + ScanOperationStatusFailedToRun, + ScanOperationStatusInProgress, + ScanOperationStatusPassed, + } +} + // ScanState - The scan status. type ScanState string @@ -1820,6 +2061,7 @@ func PossibleScanTriggerTypeValues() []ScanTriggerType { type ScanningMode string const ( + // ScanningModeDefault - Default ScanningModeDefault ScanningMode = "Default" ) @@ -1872,10 +2114,14 @@ func PossibleSecurityContactRoleValues() []SecurityContactRole { type SecurityFamily string const ( - SecurityFamilyNgfw SecurityFamily = "Ngfw" + // SecurityFamilyNgfw - Ngfw + SecurityFamilyNgfw SecurityFamily = "Ngfw" + // SecurityFamilySaasWaf - SaasWaf SecurityFamilySaasWaf SecurityFamily = "SaasWaf" - SecurityFamilyVa SecurityFamily = "Va" - SecurityFamilyWaf SecurityFamily = "Waf" + // SecurityFamilyVa - Va + SecurityFamilyVa SecurityFamily = "Va" + // SecurityFamilyWaf - Waf + SecurityFamilyWaf SecurityFamily = "Waf" ) // PossibleSecurityFamilyValues returns the possible values for the SecurityFamily const type. @@ -1888,12 +2134,44 @@ func PossibleSecurityFamilyValues() []SecurityFamily { } } +// SecurityIssue - The severity to relate to the assessments generated by this Recommendation. +type SecurityIssue string + +const ( + // SecurityIssueAnonymousAccess - AnonymousAccess + SecurityIssueAnonymousAccess SecurityIssue = "AnonymousAccess" + // SecurityIssueBestPractices - BestPractices + SecurityIssueBestPractices SecurityIssue = "BestPractices" + // SecurityIssueExcessivePermissions - ExcessivePermissions + SecurityIssueExcessivePermissions SecurityIssue = "ExcessivePermissions" + // SecurityIssueNetworkExposure - NetworkExposure + SecurityIssueNetworkExposure SecurityIssue = "NetworkExposure" + // SecurityIssueTrafficEncryption - TrafficEncryption + SecurityIssueTrafficEncryption SecurityIssue = "TrafficEncryption" + // SecurityIssueVulnerability - Vulnerability + SecurityIssueVulnerability SecurityIssue = "Vulnerability" +) + +// PossibleSecurityIssueValues returns the possible values for the SecurityIssue const type. +func PossibleSecurityIssueValues() []SecurityIssue { + return []SecurityIssue{ + SecurityIssueAnonymousAccess, + SecurityIssueBestPractices, + SecurityIssueExcessivePermissions, + SecurityIssueNetworkExposure, + SecurityIssueTrafficEncryption, + SecurityIssueVulnerability, + } +} + // SecuritySolutionStatus - Status of the IoT Security solution. type SecuritySolutionStatus string const ( + // SecuritySolutionStatusDisabled - Disabled SecuritySolutionStatusDisabled SecuritySolutionStatus = "Disabled" - SecuritySolutionStatusEnabled SecuritySolutionStatus = "Enabled" + // SecuritySolutionStatusEnabled - Enabled + SecuritySolutionStatusEnabled SecuritySolutionStatus = "Enabled" ) // PossibleSecuritySolutionStatusValues returns the possible values for the SecuritySolutionStatus const type. @@ -1909,11 +2187,16 @@ func PossibleSecuritySolutionStatusValues() []SecuritySolutionStatus { type ServerVulnerabilityAssessmentPropertiesProvisioningState string const ( - ServerVulnerabilityAssessmentPropertiesProvisioningStateCanceled ServerVulnerabilityAssessmentPropertiesProvisioningState = "Canceled" + // ServerVulnerabilityAssessmentPropertiesProvisioningStateCanceled - Canceled + ServerVulnerabilityAssessmentPropertiesProvisioningStateCanceled ServerVulnerabilityAssessmentPropertiesProvisioningState = "Canceled" + // ServerVulnerabilityAssessmentPropertiesProvisioningStateDeprovisioning - Deprovisioning ServerVulnerabilityAssessmentPropertiesProvisioningStateDeprovisioning ServerVulnerabilityAssessmentPropertiesProvisioningState = "Deprovisioning" - ServerVulnerabilityAssessmentPropertiesProvisioningStateFailed ServerVulnerabilityAssessmentPropertiesProvisioningState = "Failed" - ServerVulnerabilityAssessmentPropertiesProvisioningStateProvisioning ServerVulnerabilityAssessmentPropertiesProvisioningState = "Provisioning" - ServerVulnerabilityAssessmentPropertiesProvisioningStateSucceeded ServerVulnerabilityAssessmentPropertiesProvisioningState = "Succeeded" + // ServerVulnerabilityAssessmentPropertiesProvisioningStateFailed - Failed + ServerVulnerabilityAssessmentPropertiesProvisioningStateFailed ServerVulnerabilityAssessmentPropertiesProvisioningState = "Failed" + // ServerVulnerabilityAssessmentPropertiesProvisioningStateProvisioning - Provisioning + ServerVulnerabilityAssessmentPropertiesProvisioningStateProvisioning ServerVulnerabilityAssessmentPropertiesProvisioningState = "Provisioning" + // ServerVulnerabilityAssessmentPropertiesProvisioningStateSucceeded - Succeeded + ServerVulnerabilityAssessmentPropertiesProvisioningStateSucceeded ServerVulnerabilityAssessmentPropertiesProvisioningState = "Succeeded" ) // PossibleServerVulnerabilityAssessmentPropertiesProvisioningStateValues returns the possible values for the ServerVulnerabilityAssessmentPropertiesProvisioningState const type. @@ -1948,6 +2231,7 @@ func PossibleServerVulnerabilityAssessmentsAzureSettingSelectedProviderValues() type ServerVulnerabilityAssessmentsSettingKind string const ( + // ServerVulnerabilityAssessmentsSettingKindAzureServersSetting - AzureServersSetting ServerVulnerabilityAssessmentsSettingKindAzureServersSetting ServerVulnerabilityAssessmentsSettingKind = "AzureServersSetting" ) @@ -1961,6 +2245,7 @@ func PossibleServerVulnerabilityAssessmentsSettingKindValues() []ServerVulnerabi type ServerVulnerabilityAssessmentsSettingKindName string const ( + // ServerVulnerabilityAssessmentsSettingKindNameAzureServersSetting - azureServersSetting ServerVulnerabilityAssessmentsSettingKindNameAzureServersSetting ServerVulnerabilityAssessmentsSettingKindName = "azureServersSetting" ) @@ -1975,9 +2260,12 @@ func PossibleServerVulnerabilityAssessmentsSettingKindNameValues() []ServerVulne type SettingKind string const ( + // SettingKindAlertSuppressionSetting - AlertSuppressionSetting SettingKindAlertSuppressionSetting SettingKind = "AlertSuppressionSetting" - SettingKindAlertSyncSettings SettingKind = "AlertSyncSettings" - SettingKindDataExportSettings SettingKind = "DataExportSettings" + // SettingKindAlertSyncSettings - AlertSyncSettings + SettingKindAlertSyncSettings SettingKind = "AlertSyncSettings" + // SettingKindDataExportSettings - DataExportSettings + SettingKindDataExportSettings SettingKind = "DataExportSettings" ) // PossibleSettingKindValues returns the possible values for the SettingKind const type. @@ -1994,60 +2282,63 @@ type SettingName string const ( // SettingNameCurrent - Name of the Defender for Storage Settings name. SettingNameCurrent SettingName = "current" + // SettingNameMCAS - MCAS + SettingNameMCAS SettingName = "MCAS" + // SettingNameSentinel - Sentinel + SettingNameSentinel SettingName = "Sentinel" + // SettingNameWDATP - WDATP + SettingNameWDATP SettingName = "WDATP" + // SettingNameWDATPEXCLUDELINUXPUBLICPREVIEW - WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW + SettingNameWDATPEXCLUDELINUXPUBLICPREVIEW SettingName = "WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW" + // SettingNameWDATPUNIFIEDSOLUTION - WDATP_UNIFIED_SOLUTION + SettingNameWDATPUNIFIEDSOLUTION SettingName = "WDATP_UNIFIED_SOLUTION" ) // PossibleSettingNameValues returns the possible values for the SettingName const type. func PossibleSettingNameValues() []SettingName { return []SettingName{ SettingNameCurrent, + SettingNameMCAS, + SettingNameSentinel, + SettingNameWDATP, + SettingNameWDATPEXCLUDELINUXPUBLICPREVIEW, + SettingNameWDATPUNIFIEDSOLUTION, } } -type SettingNameAutoGenerated string - -const ( - SettingNameAutoGeneratedMCAS SettingNameAutoGenerated = "MCAS" - SettingNameAutoGeneratedSentinel SettingNameAutoGenerated = "Sentinel" - SettingNameAutoGeneratedWDATP SettingNameAutoGenerated = "WDATP" - SettingNameAutoGeneratedWDATPEXCLUDELINUXPUBLICPREVIEW SettingNameAutoGenerated = "WDATP_EXCLUDE_LINUX_PUBLIC_PREVIEW" - SettingNameAutoGeneratedWDATPUNIFIEDSOLUTION SettingNameAutoGenerated = "WDATP_UNIFIED_SOLUTION" -) - -// PossibleSettingNameAutoGeneratedValues returns the possible values for the SettingNameAutoGenerated const type. -func PossibleSettingNameAutoGeneratedValues() []SettingNameAutoGenerated { - return []SettingNameAutoGenerated{ - SettingNameAutoGeneratedMCAS, - SettingNameAutoGeneratedSentinel, - SettingNameAutoGeneratedWDATP, - SettingNameAutoGeneratedWDATPEXCLUDELINUXPUBLICPREVIEW, - SettingNameAutoGeneratedWDATPUNIFIEDSOLUTION, - } -} - -// Severity - The sub-assessment severity level +// Severity - The severity level of the assessment type Severity string const ( - SeverityHigh Severity = "High" - SeverityLow Severity = "Low" + // SeverityCritical - Critical + SeverityCritical Severity = "Critical" + // SeverityHigh - High + SeverityHigh Severity = "High" + // SeverityLow - Low + SeverityLow Severity = "Low" + // SeverityMedium - Medium SeverityMedium Severity = "Medium" ) // PossibleSeverityValues returns the possible values for the Severity const type. func PossibleSeverityValues() []Severity { return []Severity{ + SeverityCritical, SeverityHigh, SeverityLow, SeverityMedium, } } -// SeverityEnum - The severity to relate to the assessments generated by this assessment automation. +// SeverityEnum - The severity to relate to the assessments generated by this Recommendation. type SeverityEnum string const ( - SeverityEnumHigh SeverityEnum = "High" - SeverityEnumLow SeverityEnum = "Low" + // SeverityEnumHigh - High + SeverityEnumHigh SeverityEnum = "High" + // SeverityEnumLow - Low + SeverityEnumLow SeverityEnum = "Low" + // SeverityEnumMedium - Medium SeverityEnumMedium SeverityEnum = "Medium" ) @@ -2064,10 +2355,16 @@ func PossibleSeverityEnumValues() []SeverityEnum { type Source string const ( + // SourceAws - Aws + SourceAws Source = "Aws" // SourceAzure - Resource is in Azure SourceAzure Source = "Azure" + // SourceGcp - Gcp + SourceGcp Source = "Gcp" // SourceOnPremise - Resource in an on premise machine connected to Azure cloud SourceOnPremise Source = "OnPremise" + // SourceOnPremiseResourceDetails - On premise resource details + SourceOnPremiseResourceDetails Source = "OnPremiseResourceDetails" // SourceOnPremiseSQL - SQL Resource in an on premise machine connected to Azure cloud SourceOnPremiseSQL Source = "OnPremiseSql" ) @@ -2075,39 +2372,22 @@ const ( // PossibleSourceValues returns the possible values for the Source const type. func PossibleSourceValues() []Source { return []Source{ + SourceAws, SourceAzure, + SourceGcp, SourceOnPremise, + SourceOnPremiseResourceDetails, SourceOnPremiseSQL, } } -// SourceSystem - The source type of the machine group -type SourceSystem string - -const ( - SourceSystemAzureAppLocker SourceSystem = "Azure_AppLocker" - SourceSystemAzureAuditD SourceSystem = "Azure_AuditD" - SourceSystemNonAzureAppLocker SourceSystem = "NonAzure_AppLocker" - SourceSystemNonAzureAuditD SourceSystem = "NonAzure_AuditD" - SourceSystemNone SourceSystem = "None" -) - -// PossibleSourceSystemValues returns the possible values for the SourceSystem const type. -func PossibleSourceSystemValues() []SourceSystem { - return []SourceSystem{ - SourceSystemAzureAppLocker, - SourceSystemAzureAuditD, - SourceSystemNonAzureAppLocker, - SourceSystemNonAzureAuditD, - SourceSystemNone, - } -} - // SourceType - The source type that will trigger the notification type SourceType string const ( - SourceTypeAlert SourceType = "Alert" + // SourceTypeAlert - Alert + SourceTypeAlert SourceType = "Alert" + // SourceTypeAttackPath - AttackPath SourceTypeAttackPath SourceType = "AttackPath" ) @@ -2119,12 +2399,76 @@ func PossibleSourceTypeValues() []SourceType { } } +// StandardSupportedCloud - The cloud that the standard is supported on. +type StandardSupportedCloud string + +const ( + // StandardSupportedCloudAWS - AWS + StandardSupportedCloudAWS StandardSupportedCloud = "AWS" + // StandardSupportedCloudAzure - Azure + StandardSupportedCloudAzure StandardSupportedCloud = "Azure" + // StandardSupportedCloudGCP - GCP + StandardSupportedCloudGCP StandardSupportedCloud = "GCP" +) + +// PossibleStandardSupportedCloudValues returns the possible values for the StandardSupportedCloud const type. +func PossibleStandardSupportedCloudValues() []StandardSupportedCloud { + return []StandardSupportedCloud{ + StandardSupportedCloudAWS, + StandardSupportedCloudAzure, + StandardSupportedCloudGCP, + } +} + +// StandardSupportedClouds - The cloud that the standard is supported on. +type StandardSupportedClouds string + +const ( + // StandardSupportedCloudsAWS - AWS + StandardSupportedCloudsAWS StandardSupportedClouds = "AWS" + // StandardSupportedCloudsGCP - GCP + StandardSupportedCloudsGCP StandardSupportedClouds = "GCP" +) + +// PossibleStandardSupportedCloudsValues returns the possible values for the StandardSupportedClouds const type. +func PossibleStandardSupportedCloudsValues() []StandardSupportedClouds { + return []StandardSupportedClouds{ + StandardSupportedCloudsAWS, + StandardSupportedCloudsGCP, + } +} + +// StandardType - Standard type (Custom or Default or Compliance only currently) +type StandardType string + +const ( + // StandardTypeCompliance - Compliance + StandardTypeCompliance StandardType = "Compliance" + // StandardTypeCustom - Custom + StandardTypeCustom StandardType = "Custom" + // StandardTypeDefault - Default + StandardTypeDefault StandardType = "Default" +) + +// PossibleStandardTypeValues returns the possible values for the StandardType const type. +func PossibleStandardTypeValues() []StandardType { + return []StandardType{ + StandardTypeCompliance, + StandardTypeCustom, + StandardTypeDefault, + } +} + // State - Aggregative state based on the standard's supported controls states type State string const ( // StateFailed - At least one supported regulatory compliance control in the given standard has a state of failed StateFailed State = "Failed" + // StateOff - Don't send notification on new alerts to the subscription's admins + StateOff State = "Off" + // StateOn - Send notification on new alerts to the subscription's admins + StateOn State = "On" // StatePassed - All supported regulatory compliance controls in the given standard have a passed state StatePassed State = "Passed" // StateSkipped - All supported regulatory compliance controls in the given standard have a state of skipped @@ -2137,25 +2481,29 @@ const ( func PossibleStateValues() []State { return []State{ StateFailed, + StateOff, + StateOn, StatePassed, StateSkipped, StateUnsupported, } } -// Status - The status of the port -type Status string +// StatusEnum - The status of the port +type StatusEnum string const ( - StatusInitiated Status = "Initiated" - StatusRevoked Status = "Revoked" + // StatusEnumInitiated - Initiated + StatusEnumInitiated StatusEnum = "Initiated" + // StatusEnumRevoked - Revoked + StatusEnumRevoked StatusEnum = "Revoked" ) -// PossibleStatusValues returns the possible values for the Status const type. -func PossibleStatusValues() []Status { - return []Status{ - StatusInitiated, - StatusRevoked, +// PossibleStatusEnumValues returns the possible values for the StatusEnum const type. +func PossibleStatusEnumValues() []StatusEnum { + return []StatusEnum{ + StatusEnumInitiated, + StatusEnumRevoked, } } @@ -2163,9 +2511,12 @@ func PossibleStatusValues() []Status { type StatusName string const ( - StatusNameHealthy StatusName = "Healthy" + // StatusNameHealthy - Healthy + StatusNameHealthy StatusName = "Healthy" + // StatusNameNotApplicable - NotApplicable StatusNameNotApplicable StatusName = "NotApplicable" - StatusNameNotHealthy StatusName = "NotHealthy" + // StatusNameNotHealthy - NotHealthy + StatusNameNotHealthy StatusName = "NotHealthy" ) // PossibleStatusNameValues returns the possible values for the StatusName const type. @@ -2177,13 +2528,16 @@ func PossibleStatusNameValues() []StatusName { } } -// StatusReason - A description of why the status has its value +// StatusReason - A description of why the `status` has its value type StatusReason string const ( - StatusReasonExpired StatusReason = "Expired" + // StatusReasonExpired - Expired + StatusReasonExpired StatusReason = "Expired" + // StatusReasonNewerRequestInitiated - NewerRequestInitiated StatusReasonNewerRequestInitiated StatusReason = "NewerRequestInitiated" - StatusReasonUserRequested StatusReason = "UserRequested" + // StatusReasonUserRequested - UserRequested + StatusReasonUserRequested StatusReason = "UserRequested" ) // PossibleStatusReasonValues returns the possible values for the StatusReason const type. @@ -2220,7 +2574,9 @@ func PossibleSubAssessmentStatusCodeValues() []SubAssessmentStatusCode { type SubPlan string const ( + // SubPlanP1 - P1 SubPlanP1 SubPlan = "P1" + // SubPlanP2 - P2 SubPlanP2 SubPlan = "P2" ) @@ -2232,39 +2588,37 @@ func PossibleSubPlanValues() []SubPlan { } } -// SupportedCloudEnum - Relevant cloud for the custom assessment automation. -type SupportedCloudEnum string - -const ( - SupportedCloudEnumAWS SupportedCloudEnum = "AWS" - SupportedCloudEnumGCP SupportedCloudEnum = "GCP" -) - -// PossibleSupportedCloudEnumValues returns the possible values for the SupportedCloudEnum const type. -func PossibleSupportedCloudEnumValues() []SupportedCloudEnum { - return []SupportedCloudEnum{ - SupportedCloudEnumAWS, - SupportedCloudEnumGCP, - } -} - // Tactics - Tactic of the assessment type Tactics string const ( - TacticsCollection Tactics = "Collection" - TacticsCommandAndControl Tactics = "Command and Control" - TacticsCredentialAccess Tactics = "Credential Access" - TacticsDefenseEvasion Tactics = "Defense Evasion" - TacticsDiscovery Tactics = "Discovery" - TacticsExecution Tactics = "Execution" - TacticsExfiltration Tactics = "Exfiltration" - TacticsImpact Tactics = "Impact" - TacticsInitialAccess Tactics = "Initial Access" - TacticsLateralMovement Tactics = "Lateral Movement" - TacticsPersistence Tactics = "Persistence" + // TacticsCollection - Collection + TacticsCollection Tactics = "Collection" + // TacticsCommandAndControl - Command and Control + TacticsCommandAndControl Tactics = "Command and Control" + // TacticsCredentialAccess - Credential Access + TacticsCredentialAccess Tactics = "Credential Access" + // TacticsDefenseEvasion - Defense Evasion + TacticsDefenseEvasion Tactics = "Defense Evasion" + // TacticsDiscovery - Discovery + TacticsDiscovery Tactics = "Discovery" + // TacticsExecution - Execution + TacticsExecution Tactics = "Execution" + // TacticsExfiltration - Exfiltration + TacticsExfiltration Tactics = "Exfiltration" + // TacticsImpact - Impact + TacticsImpact Tactics = "Impact" + // TacticsInitialAccess - Initial Access + TacticsInitialAccess Tactics = "Initial Access" + // TacticsLateralMovement - Lateral Movement + TacticsLateralMovement Tactics = "Lateral Movement" + // TacticsPersistence - Persistence + TacticsPersistence Tactics = "Persistence" + // TacticsPrivilegeEscalation - Privilege Escalation TacticsPrivilegeEscalation Tactics = "Privilege Escalation" - TacticsReconnaissance Tactics = "Reconnaissance" + // TacticsReconnaissance - Reconnaissance + TacticsReconnaissance Tactics = "Reconnaissance" + // TacticsResourceDevelopment - Resource Development TacticsResourceDevelopment Tactics = "Resource Development" ) @@ -2291,11 +2645,16 @@ func PossibleTacticsValues() []Tactics { type TaskUpdateActionType string const ( + // TaskUpdateActionTypeActivate - Activate TaskUpdateActionTypeActivate TaskUpdateActionType = "Activate" - TaskUpdateActionTypeClose TaskUpdateActionType = "Close" - TaskUpdateActionTypeDismiss TaskUpdateActionType = "Dismiss" - TaskUpdateActionTypeResolve TaskUpdateActionType = "Resolve" - TaskUpdateActionTypeStart TaskUpdateActionType = "Start" + // TaskUpdateActionTypeClose - Close + TaskUpdateActionTypeClose TaskUpdateActionType = "Close" + // TaskUpdateActionTypeDismiss - Dismiss + TaskUpdateActionTypeDismiss TaskUpdateActionType = "Dismiss" + // TaskUpdateActionTypeResolve - Resolve + TaskUpdateActionTypeResolve TaskUpdateActionType = "Resolve" + // TaskUpdateActionTypeStart - Start + TaskUpdateActionTypeStart TaskUpdateActionType = "Start" ) // PossibleTaskUpdateActionTypeValues returns the possible values for the TaskUpdateActionType const type. @@ -2313,110 +2672,214 @@ func PossibleTaskUpdateActionTypeValues() []TaskUpdateActionType { type Techniques string const ( - TechniquesAbuseElevationControlMechanism Techniques = "Abuse Elevation Control Mechanism" - TechniquesAccessTokenManipulation Techniques = "Access Token Manipulation" - TechniquesAccountDiscovery Techniques = "Account Discovery" - TechniquesAccountManipulation Techniques = "Account Manipulation" - TechniquesActiveScanning Techniques = "Active Scanning" - TechniquesApplicationLayerProtocol Techniques = "Application Layer Protocol" - TechniquesAudioCapture Techniques = "Audio Capture" - TechniquesBootOrLogonAutostartExecution Techniques = "Boot or Logon Autostart Execution" - TechniquesBootOrLogonInitializationScripts Techniques = "Boot or Logon Initialization Scripts" - TechniquesBruteForce Techniques = "Brute Force" - TechniquesCloudInfrastructureDiscovery Techniques = "Cloud Infrastructure Discovery" - TechniquesCloudServiceDashboard Techniques = "Cloud Service Dashboard" - TechniquesCloudServiceDiscovery Techniques = "Cloud Service Discovery" - TechniquesCommandAndScriptingInterpreter Techniques = "Command and Scripting Interpreter" - TechniquesCompromiseClientSoftwareBinary Techniques = "Compromise Client Software Binary" - TechniquesCompromiseInfrastructure Techniques = "Compromise Infrastructure" - TechniquesContainerAndResourceDiscovery Techniques = "Container and Resource Discovery" - TechniquesCreateAccount Techniques = "Create Account" - TechniquesCreateOrModifySystemProcess Techniques = "Create or Modify System Process" - TechniquesCredentialsFromPasswordStores Techniques = "Credentials from Password Stores" - TechniquesDataDestruction Techniques = "Data Destruction" - TechniquesDataEncryptedForImpact Techniques = "Data Encrypted for Impact" - TechniquesDataFromCloudStorageObject Techniques = "Data from Cloud Storage Object" - TechniquesDataFromConfigurationRepository Techniques = "Data from Configuration Repository" - TechniquesDataFromInformationRepositories Techniques = "Data from Information Repositories" - TechniquesDataFromLocalSystem Techniques = "Data from Local System" - TechniquesDataManipulation Techniques = "Data Manipulation" - TechniquesDataStaged Techniques = "Data Staged" - TechniquesDefacement Techniques = "Defacement" - TechniquesDeobfuscateDecodeFilesOrInformation Techniques = "Deobfuscate/Decode Files or Information" - TechniquesDiskWipe Techniques = "Disk Wipe" - TechniquesDomainTrustDiscovery Techniques = "Domain Trust Discovery" - TechniquesDriveByCompromise Techniques = "Drive-by Compromise" - TechniquesDynamicResolution Techniques = "Dynamic Resolution" - TechniquesEndpointDenialOfService Techniques = "Endpoint Denial of Service" - TechniquesEventTriggeredExecution Techniques = "Event Triggered Execution" - TechniquesExfiltrationOverAlternativeProtocol Techniques = "Exfiltration Over Alternative Protocol" - TechniquesExploitPublicFacingApplication Techniques = "Exploit Public-Facing Application" - TechniquesExploitationForClientExecution Techniques = "Exploitation for Client Execution" - TechniquesExploitationForCredentialAccess Techniques = "Exploitation for Credential Access" - TechniquesExploitationForDefenseEvasion Techniques = "Exploitation for Defense Evasion" - TechniquesExploitationForPrivilegeEscalation Techniques = "Exploitation for Privilege Escalation" - TechniquesExploitationOfRemoteServices Techniques = "Exploitation of Remote Services" - TechniquesExternalRemoteServices Techniques = "External Remote Services" - TechniquesFallbackChannels Techniques = "Fallback Channels" - TechniquesFileAndDirectoryDiscovery Techniques = "File and Directory Discovery" + // TechniquesAbuseElevationControlMechanism - Abuse Elevation Control Mechanism + TechniquesAbuseElevationControlMechanism Techniques = "Abuse Elevation Control Mechanism" + // TechniquesAccessTokenManipulation - Access Token Manipulation + TechniquesAccessTokenManipulation Techniques = "Access Token Manipulation" + // TechniquesAccountDiscovery - Account Discovery + TechniquesAccountDiscovery Techniques = "Account Discovery" + // TechniquesAccountManipulation - Account Manipulation + TechniquesAccountManipulation Techniques = "Account Manipulation" + // TechniquesActiveScanning - Active Scanning + TechniquesActiveScanning Techniques = "Active Scanning" + // TechniquesApplicationLayerProtocol - Application Layer Protocol + TechniquesApplicationLayerProtocol Techniques = "Application Layer Protocol" + // TechniquesAudioCapture - Audio Capture + TechniquesAudioCapture Techniques = "Audio Capture" + // TechniquesBootOrLogonAutostartExecution - Boot or Logon Autostart Execution + TechniquesBootOrLogonAutostartExecution Techniques = "Boot or Logon Autostart Execution" + // TechniquesBootOrLogonInitializationScripts - Boot or Logon Initialization Scripts + TechniquesBootOrLogonInitializationScripts Techniques = "Boot or Logon Initialization Scripts" + // TechniquesBruteForce - Brute Force + TechniquesBruteForce Techniques = "Brute Force" + // TechniquesCloudInfrastructureDiscovery - Cloud Infrastructure Discovery + TechniquesCloudInfrastructureDiscovery Techniques = "Cloud Infrastructure Discovery" + // TechniquesCloudServiceDashboard - Cloud Service Dashboard + TechniquesCloudServiceDashboard Techniques = "Cloud Service Dashboard" + // TechniquesCloudServiceDiscovery - Cloud Service Discovery + TechniquesCloudServiceDiscovery Techniques = "Cloud Service Discovery" + // TechniquesCommandAndScriptingInterpreter - Command and Scripting Interpreter + TechniquesCommandAndScriptingInterpreter Techniques = "Command and Scripting Interpreter" + // TechniquesCompromiseClientSoftwareBinary - Compromise Client Software Binary + TechniquesCompromiseClientSoftwareBinary Techniques = "Compromise Client Software Binary" + // TechniquesCompromiseInfrastructure - Compromise Infrastructure + TechniquesCompromiseInfrastructure Techniques = "Compromise Infrastructure" + // TechniquesContainerAndResourceDiscovery - Container and Resource Discovery + TechniquesContainerAndResourceDiscovery Techniques = "Container and Resource Discovery" + // TechniquesCreateAccount - Create Account + TechniquesCreateAccount Techniques = "Create Account" + // TechniquesCreateOrModifySystemProcess - Create or Modify System Process + TechniquesCreateOrModifySystemProcess Techniques = "Create or Modify System Process" + // TechniquesCredentialsFromPasswordStores - Credentials from Password Stores + TechniquesCredentialsFromPasswordStores Techniques = "Credentials from Password Stores" + // TechniquesDataDestruction - Data Destruction + TechniquesDataDestruction Techniques = "Data Destruction" + // TechniquesDataEncryptedForImpact - Data Encrypted for Impact + TechniquesDataEncryptedForImpact Techniques = "Data Encrypted for Impact" + // TechniquesDataFromCloudStorageObject - Data from Cloud Storage Object + TechniquesDataFromCloudStorageObject Techniques = "Data from Cloud Storage Object" + // TechniquesDataFromConfigurationRepository - Data from Configuration Repository + TechniquesDataFromConfigurationRepository Techniques = "Data from Configuration Repository" + // TechniquesDataFromInformationRepositories - Data from Information Repositories + TechniquesDataFromInformationRepositories Techniques = "Data from Information Repositories" + // TechniquesDataFromLocalSystem - Data from Local System + TechniquesDataFromLocalSystem Techniques = "Data from Local System" + // TechniquesDataManipulation - Data Manipulation + TechniquesDataManipulation Techniques = "Data Manipulation" + // TechniquesDataStaged - Data Staged + TechniquesDataStaged Techniques = "Data Staged" + // TechniquesDefacement - Defacement + TechniquesDefacement Techniques = "Defacement" + // TechniquesDeobfuscateDecodeFilesOrInformation - Deobfuscate/Decode Files or Information + TechniquesDeobfuscateDecodeFilesOrInformation Techniques = "Deobfuscate/Decode Files or Information" + // TechniquesDiskWipe - Disk Wipe + TechniquesDiskWipe Techniques = "Disk Wipe" + // TechniquesDomainTrustDiscovery - Domain Trust Discovery + TechniquesDomainTrustDiscovery Techniques = "Domain Trust Discovery" + // TechniquesDriveByCompromise - Drive-by Compromise + TechniquesDriveByCompromise Techniques = "Drive-by Compromise" + // TechniquesDynamicResolution - Dynamic Resolution + TechniquesDynamicResolution Techniques = "Dynamic Resolution" + // TechniquesEndpointDenialOfService - Endpoint Denial of Service + TechniquesEndpointDenialOfService Techniques = "Endpoint Denial of Service" + // TechniquesEventTriggeredExecution - Event Triggered Execution + TechniquesEventTriggeredExecution Techniques = "Event Triggered Execution" + // TechniquesExfiltrationOverAlternativeProtocol - Exfiltration Over Alternative Protocol + TechniquesExfiltrationOverAlternativeProtocol Techniques = "Exfiltration Over Alternative Protocol" + // TechniquesExploitPublicFacingApplication - Exploit Public-Facing Application + TechniquesExploitPublicFacingApplication Techniques = "Exploit Public-Facing Application" + // TechniquesExploitationForClientExecution - Exploitation for Client Execution + TechniquesExploitationForClientExecution Techniques = "Exploitation for Client Execution" + // TechniquesExploitationForCredentialAccess - Exploitation for Credential Access + TechniquesExploitationForCredentialAccess Techniques = "Exploitation for Credential Access" + // TechniquesExploitationForDefenseEvasion - Exploitation for Defense Evasion + TechniquesExploitationForDefenseEvasion Techniques = "Exploitation for Defense Evasion" + // TechniquesExploitationForPrivilegeEscalation - Exploitation for Privilege Escalation + TechniquesExploitationForPrivilegeEscalation Techniques = "Exploitation for Privilege Escalation" + // TechniquesExploitationOfRemoteServices - Exploitation of Remote Services + TechniquesExploitationOfRemoteServices Techniques = "Exploitation of Remote Services" + // TechniquesExternalRemoteServices - External Remote Services + TechniquesExternalRemoteServices Techniques = "External Remote Services" + // TechniquesFallbackChannels - Fallback Channels + TechniquesFallbackChannels Techniques = "Fallback Channels" + // TechniquesFileAndDirectoryDiscovery - File and Directory Discovery + TechniquesFileAndDirectoryDiscovery Techniques = "File and Directory Discovery" + // TechniquesFileAndDirectoryPermissionsModification - File and Directory Permissions Modification TechniquesFileAndDirectoryPermissionsModification Techniques = "File and Directory Permissions Modification" - TechniquesGatherVictimNetworkInformation Techniques = "Gather Victim Network Information" - TechniquesHideArtifacts Techniques = "Hide Artifacts" - TechniquesHijackExecutionFlow Techniques = "Hijack Execution Flow" - TechniquesImpairDefenses Techniques = "Impair Defenses" - TechniquesImplantContainerImage Techniques = "Implant Container Image" - TechniquesIndicatorRemovalOnHost Techniques = "Indicator Removal on Host" - TechniquesIndirectCommandExecution Techniques = "Indirect Command Execution" - TechniquesIngressToolTransfer Techniques = "Ingress Tool Transfer" - TechniquesInputCapture Techniques = "Input Capture" - TechniquesInterProcessCommunication Techniques = "Inter-Process Communication" - TechniquesLateralToolTransfer Techniques = "Lateral Tool Transfer" - TechniquesManInTheMiddle Techniques = "Man-in-the-Middle" - TechniquesMasquerading Techniques = "Masquerading" - TechniquesModifyAuthenticationProcess Techniques = "Modify Authentication Process" - TechniquesModifyRegistry Techniques = "Modify Registry" - TechniquesNetworkDenialOfService Techniques = "Network Denial of Service" - TechniquesNetworkServiceScanning Techniques = "Network Service Scanning" - TechniquesNetworkSniffing Techniques = "Network Sniffing" - TechniquesNonApplicationLayerProtocol Techniques = "Non-Application Layer Protocol" - TechniquesNonStandardPort Techniques = "Non-Standard Port" - TechniquesOSCredentialDumping Techniques = "OS Credential Dumping" - TechniquesObfuscatedFilesOrInformation Techniques = "Obfuscated Files or Information" - TechniquesObtainCapabilities Techniques = "Obtain Capabilities" - TechniquesOfficeApplicationStartup Techniques = "Office Application Startup" - TechniquesPermissionGroupsDiscovery Techniques = "Permission Groups Discovery" - TechniquesPhishing Techniques = "Phishing" - TechniquesPreOSBoot Techniques = "Pre-OS Boot" - TechniquesProcessDiscovery Techniques = "Process Discovery" - TechniquesProcessInjection Techniques = "Process Injection" - TechniquesProtocolTunneling Techniques = "Protocol Tunneling" - TechniquesProxy Techniques = "Proxy" - TechniquesQueryRegistry Techniques = "Query Registry" - TechniquesRemoteAccessSoftware Techniques = "Remote Access Software" - TechniquesRemoteServiceSessionHijacking Techniques = "Remote Service Session Hijacking" - TechniquesRemoteServices Techniques = "Remote Services" - TechniquesRemoteSystemDiscovery Techniques = "Remote System Discovery" - TechniquesResourceHijacking Techniques = "Resource Hijacking" - TechniquesSQLStoredProcedures Techniques = "SQL Stored Procedures" - TechniquesScheduledTaskJob Techniques = "Scheduled Task/Job" - TechniquesScreenCapture Techniques = "Screen Capture" - TechniquesSearchVictimOwnedWebsites Techniques = "Search Victim-Owned Websites" - TechniquesServerSoftwareComponent Techniques = "Server Software Component" - TechniquesServiceStop Techniques = "Service Stop" - TechniquesSignedBinaryProxyExecution Techniques = "Signed Binary Proxy Execution" - TechniquesSoftwareDeploymentTools Techniques = "Software Deployment Tools" - TechniquesStealOrForgeKerberosTickets Techniques = "Steal or Forge Kerberos Tickets" - TechniquesSubvertTrustControls Techniques = "Subvert Trust Controls" - TechniquesSupplyChainCompromise Techniques = "Supply Chain Compromise" - TechniquesSystemInformationDiscovery Techniques = "System Information Discovery" - TechniquesTaintSharedContent Techniques = "Taint Shared Content" - TechniquesTrafficSignaling Techniques = "Traffic Signaling" - TechniquesTransferDataToCloudAccount Techniques = "Transfer Data to Cloud Account" - TechniquesTrustedRelationship Techniques = "Trusted Relationship" - TechniquesUnsecuredCredentials Techniques = "Unsecured Credentials" - TechniquesUserExecution Techniques = "User Execution" - TechniquesValidAccounts Techniques = "Valid Accounts" - TechniquesWindowsManagementInstrumentation Techniques = "Windows Management Instrumentation" + // TechniquesGatherVictimNetworkInformation - Gather Victim Network Information + TechniquesGatherVictimNetworkInformation Techniques = "Gather Victim Network Information" + // TechniquesHideArtifacts - Hide Artifacts + TechniquesHideArtifacts Techniques = "Hide Artifacts" + // TechniquesHijackExecutionFlow - Hijack Execution Flow + TechniquesHijackExecutionFlow Techniques = "Hijack Execution Flow" + // TechniquesImpairDefenses - Impair Defenses + TechniquesImpairDefenses Techniques = "Impair Defenses" + // TechniquesImplantContainerImage - Implant Container Image + TechniquesImplantContainerImage Techniques = "Implant Container Image" + // TechniquesIndicatorRemovalOnHost - Indicator Removal on Host + TechniquesIndicatorRemovalOnHost Techniques = "Indicator Removal on Host" + // TechniquesIndirectCommandExecution - Indirect Command Execution + TechniquesIndirectCommandExecution Techniques = "Indirect Command Execution" + // TechniquesIngressToolTransfer - Ingress Tool Transfer + TechniquesIngressToolTransfer Techniques = "Ingress Tool Transfer" + // TechniquesInputCapture - Input Capture + TechniquesInputCapture Techniques = "Input Capture" + // TechniquesInterProcessCommunication - Inter-Process Communication + TechniquesInterProcessCommunication Techniques = "Inter-Process Communication" + // TechniquesLateralToolTransfer - Lateral Tool Transfer + TechniquesLateralToolTransfer Techniques = "Lateral Tool Transfer" + // TechniquesManInTheMiddle - Man-in-the-Middle + TechniquesManInTheMiddle Techniques = "Man-in-the-Middle" + // TechniquesMasquerading - Masquerading + TechniquesMasquerading Techniques = "Masquerading" + // TechniquesModifyAuthenticationProcess - Modify Authentication Process + TechniquesModifyAuthenticationProcess Techniques = "Modify Authentication Process" + // TechniquesModifyRegistry - Modify Registry + TechniquesModifyRegistry Techniques = "Modify Registry" + // TechniquesNetworkDenialOfService - Network Denial of Service + TechniquesNetworkDenialOfService Techniques = "Network Denial of Service" + // TechniquesNetworkServiceScanning - Network Service Scanning + TechniquesNetworkServiceScanning Techniques = "Network Service Scanning" + // TechniquesNetworkSniffing - Network Sniffing + TechniquesNetworkSniffing Techniques = "Network Sniffing" + // TechniquesNonApplicationLayerProtocol - Non-Application Layer Protocol + TechniquesNonApplicationLayerProtocol Techniques = "Non-Application Layer Protocol" + // TechniquesNonStandardPort - Non-Standard Port + TechniquesNonStandardPort Techniques = "Non-Standard Port" + // TechniquesOSCredentialDumping - OS Credential Dumping + TechniquesOSCredentialDumping Techniques = "OS Credential Dumping" + // TechniquesObfuscatedFilesOrInformation - Obfuscated Files or Information + TechniquesObfuscatedFilesOrInformation Techniques = "Obfuscated Files or Information" + // TechniquesObtainCapabilities - Obtain Capabilities + TechniquesObtainCapabilities Techniques = "Obtain Capabilities" + // TechniquesOfficeApplicationStartup - Office Application Startup + TechniquesOfficeApplicationStartup Techniques = "Office Application Startup" + // TechniquesPermissionGroupsDiscovery - Permission Groups Discovery + TechniquesPermissionGroupsDiscovery Techniques = "Permission Groups Discovery" + // TechniquesPhishing - Phishing + TechniquesPhishing Techniques = "Phishing" + // TechniquesPreOSBoot - Pre-OS Boot + TechniquesPreOSBoot Techniques = "Pre-OS Boot" + // TechniquesProcessDiscovery - Process Discovery + TechniquesProcessDiscovery Techniques = "Process Discovery" + // TechniquesProcessInjection - Process Injection + TechniquesProcessInjection Techniques = "Process Injection" + // TechniquesProtocolTunneling - Protocol Tunneling + TechniquesProtocolTunneling Techniques = "Protocol Tunneling" + // TechniquesProxy - Proxy + TechniquesProxy Techniques = "Proxy" + // TechniquesQueryRegistry - Query Registry + TechniquesQueryRegistry Techniques = "Query Registry" + // TechniquesRemoteAccessSoftware - Remote Access Software + TechniquesRemoteAccessSoftware Techniques = "Remote Access Software" + // TechniquesRemoteServiceSessionHijacking - Remote Service Session Hijacking + TechniquesRemoteServiceSessionHijacking Techniques = "Remote Service Session Hijacking" + // TechniquesRemoteServices - Remote Services + TechniquesRemoteServices Techniques = "Remote Services" + // TechniquesRemoteSystemDiscovery - Remote System Discovery + TechniquesRemoteSystemDiscovery Techniques = "Remote System Discovery" + // TechniquesResourceHijacking - Resource Hijacking + TechniquesResourceHijacking Techniques = "Resource Hijacking" + // TechniquesSQLStoredProcedures - SQL Stored Procedures + TechniquesSQLStoredProcedures Techniques = "SQL Stored Procedures" + // TechniquesScheduledTaskJob - Scheduled Task/Job + TechniquesScheduledTaskJob Techniques = "Scheduled Task/Job" + // TechniquesScreenCapture - Screen Capture + TechniquesScreenCapture Techniques = "Screen Capture" + // TechniquesSearchVictimOwnedWebsites - Search Victim-Owned Websites + TechniquesSearchVictimOwnedWebsites Techniques = "Search Victim-Owned Websites" + // TechniquesServerSoftwareComponent - Server Software Component + TechniquesServerSoftwareComponent Techniques = "Server Software Component" + // TechniquesServiceStop - Service Stop + TechniquesServiceStop Techniques = "Service Stop" + // TechniquesSignedBinaryProxyExecution - Signed Binary Proxy Execution + TechniquesSignedBinaryProxyExecution Techniques = "Signed Binary Proxy Execution" + // TechniquesSoftwareDeploymentTools - Software Deployment Tools + TechniquesSoftwareDeploymentTools Techniques = "Software Deployment Tools" + // TechniquesStealOrForgeKerberosTickets - Steal or Forge Kerberos Tickets + TechniquesStealOrForgeKerberosTickets Techniques = "Steal or Forge Kerberos Tickets" + // TechniquesSubvertTrustControls - Subvert Trust Controls + TechniquesSubvertTrustControls Techniques = "Subvert Trust Controls" + // TechniquesSupplyChainCompromise - Supply Chain Compromise + TechniquesSupplyChainCompromise Techniques = "Supply Chain Compromise" + // TechniquesSystemInformationDiscovery - System Information Discovery + TechniquesSystemInformationDiscovery Techniques = "System Information Discovery" + // TechniquesTaintSharedContent - Taint Shared Content + TechniquesTaintSharedContent Techniques = "Taint Shared Content" + // TechniquesTrafficSignaling - Traffic Signaling + TechniquesTrafficSignaling Techniques = "Traffic Signaling" + // TechniquesTransferDataToCloudAccount - Transfer Data to Cloud Account + TechniquesTransferDataToCloudAccount Techniques = "Transfer Data to Cloud Account" + // TechniquesTrustedRelationship - Trusted Relationship + TechniquesTrustedRelationship Techniques = "Trusted Relationship" + // TechniquesUnsecuredCredentials - Unsecured Credentials + TechniquesUnsecuredCredentials Techniques = "Unsecured Credentials" + // TechniquesUserExecution - User Execution + TechniquesUserExecution Techniques = "User Execution" + // TechniquesValidAccounts - Valid Accounts + TechniquesValidAccounts Techniques = "Valid Accounts" + // TechniquesWindowsManagementInstrumentation - Windows Management Instrumentation + TechniquesWindowsManagementInstrumentation Techniques = "Windows Management Instrumentation" ) // PossibleTechniquesValues returns the possible values for the Techniques const type. @@ -2533,14 +2996,22 @@ func PossibleTechniquesValues() []Techniques { type Threats string const ( - ThreatsAccountBreach Threats = "accountBreach" - ThreatsDataExfiltration Threats = "dataExfiltration" - ThreatsDataSpillage Threats = "dataSpillage" - ThreatsDenialOfService Threats = "denialOfService" + // ThreatsAccountBreach - accountBreach + ThreatsAccountBreach Threats = "accountBreach" + // ThreatsDataExfiltration - dataExfiltration + ThreatsDataExfiltration Threats = "dataExfiltration" + // ThreatsDataSpillage - dataSpillage + ThreatsDataSpillage Threats = "dataSpillage" + // ThreatsDenialOfService - denialOfService + ThreatsDenialOfService Threats = "denialOfService" + // ThreatsElevationOfPrivilege - elevationOfPrivilege ThreatsElevationOfPrivilege Threats = "elevationOfPrivilege" - ThreatsMaliciousInsider Threats = "maliciousInsider" - ThreatsMissingCoverage Threats = "missingCoverage" - ThreatsThreatResistance Threats = "threatResistance" + // ThreatsMaliciousInsider - maliciousInsider + ThreatsMaliciousInsider Threats = "maliciousInsider" + // ThreatsMissingCoverage - missingCoverage + ThreatsMissingCoverage Threats = "missingCoverage" + // ThreatsThreatResistance - threatResistance + ThreatsThreatResistance Threats = "threatResistance" ) // PossibleThreatsValues returns the possible values for the Threats const type. @@ -2557,27 +3028,14 @@ func PossibleThreatsValues() []Threats { } } -type TransportProtocol string - -const ( - TransportProtocolTCP TransportProtocol = "TCP" - TransportProtocolUDP TransportProtocol = "UDP" -) - -// PossibleTransportProtocolValues returns the possible values for the TransportProtocol const type. -func PossibleTransportProtocolValues() []TransportProtocol { - return []TransportProtocol{ - TransportProtocolTCP, - TransportProtocolUDP, - } -} - // Type - The Vulnerability Assessment solution to be provisioned. Can be either 'TVM' or 'Qualys' type Type string const ( + // TypeQualys - Qualys TypeQualys Type = "Qualys" - TypeTVM Type = "TVM" + // TypeTVM - TVM + TypeTVM Type = "TVM" ) // PossibleTypeValues returns the possible values for the Type const type. @@ -2610,8 +3068,11 @@ func PossibleUnmaskedIPLoggingStatusValues() []UnmaskedIPLoggingStatus { type UserImpact string const ( - UserImpactHigh UserImpact = "High" - UserImpactLow UserImpact = "Low" + // UserImpactHigh - High + UserImpactHigh UserImpact = "High" + // UserImpactLow - Low + UserImpactLow UserImpact = "Low" + // UserImpactModerate - Moderate UserImpactModerate UserImpact = "Moderate" ) diff --git a/sdk/resourcemanager/security/armsecurity/contacts_client.go b/sdk/resourcemanager/security/armsecurity/contacts_client.go index 688a10f136b9..7d0daf750b48 100644 --- a/sdk/resourcemanager/security/armsecurity/contacts_client.go +++ b/sdk/resourcemanager/security/armsecurity/contacts_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -17,7 +16,7 @@ import ( "strings" ) -// ContactsClient contains the methods for the SecurityContacts group. +// ContactsClient contains the methods for the Contacts group. // Don't use this type directly, use NewContactsClient() instead. type ContactsClient struct { internal *arm.Client @@ -25,9 +24,9 @@ type ContactsClient struct { } // NewContactsClient creates a new instance of ContactsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewContactsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ContactsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -70,7 +69,7 @@ func (client *ContactsClient) Create(ctx context.Context, securityContactName Se } // createCreateRequest creates the Create request. -func (client *ContactsClient) createCreateRequest(ctx context.Context, securityContactName SecurityContactName, securityContact Contact, options *ContactsClientCreateOptions) (*policy.Request, error) { +func (client *ContactsClient) createCreateRequest(ctx context.Context, securityContactName SecurityContactName, securityContact Contact, _ *ContactsClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -88,6 +87,7 @@ func (client *ContactsClient) createCreateRequest(ctx context.Context, securityC reqQP.Set("api-version", "2023-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, securityContact); err != nil { return nil, err } @@ -131,7 +131,7 @@ func (client *ContactsClient) Delete(ctx context.Context, securityContactName Se } // deleteCreateRequest creates the Delete request. -func (client *ContactsClient) deleteCreateRequest(ctx context.Context, securityContactName SecurityContactName, options *ContactsClientDeleteOptions) (*policy.Request, error) { +func (client *ContactsClient) deleteCreateRequest(ctx context.Context, securityContactName SecurityContactName, _ *ContactsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -148,7 +148,6 @@ func (client *ContactsClient) deleteCreateRequest(ctx context.Context, securityC reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2023-12-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -181,7 +180,7 @@ func (client *ContactsClient) Get(ctx context.Context, securityContactName Secur } // getCreateRequest creates the Get request. -func (client *ContactsClient) getCreateRequest(ctx context.Context, securityContactName SecurityContactName, options *ContactsClientGetOptions) (*policy.Request, error) { +func (client *ContactsClient) getCreateRequest(ctx context.Context, securityContactName SecurityContactName, _ *ContactsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts/{securityContactName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -239,7 +238,7 @@ func (client *ContactsClient) NewListPager(options *ContactsClientListOptions) * } // listCreateRequest creates the List request. -func (client *ContactsClient) listCreateRequest(ctx context.Context, options *ContactsClientListOptions) (*policy.Request, error) { +func (client *ContactsClient) listCreateRequest(ctx context.Context, _ *ContactsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityContacts" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/customassessmentautomations_client.go b/sdk/resourcemanager/security/armsecurity/customassessmentautomations_client.go deleted file mode 100644 index c79860bf8649..000000000000 --- a/sdk/resourcemanager/security/armsecurity/customassessmentautomations_client.go +++ /dev/null @@ -1,346 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurity - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// CustomAssessmentAutomationsClient contains the methods for the CustomAssessmentAutomations group. -// Don't use this type directly, use NewCustomAssessmentAutomationsClient() instead. -type CustomAssessmentAutomationsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewCustomAssessmentAutomationsClient creates a new instance of CustomAssessmentAutomationsClient 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 NewCustomAssessmentAutomationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomAssessmentAutomationsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &CustomAssessmentAutomationsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Creates or updates a custom assessment automation for the provided subscription. Please note that providing an -// existing custom assessment automation will replace the existing record. -// 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. -// - customAssessmentAutomationName - Name of the Custom Assessment Automation. -// - customAssessmentAutomationBody - Custom Assessment Automation body -// - options - CustomAssessmentAutomationsClientCreateOptions contains the optional parameters for the CustomAssessmentAutomationsClient.Create -// method. -func (client *CustomAssessmentAutomationsClient) Create(ctx context.Context, resourceGroupName string, customAssessmentAutomationName string, customAssessmentAutomationBody CustomAssessmentAutomationRequest, options *CustomAssessmentAutomationsClientCreateOptions) (CustomAssessmentAutomationsClientCreateResponse, error) { - var err error - const operationName = "CustomAssessmentAutomationsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, customAssessmentAutomationName, customAssessmentAutomationBody, options) - if err != nil { - return CustomAssessmentAutomationsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return CustomAssessmentAutomationsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return CustomAssessmentAutomationsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *CustomAssessmentAutomationsClient) createCreateRequest(ctx context.Context, resourceGroupName string, customAssessmentAutomationName string, customAssessmentAutomationBody CustomAssessmentAutomationRequest, options *CustomAssessmentAutomationsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}" - 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 customAssessmentAutomationName == "" { - return nil, errors.New("parameter customAssessmentAutomationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{customAssessmentAutomationName}", url.PathEscape(customAssessmentAutomationName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, customAssessmentAutomationBody); err != nil { - return nil, err - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *CustomAssessmentAutomationsClient) createHandleResponse(resp *http.Response) (CustomAssessmentAutomationsClientCreateResponse, error) { - result := CustomAssessmentAutomationsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.CustomAssessmentAutomation); err != nil { - return CustomAssessmentAutomationsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Deletes a custom assessment automation by name for a provided subscription -// 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. -// - customAssessmentAutomationName - Name of the Custom Assessment Automation. -// - options - CustomAssessmentAutomationsClientDeleteOptions contains the optional parameters for the CustomAssessmentAutomationsClient.Delete -// method. -func (client *CustomAssessmentAutomationsClient) Delete(ctx context.Context, resourceGroupName string, customAssessmentAutomationName string, options *CustomAssessmentAutomationsClientDeleteOptions) (CustomAssessmentAutomationsClientDeleteResponse, error) { - var err error - const operationName = "CustomAssessmentAutomationsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, customAssessmentAutomationName, options) - if err != nil { - return CustomAssessmentAutomationsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return CustomAssessmentAutomationsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return CustomAssessmentAutomationsClientDeleteResponse{}, err - } - return CustomAssessmentAutomationsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *CustomAssessmentAutomationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, customAssessmentAutomationName string, options *CustomAssessmentAutomationsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}" - 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 customAssessmentAutomationName == "" { - return nil, errors.New("parameter customAssessmentAutomationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{customAssessmentAutomationName}", url.PathEscape(customAssessmentAutomationName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets a single custom assessment automation by name for the 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. -// - customAssessmentAutomationName - Name of the Custom Assessment Automation. -// - options - CustomAssessmentAutomationsClientGetOptions contains the optional parameters for the CustomAssessmentAutomationsClient.Get -// method. -func (client *CustomAssessmentAutomationsClient) Get(ctx context.Context, resourceGroupName string, customAssessmentAutomationName string, options *CustomAssessmentAutomationsClientGetOptions) (CustomAssessmentAutomationsClientGetResponse, error) { - var err error - const operationName = "CustomAssessmentAutomationsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, customAssessmentAutomationName, options) - if err != nil { - return CustomAssessmentAutomationsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return CustomAssessmentAutomationsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return CustomAssessmentAutomationsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *CustomAssessmentAutomationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, customAssessmentAutomationName string, options *CustomAssessmentAutomationsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}" - 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 customAssessmentAutomationName == "" { - return nil, errors.New("parameter customAssessmentAutomationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{customAssessmentAutomationName}", url.PathEscape(customAssessmentAutomationName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-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 *CustomAssessmentAutomationsClient) getHandleResponse(resp *http.Response) (CustomAssessmentAutomationsClientGetResponse, error) { - result := CustomAssessmentAutomationsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.CustomAssessmentAutomation); err != nil { - return CustomAssessmentAutomationsClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - List custom assessment automations by provided subscription and resource group -// -// 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.NewListByResourceGroupPager -// method. -func (client *CustomAssessmentAutomationsClient) NewListByResourceGroupPager(resourceGroupName string, options *CustomAssessmentAutomationsClientListByResourceGroupOptions) *runtime.Pager[CustomAssessmentAutomationsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[CustomAssessmentAutomationsClientListByResourceGroupResponse]{ - More: func(page CustomAssessmentAutomationsClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *CustomAssessmentAutomationsClientListByResourceGroupResponse) (CustomAssessmentAutomationsClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CustomAssessmentAutomationsClient.NewListByResourceGroupPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return CustomAssessmentAutomationsClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *CustomAssessmentAutomationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CustomAssessmentAutomationsClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations" - 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)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *CustomAssessmentAutomationsClient) listByResourceGroupHandleResponse(resp *http.Response) (CustomAssessmentAutomationsClientListByResourceGroupResponse, error) { - result := CustomAssessmentAutomationsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.CustomAssessmentAutomationsListResult); err != nil { - return CustomAssessmentAutomationsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - List custom assessment automations by provided subscription -// -// Generated from API version 2021-07-01-preview -// - options - CustomAssessmentAutomationsClientListBySubscriptionOptions contains the optional parameters for the CustomAssessmentAutomationsClient.NewListBySubscriptionPager -// method. -func (client *CustomAssessmentAutomationsClient) NewListBySubscriptionPager(options *CustomAssessmentAutomationsClientListBySubscriptionOptions) *runtime.Pager[CustomAssessmentAutomationsClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[CustomAssessmentAutomationsClientListBySubscriptionResponse]{ - More: func(page CustomAssessmentAutomationsClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *CustomAssessmentAutomationsClientListBySubscriptionResponse) (CustomAssessmentAutomationsClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CustomAssessmentAutomationsClient.NewListBySubscriptionPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) - }, nil) - if err != nil { - return CustomAssessmentAutomationsClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *CustomAssessmentAutomationsClient) listBySubscriptionCreateRequest(ctx context.Context, options *CustomAssessmentAutomationsClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customAssessmentAutomations" - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *CustomAssessmentAutomationsClient) listBySubscriptionHandleResponse(resp *http.Response) (CustomAssessmentAutomationsClientListBySubscriptionResponse, error) { - result := CustomAssessmentAutomationsClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.CustomAssessmentAutomationsListResult); err != nil { - return CustomAssessmentAutomationsClientListBySubscriptionResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client.go b/sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client.go deleted file mode 100644 index 7f6b01ed09b4..000000000000 --- a/sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client.go +++ /dev/null @@ -1,345 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurity - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// CustomEntityStoreAssignmentsClient contains the methods for the CustomEntityStoreAssignments group. -// Don't use this type directly, use NewCustomEntityStoreAssignmentsClient() instead. -type CustomEntityStoreAssignmentsClient struct { - internal *arm.Client - subscriptionID string -} - -// NewCustomEntityStoreAssignmentsClient creates a new instance of CustomEntityStoreAssignmentsClient 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 NewCustomEntityStoreAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomEntityStoreAssignmentsClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &CustomEntityStoreAssignmentsClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Create - Creates a custom entity store assignment for the provided subscription, if not already exists. -// 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. -// - customEntityStoreAssignmentName - Name of the custom entity store assignment. Generated name is GUID. -// - customEntityStoreAssignmentRequestBody - Custom entity store assignment body -// - options - CustomEntityStoreAssignmentsClientCreateOptions contains the optional parameters for the CustomEntityStoreAssignmentsClient.Create -// method. -func (client *CustomEntityStoreAssignmentsClient) Create(ctx context.Context, resourceGroupName string, customEntityStoreAssignmentName string, customEntityStoreAssignmentRequestBody CustomEntityStoreAssignmentRequest, options *CustomEntityStoreAssignmentsClientCreateOptions) (CustomEntityStoreAssignmentsClientCreateResponse, error) { - var err error - const operationName = "CustomEntityStoreAssignmentsClient.Create" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.createCreateRequest(ctx, resourceGroupName, customEntityStoreAssignmentName, customEntityStoreAssignmentRequestBody, options) - if err != nil { - return CustomEntityStoreAssignmentsClientCreateResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return CustomEntityStoreAssignmentsClientCreateResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { - err = runtime.NewResponseError(httpResp) - return CustomEntityStoreAssignmentsClientCreateResponse{}, err - } - resp, err := client.createHandleResponse(httpResp) - return resp, err -} - -// createCreateRequest creates the Create request. -func (client *CustomEntityStoreAssignmentsClient) createCreateRequest(ctx context.Context, resourceGroupName string, customEntityStoreAssignmentName string, customEntityStoreAssignmentRequestBody CustomEntityStoreAssignmentRequest, options *CustomEntityStoreAssignmentsClientCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}" - 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 customEntityStoreAssignmentName == "" { - return nil, errors.New("parameter customEntityStoreAssignmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{customEntityStoreAssignmentName}", url.PathEscape(customEntityStoreAssignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - if err := runtime.MarshalAsJSON(req, customEntityStoreAssignmentRequestBody); err != nil { - return nil, err - } - return req, nil -} - -// createHandleResponse handles the Create response. -func (client *CustomEntityStoreAssignmentsClient) createHandleResponse(resp *http.Response) (CustomEntityStoreAssignmentsClientCreateResponse, error) { - result := CustomEntityStoreAssignmentsClientCreateResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.CustomEntityStoreAssignment); err != nil { - return CustomEntityStoreAssignmentsClientCreateResponse{}, err - } - return result, nil -} - -// Delete - Delete a custom entity store assignment by name for a provided subscription -// 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. -// - customEntityStoreAssignmentName - Name of the custom entity store assignment. Generated name is GUID. -// - options - CustomEntityStoreAssignmentsClientDeleteOptions contains the optional parameters for the CustomEntityStoreAssignmentsClient.Delete -// method. -func (client *CustomEntityStoreAssignmentsClient) Delete(ctx context.Context, resourceGroupName string, customEntityStoreAssignmentName string, options *CustomEntityStoreAssignmentsClientDeleteOptions) (CustomEntityStoreAssignmentsClientDeleteResponse, error) { - var err error - const operationName = "CustomEntityStoreAssignmentsClient.Delete" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, resourceGroupName, customEntityStoreAssignmentName, options) - if err != nil { - return CustomEntityStoreAssignmentsClientDeleteResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return CustomEntityStoreAssignmentsClientDeleteResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { - err = runtime.NewResponseError(httpResp) - return CustomEntityStoreAssignmentsClientDeleteResponse{}, err - } - return CustomEntityStoreAssignmentsClientDeleteResponse{}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *CustomEntityStoreAssignmentsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, customEntityStoreAssignmentName string, options *CustomEntityStoreAssignmentsClientDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}" - 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 customEntityStoreAssignmentName == "" { - return nil, errors.New("parameter customEntityStoreAssignmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{customEntityStoreAssignmentName}", url.PathEscape(customEntityStoreAssignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// Get - Gets a single custom entity store assignment by name for the 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. -// - customEntityStoreAssignmentName - Name of the custom entity store assignment. Generated name is GUID. -// - options - CustomEntityStoreAssignmentsClientGetOptions contains the optional parameters for the CustomEntityStoreAssignmentsClient.Get -// method. -func (client *CustomEntityStoreAssignmentsClient) Get(ctx context.Context, resourceGroupName string, customEntityStoreAssignmentName string, options *CustomEntityStoreAssignmentsClientGetOptions) (CustomEntityStoreAssignmentsClientGetResponse, error) { - var err error - const operationName = "CustomEntityStoreAssignmentsClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, customEntityStoreAssignmentName, options) - if err != nil { - return CustomEntityStoreAssignmentsClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return CustomEntityStoreAssignmentsClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return CustomEntityStoreAssignmentsClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *CustomEntityStoreAssignmentsClient) getCreateRequest(ctx context.Context, resourceGroupName string, customEntityStoreAssignmentName string, options *CustomEntityStoreAssignmentsClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments/{customEntityStoreAssignmentName}" - 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 customEntityStoreAssignmentName == "" { - return nil, errors.New("parameter customEntityStoreAssignmentName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{customEntityStoreAssignmentName}", url.PathEscape(customEntityStoreAssignmentName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-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 *CustomEntityStoreAssignmentsClient) getHandleResponse(resp *http.Response) (CustomEntityStoreAssignmentsClientGetResponse, error) { - result := CustomEntityStoreAssignmentsClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.CustomEntityStoreAssignment); err != nil { - return CustomEntityStoreAssignmentsClientGetResponse{}, err - } - return result, nil -} - -// NewListByResourceGroupPager - List custom entity store assignments by a provided subscription and resource group -// -// 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.NewListByResourceGroupPager -// method. -func (client *CustomEntityStoreAssignmentsClient) NewListByResourceGroupPager(resourceGroupName string, options *CustomEntityStoreAssignmentsClientListByResourceGroupOptions) *runtime.Pager[CustomEntityStoreAssignmentsClientListByResourceGroupResponse] { - return runtime.NewPager(runtime.PagingHandler[CustomEntityStoreAssignmentsClientListByResourceGroupResponse]{ - More: func(page CustomEntityStoreAssignmentsClientListByResourceGroupResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *CustomEntityStoreAssignmentsClientListByResourceGroupResponse) (CustomEntityStoreAssignmentsClientListByResourceGroupResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CustomEntityStoreAssignmentsClient.NewListByResourceGroupPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, nil) - if err != nil { - return CustomEntityStoreAssignmentsClientListByResourceGroupResponse{}, err - } - return client.listByResourceGroupHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *CustomEntityStoreAssignmentsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *CustomEntityStoreAssignmentsClientListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customEntityStoreAssignments" - 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)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *CustomEntityStoreAssignmentsClient) listByResourceGroupHandleResponse(resp *http.Response) (CustomEntityStoreAssignmentsClientListByResourceGroupResponse, error) { - result := CustomEntityStoreAssignmentsClientListByResourceGroupResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.CustomEntityStoreAssignmentsListResult); err != nil { - return CustomEntityStoreAssignmentsClientListByResourceGroupResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - List custom entity store assignments by provided subscription -// -// Generated from API version 2021-07-01-preview -// - options - CustomEntityStoreAssignmentsClientListBySubscriptionOptions contains the optional parameters for the CustomEntityStoreAssignmentsClient.NewListBySubscriptionPager -// method. -func (client *CustomEntityStoreAssignmentsClient) NewListBySubscriptionPager(options *CustomEntityStoreAssignmentsClientListBySubscriptionOptions) *runtime.Pager[CustomEntityStoreAssignmentsClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[CustomEntityStoreAssignmentsClientListBySubscriptionResponse]{ - More: func(page CustomEntityStoreAssignmentsClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *CustomEntityStoreAssignmentsClientListBySubscriptionResponse) (CustomEntityStoreAssignmentsClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CustomEntityStoreAssignmentsClient.NewListBySubscriptionPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) - }, nil) - if err != nil { - return CustomEntityStoreAssignmentsClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *CustomEntityStoreAssignmentsClient) listBySubscriptionCreateRequest(ctx context.Context, options *CustomEntityStoreAssignmentsClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/customEntityStoreAssignments" - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *CustomEntityStoreAssignmentsClient) listBySubscriptionHandleResponse(resp *http.Response) (CustomEntityStoreAssignmentsClientListBySubscriptionResponse, error) { - result := CustomEntityStoreAssignmentsClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.CustomEntityStoreAssignmentsListResult); err != nil { - return CustomEntityStoreAssignmentsClientListBySubscriptionResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/customrecommendations_client.go b/sdk/resourcemanager/security/armsecurity/customrecommendations_client.go new file mode 100644 index 000000000000..85aa9d57cfe9 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/customrecommendations_client.go @@ -0,0 +1,270 @@ +// 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) Go Code Generator. 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" + "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" +) + +// CustomRecommendationsClient contains the methods for the CustomRecommendations group. +// Don't use this type directly, use NewCustomRecommendationsClient() instead. +type CustomRecommendationsClient struct { + internal *arm.Client +} + +// NewCustomRecommendationsClient creates a new instance of CustomRecommendationsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewCustomRecommendationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomRecommendationsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &CustomRecommendationsClient{ + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a custom recommendation over a given scope +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-01 +// - scope - The fully qualified Azure Resource manager identifier of the resource. +// - customRecommendationName - Name of the Custom Recommendation. +// - customRecommendationBody - Custom Recommendation body +// - options - CustomRecommendationsClientCreateOrUpdateOptions contains the optional parameters for the CustomRecommendationsClient.CreateOrUpdate +// method. +func (client *CustomRecommendationsClient) CreateOrUpdate(ctx context.Context, scope string, customRecommendationName string, customRecommendationBody CustomRecommendation, options *CustomRecommendationsClientCreateOrUpdateOptions) (CustomRecommendationsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "CustomRecommendationsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, scope, customRecommendationName, customRecommendationBody, options) + if err != nil { + return CustomRecommendationsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CustomRecommendationsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return CustomRecommendationsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *CustomRecommendationsClient) createOrUpdateCreateRequest(ctx context.Context, scope string, customRecommendationName string, customRecommendationBody CustomRecommendation, _ *CustomRecommendationsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if customRecommendationName == "" { + return nil, errors.New("parameter customRecommendationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customRecommendationName}", url.PathEscape(customRecommendationName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, customRecommendationBody); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *CustomRecommendationsClient) createOrUpdateHandleResponse(resp *http.Response) (CustomRecommendationsClientCreateOrUpdateResponse, error) { + result := CustomRecommendationsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CustomRecommendation); err != nil { + return CustomRecommendationsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a custom recommendation over a given scope +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-01 +// - scope - The fully qualified Azure Resource manager identifier of the resource. +// - customRecommendationName - Name of the Custom Recommendation. +// - options - CustomRecommendationsClientDeleteOptions contains the optional parameters for the CustomRecommendationsClient.Delete +// method. +func (client *CustomRecommendationsClient) Delete(ctx context.Context, scope string, customRecommendationName string, options *CustomRecommendationsClientDeleteOptions) (CustomRecommendationsClientDeleteResponse, error) { + var err error + const operationName = "CustomRecommendationsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, scope, customRecommendationName, options) + if err != nil { + return CustomRecommendationsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CustomRecommendationsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return CustomRecommendationsClientDeleteResponse{}, err + } + return CustomRecommendationsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *CustomRecommendationsClient) deleteCreateRequest(ctx context.Context, scope string, customRecommendationName string, _ *CustomRecommendationsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if customRecommendationName == "" { + return nil, errors.New("parameter customRecommendationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customRecommendationName}", url.PathEscape(customRecommendationName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Get a specific custom recommendation for the requested scope by customRecommendationName +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-01 +// - scope - The fully qualified Azure Resource manager identifier of the resource. +// - customRecommendationName - Name of the Custom Recommendation. +// - options - CustomRecommendationsClientGetOptions contains the optional parameters for the CustomRecommendationsClient.Get +// method. +func (client *CustomRecommendationsClient) Get(ctx context.Context, scope string, customRecommendationName string, options *CustomRecommendationsClientGetOptions) (CustomRecommendationsClientGetResponse, error) { + var err error + const operationName = "CustomRecommendationsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, scope, customRecommendationName, options) + if err != nil { + return CustomRecommendationsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return CustomRecommendationsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return CustomRecommendationsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *CustomRecommendationsClient) getCreateRequest(ctx context.Context, scope string, customRecommendationName string, _ *CustomRecommendationsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Security/customRecommendations/{customRecommendationName}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if customRecommendationName == "" { + return nil, errors.New("parameter customRecommendationName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{customRecommendationName}", url.PathEscape(customRecommendationName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CustomRecommendationsClient) getHandleResponse(resp *http.Response) (CustomRecommendationsClientGetResponse, error) { + result := CustomRecommendationsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CustomRecommendation); err != nil { + return CustomRecommendationsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get a list of all relevant custom recommendations over a scope +// +// Generated from API version 2024-08-01 +// - scope - The fully qualified Azure Resource manager identifier of the resource. +// - options - CustomRecommendationsClientListOptions contains the optional parameters for the CustomRecommendationsClient.NewListPager +// method. +func (client *CustomRecommendationsClient) NewListPager(scope string, options *CustomRecommendationsClientListOptions) *runtime.Pager[CustomRecommendationsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[CustomRecommendationsClientListResponse]{ + More: func(page CustomRecommendationsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *CustomRecommendationsClientListResponse) (CustomRecommendationsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "CustomRecommendationsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, scope, options) + }, nil) + if err != nil { + return CustomRecommendationsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *CustomRecommendationsClient) listCreateRequest(ctx context.Context, scope string, _ *CustomRecommendationsClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Security/customRecommendations" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *CustomRecommendationsClient) listHandleResponse(resp *http.Response) (CustomRecommendationsClientListResponse, error) { + result := CustomRecommendationsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.CustomRecommendationsList); err != nil { + return CustomRecommendationsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/date_type.go b/sdk/resourcemanager/security/armsecurity/date_type.go deleted file mode 100644 index 2c727677519d..000000000000 --- a/sdk/resourcemanager/security/armsecurity/date_type.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurity - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) - -const ( - fullDateJSON = `"2006-01-02"` - jsonFormat = `"%04d-%02d-%02d"` -) - -type dateType time.Time - -func (t dateType) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf(jsonFormat, time.Time(t).Year(), time.Time(t).Month(), time.Time(t).Day())), nil -} - -func (d *dateType) UnmarshalJSON(data []byte) (err error) { - t, err := time.Parse(fullDateJSON, string(data)) - *d = (dateType)(t) - return err -} - -func populateDateType(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateType)(t) -} - -func unpopulateDateType(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateType - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/security/armsecurity/defenderforstorage_client.go b/sdk/resourcemanager/security/armsecurity/defenderforstorage_client.go index 4092d5b2615b..e91b51294745 100644 --- a/sdk/resourcemanager/security/armsecurity/defenderforstorage_client.go +++ b/sdk/resourcemanager/security/armsecurity/defenderforstorage_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,7 +24,7 @@ type DefenderForStorageClient struct { // NewDefenderForStorageClient creates a new instance of DefenderForStorageClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewDefenderForStorageClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*DefenderForStorageClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -37,12 +36,78 @@ func NewDefenderForStorageClient(credential azcore.TokenCredential, options *arm return client, nil } +// CancelMalwareScan - Cancels a Defender for Storage malware scan for the specified storage account. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-09-01-preview +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. +// - settingName - The defender for storage setting name. +// - scanID - The identifier of the scan. Can be either 'latest' or a GUID. +// - options - DefenderForStorageClientCancelMalwareScanOptions contains the optional parameters for the DefenderForStorageClient.CancelMalwareScan +// method. +func (client *DefenderForStorageClient) CancelMalwareScan(ctx context.Context, resourceID string, settingName SettingName, scanID string, options *DefenderForStorageClientCancelMalwareScanOptions) (DefenderForStorageClientCancelMalwareScanResponse, error) { + var err error + const operationName = "DefenderForStorageClient.CancelMalwareScan" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.cancelMalwareScanCreateRequest(ctx, resourceID, settingName, scanID, options) + if err != nil { + return DefenderForStorageClientCancelMalwareScanResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DefenderForStorageClientCancelMalwareScanResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DefenderForStorageClientCancelMalwareScanResponse{}, err + } + resp, err := client.cancelMalwareScanHandleResponse(httpResp) + return resp, err +} + +// cancelMalwareScanCreateRequest creates the CancelMalwareScan request. +func (client *DefenderForStorageClient) cancelMalwareScanCreateRequest(ctx context.Context, resourceID string, settingName SettingName, scanID string, _ *DefenderForStorageClientCancelMalwareScanOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}/malwareScans/{scanId}/cancelMalwareScan" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + if settingName == "" { + return nil, errors.New("parameter settingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{settingName}", url.PathEscape(string(settingName))) + if scanID == "" { + return nil, errors.New("parameter scanID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scanId}", url.PathEscape(scanID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// cancelMalwareScanHandleResponse handles the CancelMalwareScan response. +func (client *DefenderForStorageClient) cancelMalwareScanHandleResponse(resp *http.Response) (DefenderForStorageClientCancelMalwareScanResponse, error) { + result := DefenderForStorageClientCancelMalwareScanResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MalwareScan); err != nil { + return DefenderForStorageClientCancelMalwareScanResponse{}, err + } + return result, nil +} + // Create - Creates or updates the Defender for Storage settings on a specified storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview -// - resourceID - The identifier of the resource. -// - settingName - Defender for Storage setting name. +// Generated from API version 2025-09-01-preview +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. +// - settingName - The defender for storage setting name. // - defenderForStorageSetting - Defender for Storage Settings // - options - DefenderForStorageClientCreateOptions contains the optional parameters for the DefenderForStorageClient.Create // method. @@ -69,8 +134,11 @@ func (client *DefenderForStorageClient) Create(ctx context.Context, resourceID s } // createCreateRequest creates the Create request. -func (client *DefenderForStorageClient) createCreateRequest(ctx context.Context, resourceID string, settingName SettingName, defenderForStorageSetting DefenderForStorageSetting, options *DefenderForStorageClientCreateOptions) (*policy.Request, error) { +func (client *DefenderForStorageClient) createCreateRequest(ctx context.Context, resourceID string, settingName SettingName, defenderForStorageSetting DefenderForStorageSetting, _ *DefenderForStorageClientCreateOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if settingName == "" { return nil, errors.New("parameter settingName cannot be empty") @@ -81,9 +149,10 @@ func (client *DefenderForStorageClient) createCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2025-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, defenderForStorageSetting); err != nil { return nil, err } @@ -102,9 +171,9 @@ func (client *DefenderForStorageClient) createHandleResponse(resp *http.Response // Get - Gets the Defender for Storage settings for the specified storage account. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2022-12-01-preview -// - resourceID - The identifier of the resource. -// - settingName - Defender for Storage setting name. +// Generated from API version 2025-09-01-preview +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. +// - settingName - The defender for storage setting name. // - options - DefenderForStorageClientGetOptions contains the optional parameters for the DefenderForStorageClient.Get method. func (client *DefenderForStorageClient) Get(ctx context.Context, resourceID string, settingName SettingName, options *DefenderForStorageClientGetOptions) (DefenderForStorageClientGetResponse, error) { var err error @@ -129,8 +198,11 @@ func (client *DefenderForStorageClient) Get(ctx context.Context, resourceID stri } // getCreateRequest creates the Get request. -func (client *DefenderForStorageClient) getCreateRequest(ctx context.Context, resourceID string, settingName SettingName, options *DefenderForStorageClientGetOptions) (*policy.Request, error) { +func (client *DefenderForStorageClient) getCreateRequest(ctx context.Context, resourceID string, settingName SettingName, _ *DefenderForStorageClientGetOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if settingName == "" { return nil, errors.New("parameter settingName cannot be empty") @@ -141,7 +213,7 @@ func (client *DefenderForStorageClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2022-12-01-preview") + reqQP.Set("api-version", "2025-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -155,3 +227,187 @@ func (client *DefenderForStorageClient) getHandleResponse(resp *http.Response) ( } return result, nil } + +// GetMalwareScan - Gets the Defender for Storage malware scan for the specified storage resource. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-09-01-preview +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. +// - settingName - The defender for storage setting name. +// - scanID - The identifier of the scan. Can be either 'latest' or a GUID. +// - options - DefenderForStorageClientGetMalwareScanOptions contains the optional parameters for the DefenderForStorageClient.GetMalwareScan +// method. +func (client *DefenderForStorageClient) GetMalwareScan(ctx context.Context, resourceID string, settingName SettingName, scanID string, options *DefenderForStorageClientGetMalwareScanOptions) (DefenderForStorageClientGetMalwareScanResponse, error) { + var err error + const operationName = "DefenderForStorageClient.GetMalwareScan" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getMalwareScanCreateRequest(ctx, resourceID, settingName, scanID, options) + if err != nil { + return DefenderForStorageClientGetMalwareScanResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DefenderForStorageClientGetMalwareScanResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DefenderForStorageClientGetMalwareScanResponse{}, err + } + resp, err := client.getMalwareScanHandleResponse(httpResp) + return resp, err +} + +// getMalwareScanCreateRequest creates the GetMalwareScan request. +func (client *DefenderForStorageClient) getMalwareScanCreateRequest(ctx context.Context, resourceID string, settingName SettingName, scanID string, _ *DefenderForStorageClientGetMalwareScanOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}/malwareScans/{scanId}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + if settingName == "" { + return nil, errors.New("parameter settingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{settingName}", url.PathEscape(string(settingName))) + if scanID == "" { + return nil, errors.New("parameter scanID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scanId}", url.PathEscape(scanID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getMalwareScanHandleResponse handles the GetMalwareScan response. +func (client *DefenderForStorageClient) getMalwareScanHandleResponse(resp *http.Response) (DefenderForStorageClientGetMalwareScanResponse, error) { + result := DefenderForStorageClientGetMalwareScanResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MalwareScan); err != nil { + return DefenderForStorageClientGetMalwareScanResponse{}, err + } + return result, nil +} + +// NewListPager - Lists the Defender for Storage settings for the specified storage account. +// +// Generated from API version 2025-09-01-preview +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. +// - options - DefenderForStorageClientListOptions contains the optional parameters for the DefenderForStorageClient.NewListPager +// method. +func (client *DefenderForStorageClient) NewListPager(resourceID string, options *DefenderForStorageClientListOptions) *runtime.Pager[DefenderForStorageClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[DefenderForStorageClientListResponse]{ + More: func(page DefenderForStorageClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *DefenderForStorageClientListResponse) (DefenderForStorageClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "DefenderForStorageClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceID, options) + }, nil) + if err != nil { + return DefenderForStorageClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *DefenderForStorageClient) listCreateRequest(ctx context.Context, resourceID string, _ *DefenderForStorageClientListOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-09-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 *DefenderForStorageClient) listHandleResponse(resp *http.Response) (DefenderForStorageClientListResponse, error) { + result := DefenderForStorageClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.DefenderForStorageSettingList); err != nil { + return DefenderForStorageClientListResponse{}, err + } + return result, nil +} + +// StartMalwareScan - Initiate a Defender for Storage malware scan for the specified storage account. Blobs and Files will +// be scanned for malware. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-09-01-preview +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. +// - settingName - The defender for storage setting name. +// - options - DefenderForStorageClientStartMalwareScanOptions contains the optional parameters for the DefenderForStorageClient.StartMalwareScan +// method. +func (client *DefenderForStorageClient) StartMalwareScan(ctx context.Context, resourceID string, settingName SettingName, options *DefenderForStorageClientStartMalwareScanOptions) (DefenderForStorageClientStartMalwareScanResponse, error) { + var err error + const operationName = "DefenderForStorageClient.StartMalwareScan" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.startMalwareScanCreateRequest(ctx, resourceID, settingName, options) + if err != nil { + return DefenderForStorageClientStartMalwareScanResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return DefenderForStorageClientStartMalwareScanResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return DefenderForStorageClientStartMalwareScanResponse{}, err + } + resp, err := client.startMalwareScanHandleResponse(httpResp) + return resp, err +} + +// startMalwareScanCreateRequest creates the StartMalwareScan request. +func (client *DefenderForStorageClient) startMalwareScanCreateRequest(ctx context.Context, resourceID string, settingName SettingName, _ *DefenderForStorageClientStartMalwareScanOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.Security/defenderForStorageSettings/{settingName}/startMalwareScan" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + if settingName == "" { + return nil, errors.New("parameter settingName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{settingName}", url.PathEscape(string(settingName))) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// startMalwareScanHandleResponse handles the StartMalwareScan response. +func (client *DefenderForStorageClient) startMalwareScanHandleResponse(resp *http.Response) (DefenderForStorageClientStartMalwareScanResponse, error) { + result := DefenderForStorageClientStartMalwareScanResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.MalwareScan); err != nil { + return DefenderForStorageClientStartMalwareScanResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/devicesecuritygroups_client.go b/sdk/resourcemanager/security/armsecurity/devicesecuritygroups_client.go index de51c532575c..f2754b7a8e96 100644 --- a/sdk/resourcemanager/security/armsecurity/devicesecuritygroups_client.go +++ b/sdk/resourcemanager/security/armsecurity/devicesecuritygroups_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,7 +24,7 @@ type DeviceSecurityGroupsClient struct { // NewDeviceSecurityGroupsClient creates a new instance of DeviceSecurityGroupsClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewDeviceSecurityGroupsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*DeviceSecurityGroupsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,7 +40,7 @@ func NewDeviceSecurityGroupsClient(credential azcore.TokenCredential, options *a // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-08-01 -// - resourceID - The identifier of the resource. +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. // - deviceSecurityGroupName - The name of the device security group. Note that the name of the device security group is case // insensitive. // - deviceSecurityGroup - Security group object. @@ -70,8 +69,11 @@ func (client *DeviceSecurityGroupsClient) CreateOrUpdate(ctx context.Context, re } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DeviceSecurityGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceID string, deviceSecurityGroupName string, deviceSecurityGroup DeviceSecurityGroup, options *DeviceSecurityGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DeviceSecurityGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceID string, deviceSecurityGroupName string, deviceSecurityGroup DeviceSecurityGroup, _ *DeviceSecurityGroupsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if deviceSecurityGroupName == "" { return nil, errors.New("parameter deviceSecurityGroupName cannot be empty") @@ -85,6 +87,7 @@ func (client *DeviceSecurityGroupsClient) createOrUpdateCreateRequest(ctx contex reqQP.Set("api-version", "2019-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, deviceSecurityGroup); err != nil { return nil, err } @@ -104,7 +107,7 @@ func (client *DeviceSecurityGroupsClient) createOrUpdateHandleResponse(resp *htt // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-08-01 -// - resourceID - The identifier of the resource. +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. // - deviceSecurityGroupName - The name of the device security group. Note that the name of the device security group is case // insensitive. // - options - DeviceSecurityGroupsClientDeleteOptions contains the optional parameters for the DeviceSecurityGroupsClient.Delete @@ -131,8 +134,11 @@ func (client *DeviceSecurityGroupsClient) Delete(ctx context.Context, resourceID } // deleteCreateRequest creates the Delete request. -func (client *DeviceSecurityGroupsClient) deleteCreateRequest(ctx context.Context, resourceID string, deviceSecurityGroupName string, options *DeviceSecurityGroupsClientDeleteOptions) (*policy.Request, error) { +func (client *DeviceSecurityGroupsClient) deleteCreateRequest(ctx context.Context, resourceID string, deviceSecurityGroupName string, _ *DeviceSecurityGroupsClientDeleteOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if deviceSecurityGroupName == "" { return nil, errors.New("parameter deviceSecurityGroupName cannot be empty") @@ -145,7 +151,6 @@ func (client *DeviceSecurityGroupsClient) deleteCreateRequest(ctx context.Contex reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-08-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -153,7 +158,7 @@ func (client *DeviceSecurityGroupsClient) deleteCreateRequest(ctx context.Contex // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2019-08-01 -// - resourceID - The identifier of the resource. +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. // - deviceSecurityGroupName - The name of the device security group. Note that the name of the device security group is case // insensitive. // - options - DeviceSecurityGroupsClientGetOptions contains the optional parameters for the DeviceSecurityGroupsClient.Get @@ -181,8 +186,11 @@ func (client *DeviceSecurityGroupsClient) Get(ctx context.Context, resourceID st } // getCreateRequest creates the Get request. -func (client *DeviceSecurityGroupsClient) getCreateRequest(ctx context.Context, resourceID string, deviceSecurityGroupName string, options *DeviceSecurityGroupsClientGetOptions) (*policy.Request, error) { +func (client *DeviceSecurityGroupsClient) getCreateRequest(ctx context.Context, resourceID string, deviceSecurityGroupName string, _ *DeviceSecurityGroupsClientGetOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if deviceSecurityGroupName == "" { return nil, errors.New("parameter deviceSecurityGroupName cannot be empty") @@ -211,7 +219,7 @@ func (client *DeviceSecurityGroupsClient) getHandleResponse(resp *http.Response) // NewListPager - Use this method get the list of device security groups for the specified IoT Hub resource. // // Generated from API version 2019-08-01 -// - resourceID - The identifier of the resource. +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. // - options - DeviceSecurityGroupsClientListOptions contains the optional parameters for the DeviceSecurityGroupsClient.NewListPager // method. func (client *DeviceSecurityGroupsClient) NewListPager(resourceID string, options *DeviceSecurityGroupsClientListOptions) *runtime.Pager[DeviceSecurityGroupsClientListResponse] { @@ -238,8 +246,11 @@ func (client *DeviceSecurityGroupsClient) NewListPager(resourceID string, option } // listCreateRequest creates the List request. -func (client *DeviceSecurityGroupsClient) listCreateRequest(ctx context.Context, resourceID string, options *DeviceSecurityGroupsClientListOptions) (*policy.Request, error) { +func (client *DeviceSecurityGroupsClient) listCreateRequest(ctx context.Context, resourceID string, _ *DeviceSecurityGroupsClientListOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/sdk/resourcemanager/security/armsecurity/devopsconfigurations_client.go b/sdk/resourcemanager/security/armsecurity/devopsconfigurations_client.go index 483ee69399b1..e088cb7c6924 100644 --- a/sdk/resourcemanager/security/armsecurity/devopsconfigurations_client.go +++ b/sdk/resourcemanager/security/armsecurity/devopsconfigurations_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type DevOpsConfigurationsClient struct { } // NewDevOpsConfigurationsClient creates a new instance of DevOpsConfigurationsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewDevOpsConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DevOpsConfigurationsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,9 +40,11 @@ func NewDevOpsConfigurationsClient(subscriptionID string, credential azcore.Toke } // BeginCreateOrUpdate - Creates or updates a DevOps Configuration. +// +// Creates or updates a DevOps Configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. // - devOpsConfiguration - The DevOps configuration resource payload. @@ -56,8 +57,7 @@ func (client *DevOpsConfigurationsClient) BeginCreateOrUpdate(ctx context.Contex return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevOpsConfigurationsClientCreateOrUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -68,9 +68,11 @@ func (client *DevOpsConfigurationsClient) BeginCreateOrUpdate(ctx context.Contex } // CreateOrUpdate - Creates or updates a DevOps Configuration. +// +// Creates or updates a DevOps Configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview func (client *DevOpsConfigurationsClient) createOrUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, devOpsConfiguration DevOpsConfiguration, options *DevOpsConfigurationsClientBeginCreateOrUpdateOptions) (*http.Response, error) { var err error const operationName = "DevOpsConfigurationsClient.BeginCreateOrUpdate" @@ -93,7 +95,7 @@ func (client *DevOpsConfigurationsClient) createOrUpdate(ctx context.Context, re } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *DevOpsConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, devOpsConfiguration DevOpsConfiguration, options *DevOpsConfigurationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { +func (client *DevOpsConfigurationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, devOpsConfiguration DevOpsConfiguration, _ *DevOpsConfigurationsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -112,9 +114,10 @@ func (client *DevOpsConfigurationsClient) createOrUpdateCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, devOpsConfiguration); err != nil { return nil, err } @@ -122,9 +125,11 @@ func (client *DevOpsConfigurationsClient) createOrUpdateCreateRequest(ctx contex } // BeginDelete - Deletes a DevOps Connector. +// +// Deletes a DevOps Connector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. // - options - DevOpsConfigurationsClientBeginDeleteOptions contains the optional parameters for the DevOpsConfigurationsClient.BeginDelete @@ -147,9 +152,11 @@ func (client *DevOpsConfigurationsClient) BeginDelete(ctx context.Context, resou } // Delete - Deletes a DevOps Connector. +// +// Deletes a DevOps Connector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview func (client *DevOpsConfigurationsClient) deleteOperation(ctx context.Context, resourceGroupName string, securityConnectorName string, options *DevOpsConfigurationsClientBeginDeleteOptions) (*http.Response, error) { var err error const operationName = "DevOpsConfigurationsClient.BeginDelete" @@ -172,7 +179,7 @@ func (client *DevOpsConfigurationsClient) deleteOperation(ctx context.Context, r } // deleteCreateRequest creates the Delete request. -func (client *DevOpsConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *DevOpsConfigurationsClientBeginDeleteOptions) (*policy.Request, error) { +func (client *DevOpsConfigurationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, _ *DevOpsConfigurationsClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -191,16 +198,17 @@ func (client *DevOpsConfigurationsClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Gets a DevOps Configuration. +// +// Gets a DevOps Configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. // - options - DevOpsConfigurationsClientGetOptions contains the optional parameters for the DevOpsConfigurationsClient.Get @@ -228,7 +236,7 @@ func (client *DevOpsConfigurationsClient) Get(ctx context.Context, resourceGroup } // getCreateRequest creates the Get request. -func (client *DevOpsConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *DevOpsConfigurationsClientGetOptions) (*policy.Request, error) { +func (client *DevOpsConfigurationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, _ *DevOpsConfigurationsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -247,7 +255,7 @@ func (client *DevOpsConfigurationsClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -264,7 +272,9 @@ func (client *DevOpsConfigurationsClient) getHandleResponse(resp *http.Response) // NewListPager - List DevOps Configurations. // -// Generated from API version 2023-09-01-preview +// List DevOps Configurations. +// +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. // - options - DevOpsConfigurationsClientListOptions contains the optional parameters for the DevOpsConfigurationsClient.NewListPager @@ -293,7 +303,7 @@ func (client *DevOpsConfigurationsClient) NewListPager(resourceGroupName string, } // listCreateRequest creates the List request. -func (client *DevOpsConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *DevOpsConfigurationsClientListOptions) (*policy.Request, error) { +func (client *DevOpsConfigurationsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, _ *DevOpsConfigurationsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -312,7 +322,7 @@ func (client *DevOpsConfigurationsClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -328,9 +338,11 @@ func (client *DevOpsConfigurationsClient) listHandleResponse(resp *http.Response } // BeginUpdate - Updates a DevOps Configuration. +// +// Updates a DevOps Configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. // - devOpsConfiguration - The DevOps configuration resource payload. @@ -343,8 +355,7 @@ func (client *DevOpsConfigurationsClient) BeginUpdate(ctx context.Context, resou return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[DevOpsConfigurationsClientUpdateResponse]{ - FinalStateVia: runtime.FinalStateViaAzureAsyncOp, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -355,9 +366,11 @@ func (client *DevOpsConfigurationsClient) BeginUpdate(ctx context.Context, resou } // Update - Updates a DevOps Configuration. +// +// Updates a DevOps Configuration. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview func (client *DevOpsConfigurationsClient) update(ctx context.Context, resourceGroupName string, securityConnectorName string, devOpsConfiguration DevOpsConfiguration, options *DevOpsConfigurationsClientBeginUpdateOptions) (*http.Response, error) { var err error const operationName = "DevOpsConfigurationsClient.BeginUpdate" @@ -380,7 +393,7 @@ func (client *DevOpsConfigurationsClient) update(ctx context.Context, resourceGr } // updateCreateRequest creates the Update request. -func (client *DevOpsConfigurationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, devOpsConfiguration DevOpsConfiguration, options *DevOpsConfigurationsClientBeginUpdateOptions) (*policy.Request, error) { +func (client *DevOpsConfigurationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, devOpsConfiguration DevOpsConfiguration, _ *DevOpsConfigurationsClientBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -399,9 +412,10 @@ func (client *DevOpsConfigurationsClient) updateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, devOpsConfiguration); err != nil { return nil, err } diff --git a/sdk/resourcemanager/security/armsecurity/devopsoperationresults_client.go b/sdk/resourcemanager/security/armsecurity/devopsoperationresults_client.go index bfc69f71e80b..87b01c8d9ed1 100644 --- a/sdk/resourcemanager/security/armsecurity/devopsoperationresults_client.go +++ b/sdk/resourcemanager/security/armsecurity/devopsoperationresults_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type DevOpsOperationResultsClient struct { } // NewDevOpsOperationResultsClient creates a new instance of DevOpsOperationResultsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewDevOpsOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DevOpsOperationResultsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,12 +40,13 @@ func NewDevOpsOperationResultsClient(subscriptionID string, credential azcore.To } // Get - Get devops long running operation result. +// +// Get devops long running operation result. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - operationResultID - The operation result Id. // - options - DevOpsOperationResultsClientGetOptions contains the optional parameters for the DevOpsOperationResultsClient.Get // method. func (client *DevOpsOperationResultsClient) Get(ctx context.Context, resourceGroupName string, securityConnectorName string, operationResultID string, options *DevOpsOperationResultsClientGetOptions) (DevOpsOperationResultsClientGetResponse, error) { @@ -72,7 +72,7 @@ func (client *DevOpsOperationResultsClient) Get(ctx context.Context, resourceGro } // getCreateRequest creates the Get request. -func (client *DevOpsOperationResultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, operationResultID string, options *DevOpsOperationResultsClientGetOptions) (*policy.Request, error) { +func (client *DevOpsOperationResultsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, operationResultID string, _ *DevOpsOperationResultsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/operationResults/{operationResultId}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -95,7 +95,7 @@ func (client *DevOpsOperationResultsClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-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/discoveredsecuritysolutions_client.go b/sdk/resourcemanager/security/armsecurity/discoveredsecuritysolutions_client.go index ca02645037da..5f96de2f377d 100644 --- a/sdk/resourcemanager/security/armsecurity/discoveredsecuritysolutions_client.go +++ b/sdk/resourcemanager/security/armsecurity/discoveredsecuritysolutions_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type DiscoveredSecuritySolutionsClient struct { } // NewDiscoveredSecuritySolutionsClient creates a new instance of DiscoveredSecuritySolutionsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewDiscoveredSecuritySolutionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*DiscoveredSecuritySolutionsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -44,7 +43,7 @@ func NewDiscoveredSecuritySolutionsClient(subscriptionID string, credential azco // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // - discoveredSecuritySolutionName - Name of a discovered security solution. // - options - DiscoveredSecuritySolutionsClientGetOptions contains the optional parameters for the DiscoveredSecuritySolutionsClient.Get @@ -72,7 +71,7 @@ func (client *DiscoveredSecuritySolutionsClient) Get(ctx context.Context, resour } // getCreateRequest creates the Get request. -func (client *DiscoveredSecuritySolutionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, discoveredSecuritySolutionName string, options *DiscoveredSecuritySolutionsClientGetOptions) (*policy.Request, error) { +func (client *DiscoveredSecuritySolutionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, discoveredSecuritySolutionName string, _ *DiscoveredSecuritySolutionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions/{discoveredSecuritySolutionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -139,7 +138,7 @@ func (client *DiscoveredSecuritySolutionsClient) NewListPager(options *Discovere } // listCreateRequest creates the List request. -func (client *DiscoveredSecuritySolutionsClient) listCreateRequest(ctx context.Context, options *DiscoveredSecuritySolutionsClientListOptions) (*policy.Request, error) { +func (client *DiscoveredSecuritySolutionsClient) listCreateRequest(ctx context.Context, _ *DiscoveredSecuritySolutionsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/discoveredSecuritySolutions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -195,7 +194,7 @@ func (client *DiscoveredSecuritySolutionsClient) NewListByHomeRegionPager(ascLoc } // listByHomeRegionCreateRequest creates the ListByHomeRegion request. -func (client *DiscoveredSecuritySolutionsClient) listByHomeRegionCreateRequest(ctx context.Context, ascLocation string, options *DiscoveredSecuritySolutionsClientListByHomeRegionOptions) (*policy.Request, error) { +func (client *DiscoveredSecuritySolutionsClient) listByHomeRegionCreateRequest(ctx context.Context, ascLocation string, _ *DiscoveredSecuritySolutionsClientListByHomeRegionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/discoveredSecuritySolutions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/externalsecuritysolutions_client.go b/sdk/resourcemanager/security/armsecurity/externalsecuritysolutions_client.go index c2d7148262e6..0281718f740a 100644 --- a/sdk/resourcemanager/security/armsecurity/externalsecuritysolutions_client.go +++ b/sdk/resourcemanager/security/armsecurity/externalsecuritysolutions_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type ExternalSecuritySolutionsClient struct { } // NewExternalSecuritySolutionsClient creates a new instance of ExternalSecuritySolutionsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewExternalSecuritySolutionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ExternalSecuritySolutionsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -44,7 +43,7 @@ func NewExternalSecuritySolutionsClient(subscriptionID string, credential azcore // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // - externalSecuritySolutionsName - Name of an external security solution. // - options - ExternalSecuritySolutionsClientGetOptions contains the optional parameters for the ExternalSecuritySolutionsClient.Get @@ -72,7 +71,7 @@ func (client *ExternalSecuritySolutionsClient) Get(ctx context.Context, resource } // getCreateRequest creates the Get request. -func (client *ExternalSecuritySolutionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, externalSecuritySolutionsName string, options *ExternalSecuritySolutionsClientGetOptions) (*policy.Request, error) { +func (client *ExternalSecuritySolutionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, externalSecuritySolutionsName string, _ *ExternalSecuritySolutionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions/{externalSecuritySolutionsName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -139,7 +138,7 @@ func (client *ExternalSecuritySolutionsClient) NewListPager(options *ExternalSec } // listCreateRequest creates the List request. -func (client *ExternalSecuritySolutionsClient) listCreateRequest(ctx context.Context, options *ExternalSecuritySolutionsClientListOptions) (*policy.Request, error) { +func (client *ExternalSecuritySolutionsClient) listCreateRequest(ctx context.Context, _ *ExternalSecuritySolutionsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/externalSecuritySolutions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -195,7 +194,7 @@ func (client *ExternalSecuritySolutionsClient) NewListByHomeRegionPager(ascLocat } // listByHomeRegionCreateRequest creates the ListByHomeRegion request. -func (client *ExternalSecuritySolutionsClient) listByHomeRegionCreateRequest(ctx context.Context, ascLocation string, options *ExternalSecuritySolutionsClientListByHomeRegionOptions) (*policy.Request, error) { +func (client *ExternalSecuritySolutionsClient) listByHomeRegionCreateRequest(ctx context.Context, ascLocation string, _ *ExternalSecuritySolutionsClientListByHomeRegionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/ExternalSecuritySolutions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/fake/accountconnectors_server.go b/sdk/resourcemanager/security/armsecurity/fake/accountconnectors_server.go deleted file mode 100644 index 1a6fa30b8635..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/accountconnectors_server.go +++ /dev/null @@ -1,211 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" - "net/http" - "net/url" - "regexp" -) - -// AccountConnectorsServer is a fake server for instances of the armsecurity.AccountConnectorsClient type. -type AccountConnectorsServer struct { - // CreateOrUpdate is the fake for method AccountConnectorsClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, connectorName string, connectorSetting armsecurity.ConnectorSetting, options *armsecurity.AccountConnectorsClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.AccountConnectorsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method AccountConnectorsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, connectorName string, options *armsecurity.AccountConnectorsClientDeleteOptions) (resp azfake.Responder[armsecurity.AccountConnectorsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AccountConnectorsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, connectorName string, options *armsecurity.AccountConnectorsClientGetOptions) (resp azfake.Responder[armsecurity.AccountConnectorsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListPager is the fake for method AccountConnectorsClient.NewListPager - // HTTP status codes to indicate success: http.StatusOK - NewListPager func(options *armsecurity.AccountConnectorsClientListOptions) (resp azfake.PagerResponder[armsecurity.AccountConnectorsClientListResponse]) -} - -// NewAccountConnectorsServerTransport creates a new instance of AccountConnectorsServerTransport with the provided implementation. -// The returned AccountConnectorsServerTransport instance is connected to an instance of armsecurity.AccountConnectorsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAccountConnectorsServerTransport(srv *AccountConnectorsServer) *AccountConnectorsServerTransport { - return &AccountConnectorsServerTransport{ - srv: srv, - newListPager: newTracker[azfake.PagerResponder[armsecurity.AccountConnectorsClientListResponse]](), - } -} - -// AccountConnectorsServerTransport connects instances of armsecurity.AccountConnectorsClient to instances of AccountConnectorsServer. -// Don't use this type directly, use NewAccountConnectorsServerTransport instead. -type AccountConnectorsServerTransport struct { - srv *AccountConnectorsServer - newListPager *tracker[azfake.PagerResponder[armsecurity.AccountConnectorsClientListResponse]] -} - -// Do implements the policy.Transporter interface for AccountConnectorsServerTransport. -func (a *AccountConnectorsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AccountConnectorsClient.CreateOrUpdate": - resp, err = a.dispatchCreateOrUpdate(req) - case "AccountConnectorsClient.Delete": - resp, err = a.dispatchDelete(req) - case "AccountConnectorsClient.Get": - resp, err = a.dispatchGet(req) - case "AccountConnectorsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AccountConnectorsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { - if a.srv.CreateOrUpdate == nil { - return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/connectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.ConnectorSetting](req) - if err != nil { - return nil, err - } - connectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.CreateOrUpdate(req.Context(), connectorNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ConnectorSetting, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AccountConnectorsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if a.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/connectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - connectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), connectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AccountConnectorsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/connectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - connectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("connectorName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), connectorNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ConnectorSetting, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AccountConnectorsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { - if a.srv.NewListPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} - } - newListPager := a.newListPager.get(req) - if newListPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/connectors` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := a.srv.NewListPager(nil) - newListPager = &resp - a.newListPager.add(req, newListPager) - server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.AccountConnectorsClientListResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListPager) { - a.newListPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/adaptiveapplicationcontrols_server.go b/sdk/resourcemanager/security/armsecurity/fake/adaptiveapplicationcontrols_server.go deleted file mode 100644 index 7044ed8bc135..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/adaptiveapplicationcontrols_server.go +++ /dev/null @@ -1,235 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" - "net/http" - "net/url" - "regexp" - "strconv" -) - -// AdaptiveApplicationControlsServer is a fake server for instances of the armsecurity.AdaptiveApplicationControlsClient type. -type AdaptiveApplicationControlsServer struct { - // Delete is the fake for method AdaptiveApplicationControlsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent - Delete func(ctx context.Context, ascLocation string, groupName string, options *armsecurity.AdaptiveApplicationControlsClientDeleteOptions) (resp azfake.Responder[armsecurity.AdaptiveApplicationControlsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AdaptiveApplicationControlsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, ascLocation string, groupName string, options *armsecurity.AdaptiveApplicationControlsClientGetOptions) (resp azfake.Responder[armsecurity.AdaptiveApplicationControlsClientGetResponse], errResp azfake.ErrorResponder) - - // List is the fake for method AdaptiveApplicationControlsClient.List - // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, options *armsecurity.AdaptiveApplicationControlsClientListOptions) (resp azfake.Responder[armsecurity.AdaptiveApplicationControlsClientListResponse], errResp azfake.ErrorResponder) - - // Put is the fake for method AdaptiveApplicationControlsClient.Put - // HTTP status codes to indicate success: http.StatusOK - Put func(ctx context.Context, ascLocation string, groupName string, body armsecurity.AdaptiveApplicationControlGroup, options *armsecurity.AdaptiveApplicationControlsClientPutOptions) (resp azfake.Responder[armsecurity.AdaptiveApplicationControlsClientPutResponse], errResp azfake.ErrorResponder) -} - -// NewAdaptiveApplicationControlsServerTransport creates a new instance of AdaptiveApplicationControlsServerTransport with the provided implementation. -// The returned AdaptiveApplicationControlsServerTransport instance is connected to an instance of armsecurity.AdaptiveApplicationControlsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAdaptiveApplicationControlsServerTransport(srv *AdaptiveApplicationControlsServer) *AdaptiveApplicationControlsServerTransport { - return &AdaptiveApplicationControlsServerTransport{srv: srv} -} - -// AdaptiveApplicationControlsServerTransport connects instances of armsecurity.AdaptiveApplicationControlsClient to instances of AdaptiveApplicationControlsServer. -// Don't use this type directly, use NewAdaptiveApplicationControlsServerTransport instead. -type AdaptiveApplicationControlsServerTransport struct { - srv *AdaptiveApplicationControlsServer -} - -// Do implements the policy.Transporter interface for AdaptiveApplicationControlsServerTransport. -func (a *AdaptiveApplicationControlsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AdaptiveApplicationControlsClient.Delete": - resp, err = a.dispatchDelete(req) - case "AdaptiveApplicationControlsClient.Get": - resp, err = a.dispatchGet(req) - case "AdaptiveApplicationControlsClient.List": - resp, err = a.dispatchList(req) - case "AdaptiveApplicationControlsClient.Put": - resp, err = a.dispatchPut(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AdaptiveApplicationControlsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if a.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/applicationWhitelistings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Delete(req.Context(), ascLocationParam, groupNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AdaptiveApplicationControlsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/applicationWhitelistings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), ascLocationParam, groupNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AdaptiveApplicationControlGroup, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AdaptiveApplicationControlsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if a.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/applicationWhitelistings` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - includePathRecommendationsUnescaped, err := url.QueryUnescape(qp.Get("includePathRecommendations")) - if err != nil { - return nil, err - } - includePathRecommendationsParam, err := parseOptional(includePathRecommendationsUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - summaryUnescaped, err := url.QueryUnescape(qp.Get("summary")) - if err != nil { - return nil, err - } - summaryParam, err := parseOptional(summaryUnescaped, strconv.ParseBool) - if err != nil { - return nil, err - } - var options *armsecurity.AdaptiveApplicationControlsClientListOptions - if includePathRecommendationsParam != nil || summaryParam != nil { - options = &armsecurity.AdaptiveApplicationControlsClientListOptions{ - IncludePathRecommendations: includePathRecommendationsParam, - Summary: summaryParam, - } - } - respr, errRespr := a.srv.List(req.Context(), options) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AdaptiveApplicationControlGroups, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AdaptiveApplicationControlsServerTransport) dispatchPut(req *http.Request) (*http.Response, error) { - if a.srv.Put == nil { - return nil, &nonRetriableError{errors.New("fake for method Put not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/applicationWhitelistings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.AdaptiveApplicationControlGroup](req) - if err != nil { - return nil, err - } - ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) - if err != nil { - return nil, err - } - groupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Put(req.Context(), ascLocationParam, groupNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AdaptiveApplicationControlGroup, req) - if err != nil { - return nil, err - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/adaptivenetworkhardenings_server.go b/sdk/resourcemanager/security/armsecurity/fake/adaptivenetworkhardenings_server.go deleted file mode 100644 index a00153ea85d0..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/adaptivenetworkhardenings_server.go +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" - "net/http" - "net/url" - "regexp" -) - -// AdaptiveNetworkHardeningsServer is a fake server for instances of the armsecurity.AdaptiveNetworkHardeningsClient type. -type AdaptiveNetworkHardeningsServer struct { - // BeginEnforce is the fake for method AdaptiveNetworkHardeningsClient.BeginEnforce - // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted - BeginEnforce func(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, adaptiveNetworkHardeningResourceName string, body armsecurity.AdaptiveNetworkHardeningEnforceRequest, options *armsecurity.AdaptiveNetworkHardeningsClientBeginEnforceOptions) (resp azfake.PollerResponder[armsecurity.AdaptiveNetworkHardeningsClientEnforceResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method AdaptiveNetworkHardeningsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, adaptiveNetworkHardeningResourceName string, options *armsecurity.AdaptiveNetworkHardeningsClientGetOptions) (resp azfake.Responder[armsecurity.AdaptiveNetworkHardeningsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByExtendedResourcePager is the fake for method AdaptiveNetworkHardeningsClient.NewListByExtendedResourcePager - // HTTP status codes to indicate success: http.StatusOK - NewListByExtendedResourcePager func(resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *armsecurity.AdaptiveNetworkHardeningsClientListByExtendedResourceOptions) (resp azfake.PagerResponder[armsecurity.AdaptiveNetworkHardeningsClientListByExtendedResourceResponse]) -} - -// NewAdaptiveNetworkHardeningsServerTransport creates a new instance of AdaptiveNetworkHardeningsServerTransport with the provided implementation. -// The returned AdaptiveNetworkHardeningsServerTransport instance is connected to an instance of armsecurity.AdaptiveNetworkHardeningsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewAdaptiveNetworkHardeningsServerTransport(srv *AdaptiveNetworkHardeningsServer) *AdaptiveNetworkHardeningsServerTransport { - return &AdaptiveNetworkHardeningsServerTransport{ - srv: srv, - beginEnforce: newTracker[azfake.PollerResponder[armsecurity.AdaptiveNetworkHardeningsClientEnforceResponse]](), - newListByExtendedResourcePager: newTracker[azfake.PagerResponder[armsecurity.AdaptiveNetworkHardeningsClientListByExtendedResourceResponse]](), - } -} - -// AdaptiveNetworkHardeningsServerTransport connects instances of armsecurity.AdaptiveNetworkHardeningsClient to instances of AdaptiveNetworkHardeningsServer. -// Don't use this type directly, use NewAdaptiveNetworkHardeningsServerTransport instead. -type AdaptiveNetworkHardeningsServerTransport struct { - srv *AdaptiveNetworkHardeningsServer - beginEnforce *tracker[azfake.PollerResponder[armsecurity.AdaptiveNetworkHardeningsClientEnforceResponse]] - newListByExtendedResourcePager *tracker[azfake.PagerResponder[armsecurity.AdaptiveNetworkHardeningsClientListByExtendedResourceResponse]] -} - -// Do implements the policy.Transporter interface for AdaptiveNetworkHardeningsServerTransport. -func (a *AdaptiveNetworkHardeningsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "AdaptiveNetworkHardeningsClient.BeginEnforce": - resp, err = a.dispatchBeginEnforce(req) - case "AdaptiveNetworkHardeningsClient.Get": - resp, err = a.dispatchGet(req) - case "AdaptiveNetworkHardeningsClient.NewListByExtendedResourcePager": - resp, err = a.dispatchNewListByExtendedResourcePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (a *AdaptiveNetworkHardeningsServerTransport) dispatchBeginEnforce(req *http.Request) (*http.Response, error) { - if a.srv.BeginEnforce == nil { - return nil, &nonRetriableError{errors.New("fake for method BeginEnforce not implemented")} - } - beginEnforce := a.beginEnforce.get(req) - if beginEnforce == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/adaptiveNetworkHardenings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.AdaptiveNetworkHardeningEnforceRequest](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resourceNamespaceParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceNamespace")]) - if err != nil { - return nil, err - } - resourceTypeParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceType")]) - if err != nil { - return nil, err - } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) - if err != nil { - return nil, err - } - adaptiveNetworkHardeningResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("adaptiveNetworkHardeningResourceName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.BeginEnforce(req.Context(), resourceGroupNameParam, resourceNamespaceParam, resourceTypeParam, resourceNameParam, adaptiveNetworkHardeningResourceNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - beginEnforce = &respr - a.beginEnforce.add(req, beginEnforce) - } - - resp, err := server.PollerResponderNext(beginEnforce, req) - if err != nil { - return nil, err - } - - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { - a.beginEnforce.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} - } - if !server.PollerResponderMore(beginEnforce) { - a.beginEnforce.remove(req) - } - - return resp, nil -} - -func (a *AdaptiveNetworkHardeningsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if a.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/adaptiveNetworkHardenings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resourceNamespaceParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceNamespace")]) - if err != nil { - return nil, err - } - resourceTypeParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceType")]) - if err != nil { - return nil, err - } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) - if err != nil { - return nil, err - } - adaptiveNetworkHardeningResourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("adaptiveNetworkHardeningResourceName")]) - if err != nil { - return nil, err - } - respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, resourceNamespaceParam, resourceTypeParam, resourceNameParam, adaptiveNetworkHardeningResourceNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AdaptiveNetworkHardening, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (a *AdaptiveNetworkHardeningsServerTransport) dispatchNewListByExtendedResourcePager(req *http.Request) (*http.Response, error) { - if a.srv.NewListByExtendedResourcePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByExtendedResourcePager not implemented")} - } - newListByExtendedResourcePager := a.newListByExtendedResourcePager.get(req) - if newListByExtendedResourcePager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/adaptiveNetworkHardenings` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resourceNamespaceParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceNamespace")]) - if err != nil { - return nil, err - } - resourceTypeParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceType")]) - if err != nil { - return nil, err - } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) - if err != nil { - return nil, err - } - resp := a.srv.NewListByExtendedResourcePager(resourceGroupNameParam, resourceNamespaceParam, resourceTypeParam, resourceNameParam, nil) - newListByExtendedResourcePager = &resp - a.newListByExtendedResourcePager.add(req, newListByExtendedResourcePager) - server.PagerResponderInjectNextLinks(newListByExtendedResourcePager, req, func(page *armsecurity.AdaptiveNetworkHardeningsClientListByExtendedResourceResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByExtendedResourcePager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - a.newListByExtendedResourcePager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByExtendedResourcePager) { - a.newListByExtendedResourcePager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/advancedthreatprotection_server.go b/sdk/resourcemanager/security/armsecurity/fake/advancedthreatprotection_server.go index 286381d59d8d..323ae113bdbc 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/advancedthreatprotection_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/advancedthreatprotection_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // AdvancedThreatProtectionServer is a fake server for instances of the armsecurity.AdvancedThreatProtectionClient type. @@ -50,23 +50,37 @@ func (a *AdvancedThreatProtectionServerTransport) Do(req *http.Request) (*http.R return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AdvancedThreatProtectionClient.Create": - resp, err = a.dispatchCreate(req) - case "AdvancedThreatProtectionClient.Get": - resp, err = a.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AdvancedThreatProtectionServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if advancedThreatProtectionServerTransportInterceptor != nil { + res.resp, res.err, intercepted = advancedThreatProtectionServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AdvancedThreatProtectionClient.Create": + res.resp, res.err = a.dispatchCreate(req) + case "AdvancedThreatProtectionClient.Get": + res.resp, res.err = a.dispatchGet(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AdvancedThreatProtectionServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { @@ -76,7 +90,7 @@ func (a *AdvancedThreatProtectionServerTransport) dispatchCreate(req *http.Reque const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/advancedThreatProtectionSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.AdvancedThreatProtectionSetting](req) @@ -92,7 +106,7 @@ func (a *AdvancedThreatProtectionServerTransport) dispatchCreate(req *http.Reque return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AdvancedThreatProtectionSetting, req) @@ -109,7 +123,7 @@ func (a *AdvancedThreatProtectionServerTransport) dispatchGet(req *http.Request) const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/advancedThreatProtectionSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) @@ -121,7 +135,7 @@ func (a *AdvancedThreatProtectionServerTransport) dispatchGet(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AdvancedThreatProtectionSetting, req) @@ -130,3 +144,9 @@ func (a *AdvancedThreatProtectionServerTransport) dispatchGet(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to AdvancedThreatProtectionServerTransport +var advancedThreatProtectionServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/alerts_server.go b/sdk/resourcemanager/security/armsecurity/fake/alerts_server.go index 1900e9b32238..3b7abae2de3e 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/alerts_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/alerts_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // AlertsServer is a fake server for instances of the armsecurity.AlertsClient type. @@ -46,7 +46,7 @@ type AlertsServer struct { NewListSubscriptionLevelByRegionPager func(ascLocation string, options *armsecurity.AlertsClientListSubscriptionLevelByRegionOptions) (resp azfake.PagerResponder[armsecurity.AlertsClientListSubscriptionLevelByRegionResponse]) // BeginSimulate is the fake for method AlertsClient.BeginSimulate - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginSimulate func(ctx context.Context, ascLocation string, alertSimulatorRequestBody armsecurity.AlertSimulatorRequestBody, options *armsecurity.AlertsClientBeginSimulateOptions) (resp azfake.PollerResponder[armsecurity.AlertsClientSimulateResponse], errResp azfake.ErrorResponder) // UpdateResourceGroupLevelStateToActivate is the fake for method AlertsClient.UpdateResourceGroupLevelStateToActivate @@ -115,49 +115,63 @@ func (a *AlertsServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "AlertsClient.GetResourceGroupLevel": - resp, err = a.dispatchGetResourceGroupLevel(req) - case "AlertsClient.GetSubscriptionLevel": - resp, err = a.dispatchGetSubscriptionLevel(req) - case "AlertsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - case "AlertsClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AlertsClient.NewListResourceGroupLevelByRegionPager": - resp, err = a.dispatchNewListResourceGroupLevelByRegionPager(req) - case "AlertsClient.NewListSubscriptionLevelByRegionPager": - resp, err = a.dispatchNewListSubscriptionLevelByRegionPager(req) - case "AlertsClient.BeginSimulate": - resp, err = a.dispatchBeginSimulate(req) - case "AlertsClient.UpdateResourceGroupLevelStateToActivate": - resp, err = a.dispatchUpdateResourceGroupLevelStateToActivate(req) - case "AlertsClient.UpdateResourceGroupLevelStateToDismiss": - resp, err = a.dispatchUpdateResourceGroupLevelStateToDismiss(req) - case "AlertsClient.UpdateResourceGroupLevelStateToInProgress": - resp, err = a.dispatchUpdateResourceGroupLevelStateToInProgress(req) - case "AlertsClient.UpdateResourceGroupLevelStateToResolve": - resp, err = a.dispatchUpdateResourceGroupLevelStateToResolve(req) - case "AlertsClient.UpdateSubscriptionLevelStateToActivate": - resp, err = a.dispatchUpdateSubscriptionLevelStateToActivate(req) - case "AlertsClient.UpdateSubscriptionLevelStateToDismiss": - resp, err = a.dispatchUpdateSubscriptionLevelStateToDismiss(req) - case "AlertsClient.UpdateSubscriptionLevelStateToInProgress": - resp, err = a.dispatchUpdateSubscriptionLevelStateToInProgress(req) - case "AlertsClient.UpdateSubscriptionLevelStateToResolve": - resp, err = a.dispatchUpdateSubscriptionLevelStateToResolve(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return a.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (a *AlertsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if alertsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = alertsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AlertsClient.GetResourceGroupLevel": + res.resp, res.err = a.dispatchGetResourceGroupLevel(req) + case "AlertsClient.GetSubscriptionLevel": + res.resp, res.err = a.dispatchGetSubscriptionLevel(req) + case "AlertsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + case "AlertsClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "AlertsClient.NewListResourceGroupLevelByRegionPager": + res.resp, res.err = a.dispatchNewListResourceGroupLevelByRegionPager(req) + case "AlertsClient.NewListSubscriptionLevelByRegionPager": + res.resp, res.err = a.dispatchNewListSubscriptionLevelByRegionPager(req) + case "AlertsClient.BeginSimulate": + res.resp, res.err = a.dispatchBeginSimulate(req) + case "AlertsClient.UpdateResourceGroupLevelStateToActivate": + res.resp, res.err = a.dispatchUpdateResourceGroupLevelStateToActivate(req) + case "AlertsClient.UpdateResourceGroupLevelStateToDismiss": + res.resp, res.err = a.dispatchUpdateResourceGroupLevelStateToDismiss(req) + case "AlertsClient.UpdateResourceGroupLevelStateToInProgress": + res.resp, res.err = a.dispatchUpdateResourceGroupLevelStateToInProgress(req) + case "AlertsClient.UpdateResourceGroupLevelStateToResolve": + res.resp, res.err = a.dispatchUpdateResourceGroupLevelStateToResolve(req) + case "AlertsClient.UpdateSubscriptionLevelStateToActivate": + res.resp, res.err = a.dispatchUpdateSubscriptionLevelStateToActivate(req) + case "AlertsClient.UpdateSubscriptionLevelStateToDismiss": + res.resp, res.err = a.dispatchUpdateSubscriptionLevelStateToDismiss(req) + case "AlertsClient.UpdateSubscriptionLevelStateToInProgress": + res.resp, res.err = a.dispatchUpdateSubscriptionLevelStateToInProgress(req) + case "AlertsClient.UpdateSubscriptionLevelStateToResolve": + res.resp, res.err = a.dispatchUpdateSubscriptionLevelStateToResolve(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AlertsServerTransport) dispatchGetResourceGroupLevel(req *http.Request) (*http.Response, error) { @@ -167,7 +181,7 @@ func (a *AlertsServerTransport) dispatchGetResourceGroupLevel(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -187,7 +201,7 @@ func (a *AlertsServerTransport) dispatchGetResourceGroupLevel(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Alert, req) @@ -204,7 +218,7 @@ func (a *AlertsServerTransport) dispatchGetSubscriptionLevel(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) @@ -220,7 +234,7 @@ func (a *AlertsServerTransport) dispatchGetSubscriptionLevel(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Alert, req) @@ -239,7 +253,7 @@ func (a *AlertsServerTransport) dispatchNewListPager(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/alerts` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := a.srv.NewListPager(nil) @@ -253,7 +267,7 @@ func (a *AlertsServerTransport) dispatchNewListPager(req *http.Request) (*http.R if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -272,7 +286,7 @@ func (a *AlertsServerTransport) dispatchNewListByResourceGroupPager(req *http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/alerts` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -290,7 +304,7 @@ func (a *AlertsServerTransport) dispatchNewListByResourceGroupPager(req *http.Re if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListByResourceGroupPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -309,7 +323,7 @@ func (a *AlertsServerTransport) dispatchNewListResourceGroupLevelByRegionPager(r const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) @@ -331,7 +345,7 @@ func (a *AlertsServerTransport) dispatchNewListResourceGroupLevelByRegionPager(r if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListResourceGroupLevelByRegionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -350,7 +364,7 @@ func (a *AlertsServerTransport) dispatchNewListSubscriptionLevelByRegionPager(re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) @@ -368,7 +382,7 @@ func (a *AlertsServerTransport) dispatchNewListSubscriptionLevelByRegionPager(re if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListSubscriptionLevelByRegionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -387,7 +401,7 @@ func (a *AlertsServerTransport) dispatchBeginSimulate(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts/default/simulate` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.AlertSimulatorRequestBody](req) @@ -411,9 +425,9 @@ func (a *AlertsServerTransport) dispatchBeginSimulate(req *http.Request) (*http. return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { a.beginSimulate.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginSimulate) { a.beginSimulate.remove(req) @@ -429,7 +443,7 @@ func (a *AlertsServerTransport) dispatchUpdateResourceGroupLevelStateToActivate( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/activate` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -449,7 +463,7 @@ func (a *AlertsServerTransport) dispatchUpdateResourceGroupLevelStateToActivate( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -466,7 +480,7 @@ func (a *AlertsServerTransport) dispatchUpdateResourceGroupLevelStateToDismiss(r const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dismiss` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -486,7 +500,7 @@ func (a *AlertsServerTransport) dispatchUpdateResourceGroupLevelStateToDismiss(r return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -503,7 +517,7 @@ func (a *AlertsServerTransport) dispatchUpdateResourceGroupLevelStateToInProgres const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/inProgress` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -523,7 +537,7 @@ func (a *AlertsServerTransport) dispatchUpdateResourceGroupLevelStateToInProgres return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -540,7 +554,7 @@ func (a *AlertsServerTransport) dispatchUpdateResourceGroupLevelStateToResolve(r const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resolve` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -560,7 +574,7 @@ func (a *AlertsServerTransport) dispatchUpdateResourceGroupLevelStateToResolve(r return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -577,7 +591,7 @@ func (a *AlertsServerTransport) dispatchUpdateSubscriptionLevelStateToActivate(r const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/activate` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) @@ -593,7 +607,7 @@ func (a *AlertsServerTransport) dispatchUpdateSubscriptionLevelStateToActivate(r return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -610,7 +624,7 @@ func (a *AlertsServerTransport) dispatchUpdateSubscriptionLevelStateToDismiss(re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dismiss` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) @@ -626,7 +640,7 @@ func (a *AlertsServerTransport) dispatchUpdateSubscriptionLevelStateToDismiss(re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -643,7 +657,7 @@ func (a *AlertsServerTransport) dispatchUpdateSubscriptionLevelStateToInProgress const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/inProgress` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) @@ -659,7 +673,7 @@ func (a *AlertsServerTransport) dispatchUpdateSubscriptionLevelStateToInProgress return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -676,7 +690,7 @@ func (a *AlertsServerTransport) dispatchUpdateSubscriptionLevelStateToResolve(re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/alerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resolve` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) @@ -692,7 +706,7 @@ func (a *AlertsServerTransport) dispatchUpdateSubscriptionLevelStateToResolve(re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -701,3 +715,9 @@ func (a *AlertsServerTransport) dispatchUpdateSubscriptionLevelStateToResolve(re } return resp, nil } + +// set this to conditionally intercept incoming requests to AlertsServerTransport +var alertsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/alertssuppressionrules_server.go b/sdk/resourcemanager/security/armsecurity/fake/alertssuppressionrules_server.go index 0fcfa5c11ece..601abfc4188b 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/alertssuppressionrules_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/alertssuppressionrules_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // AlertsSuppressionRulesServer is a fake server for instances of the armsecurity.AlertsSuppressionRulesClient type. @@ -63,27 +63,41 @@ func (a *AlertsSuppressionRulesServerTransport) Do(req *http.Request) (*http.Res return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AlertsSuppressionRulesClient.Delete": - resp, err = a.dispatchDelete(req) - case "AlertsSuppressionRulesClient.Get": - resp, err = a.dispatchGet(req) - case "AlertsSuppressionRulesClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - case "AlertsSuppressionRulesClient.Update": - resp, err = a.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AlertsSuppressionRulesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if alertsSuppressionRulesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = alertsSuppressionRulesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AlertsSuppressionRulesClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "AlertsSuppressionRulesClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AlertsSuppressionRulesClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + case "AlertsSuppressionRulesClient.Update": + res.resp, res.err = a.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AlertsSuppressionRulesServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { @@ -93,7 +107,7 @@ func (a *AlertsSuppressionRulesServerTransport) dispatchDelete(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/alertsSuppressionRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } alertsSuppressionRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertsSuppressionRuleName")]) @@ -105,7 +119,7 @@ func (a *AlertsSuppressionRulesServerTransport) dispatchDelete(req *http.Request return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -122,7 +136,7 @@ func (a *AlertsSuppressionRulesServerTransport) dispatchGet(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/alertsSuppressionRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } alertsSuppressionRuleNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("alertsSuppressionRuleName")]) @@ -134,7 +148,7 @@ func (a *AlertsSuppressionRulesServerTransport) dispatchGet(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AlertsSuppressionRule, req) @@ -153,15 +167,11 @@ func (a *AlertsSuppressionRulesServerTransport) dispatchNewListPager(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/alertsSuppressionRules` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() - alertTypeUnescaped, err := url.QueryUnescape(qp.Get("AlertType")) - if err != nil { - return nil, err - } - alertTypeParam := getOptional(alertTypeUnescaped) + alertTypeParam := getOptional(qp.Get("AlertType")) var options *armsecurity.AlertsSuppressionRulesClientListOptions if alertTypeParam != nil { options = &armsecurity.AlertsSuppressionRulesClientListOptions{ @@ -179,7 +189,7 @@ func (a *AlertsSuppressionRulesServerTransport) dispatchNewListPager(req *http.R if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -196,7 +206,7 @@ func (a *AlertsSuppressionRulesServerTransport) dispatchUpdate(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/alertsSuppressionRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.AlertsSuppressionRule](req) @@ -212,7 +222,7 @@ func (a *AlertsSuppressionRulesServerTransport) dispatchUpdate(req *http.Request return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AlertsSuppressionRule, req) @@ -221,3 +231,9 @@ func (a *AlertsSuppressionRulesServerTransport) dispatchUpdate(req *http.Request } return resp, nil } + +// set this to conditionally intercept incoming requests to AlertsSuppressionRulesServerTransport +var alertsSuppressionRulesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/allowedconnections_server.go b/sdk/resourcemanager/security/armsecurity/fake/allowedconnections_server.go index 3517e361b436..6a87afa1535d 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/allowedconnections_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/allowedconnections_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // AllowedConnectionsServer is a fake server for instances of the armsecurity.AllowedConnectionsClient type. @@ -61,25 +61,39 @@ func (a *AllowedConnectionsServerTransport) Do(req *http.Request) (*http.Respons return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AllowedConnectionsClient.Get": - resp, err = a.dispatchGet(req) - case "AllowedConnectionsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - case "AllowedConnectionsClient.NewListByHomeRegionPager": - resp, err = a.dispatchNewListByHomeRegionPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AllowedConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if allowedConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = allowedConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AllowedConnectionsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AllowedConnectionsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + case "AllowedConnectionsClient.NewListByHomeRegionPager": + res.resp, res.err = a.dispatchNewListByHomeRegionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AllowedConnectionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -89,7 +103,7 @@ func (a *AllowedConnectionsServerTransport) dispatchGet(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/allowedConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -115,7 +129,7 @@ func (a *AllowedConnectionsServerTransport) dispatchGet(req *http.Request) (*htt return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AllowedConnectionsResource, req) @@ -134,7 +148,7 @@ func (a *AllowedConnectionsServerTransport) dispatchNewListPager(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/allowedConnections` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := a.srv.NewListPager(nil) @@ -148,7 +162,7 @@ func (a *AllowedConnectionsServerTransport) dispatchNewListPager(req *http.Reque if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -167,7 +181,7 @@ func (a *AllowedConnectionsServerTransport) dispatchNewListByHomeRegionPager(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/allowedConnections` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) @@ -185,7 +199,7 @@ func (a *AllowedConnectionsServerTransport) dispatchNewListByHomeRegionPager(req if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListByHomeRegionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -194,3 +208,9 @@ func (a *AllowedConnectionsServerTransport) dispatchNewListByHomeRegionPager(req } return resp, nil } + +// set this to conditionally intercept incoming requests to AllowedConnectionsServerTransport +var allowedConnectionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/apicollections_server.go b/sdk/resourcemanager/security/armsecurity/fake/apicollections_server.go index 98761a148424..70b53357f951 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/apicollections_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/apicollections_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // APICollectionsServer is a fake server for instances of the armsecurity.APICollectionsClient type. @@ -77,31 +77,45 @@ func (a *APICollectionsServerTransport) Do(req *http.Request) (*http.Response, e return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "APICollectionsClient.GetByAzureAPIManagementService": - resp, err = a.dispatchGetByAzureAPIManagementService(req) - case "APICollectionsClient.NewListByAzureAPIManagementServicePager": - resp, err = a.dispatchNewListByAzureAPIManagementServicePager(req) - case "APICollectionsClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "APICollectionsClient.NewListBySubscriptionPager": - resp, err = a.dispatchNewListBySubscriptionPager(req) - case "APICollectionsClient.OffboardAzureAPIManagementAPI": - resp, err = a.dispatchOffboardAzureAPIManagementAPI(req) - case "APICollectionsClient.BeginOnboardAzureAPIManagementAPI": - resp, err = a.dispatchBeginOnboardAzureAPIManagementAPI(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *APICollectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if apiCollectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = apiCollectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "APICollectionsClient.GetByAzureAPIManagementService": + res.resp, res.err = a.dispatchGetByAzureAPIManagementService(req) + case "APICollectionsClient.NewListByAzureAPIManagementServicePager": + res.resp, res.err = a.dispatchNewListByAzureAPIManagementServicePager(req) + case "APICollectionsClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "APICollectionsClient.NewListBySubscriptionPager": + res.resp, res.err = a.dispatchNewListBySubscriptionPager(req) + case "APICollectionsClient.OffboardAzureAPIManagementAPI": + res.resp, res.err = a.dispatchOffboardAzureAPIManagementAPI(req) + case "APICollectionsClient.BeginOnboardAzureAPIManagementAPI": + res.resp, res.err = a.dispatchBeginOnboardAzureAPIManagementAPI(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *APICollectionsServerTransport) dispatchGetByAzureAPIManagementService(req *http.Request) (*http.Response, error) { @@ -111,7 +125,7 @@ func (a *APICollectionsServerTransport) dispatchGetByAzureAPIManagementService(r const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ApiManagement/service/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/apiCollections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -131,7 +145,7 @@ func (a *APICollectionsServerTransport) dispatchGetByAzureAPIManagementService(r return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).APICollection, req) @@ -150,7 +164,7 @@ func (a *APICollectionsServerTransport) dispatchNewListByAzureAPIManagementServi const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ApiManagement/service/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/apiCollections` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -172,7 +186,7 @@ func (a *APICollectionsServerTransport) dispatchNewListByAzureAPIManagementServi if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListByAzureAPIManagementServicePager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -191,7 +205,7 @@ func (a *APICollectionsServerTransport) dispatchNewListByResourceGroupPager(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/apiCollections` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -209,7 +223,7 @@ func (a *APICollectionsServerTransport) dispatchNewListByResourceGroupPager(req if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListByResourceGroupPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -228,7 +242,7 @@ func (a *APICollectionsServerTransport) dispatchNewListBySubscriptionPager(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/apiCollections` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := a.srv.NewListBySubscriptionPager(nil) @@ -242,7 +256,7 @@ func (a *APICollectionsServerTransport) dispatchNewListBySubscriptionPager(req * if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListBySubscriptionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -259,7 +273,7 @@ func (a *APICollectionsServerTransport) dispatchOffboardAzureAPIManagementAPI(re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ApiManagement/service/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/apiCollections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -279,7 +293,7 @@ func (a *APICollectionsServerTransport) dispatchOffboardAzureAPIManagementAPI(re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -298,7 +312,7 @@ func (a *APICollectionsServerTransport) dispatchBeginOnboardAzureAPIManagementAP const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.ApiManagement/service/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/apiCollections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -326,7 +340,7 @@ func (a *APICollectionsServerTransport) dispatchBeginOnboardAzureAPIManagementAP return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { a.beginOnboardAzureAPIManagementAPI.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } @@ -336,3 +350,9 @@ func (a *APICollectionsServerTransport) dispatchBeginOnboardAzureAPIManagementAP return resp, nil } + +// set this to conditionally intercept incoming requests to APICollectionsServerTransport +var apiCollectionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/application_server.go b/sdk/resourcemanager/security/armsecurity/fake/application_server.go index 9fa289e5255a..bc210a3a615b 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/application_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/application_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ApplicationServer is a fake server for instances of the armsecurity.ApplicationClient type. @@ -54,25 +54,39 @@ func (a *ApplicationServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "ApplicationClient.CreateOrUpdate": - resp, err = a.dispatchCreateOrUpdate(req) - case "ApplicationClient.Delete": - resp, err = a.dispatchDelete(req) - case "ApplicationClient.Get": - resp, err = a.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *ApplicationServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if applicationServerTransportInterceptor != nil { + res.resp, res.err, intercepted = applicationServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ApplicationClient.CreateOrUpdate": + res.resp, res.err = a.dispatchCreateOrUpdate(req) + case "ApplicationClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "ApplicationClient.Get": + res.resp, res.err = a.dispatchGet(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *ApplicationServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -82,7 +96,7 @@ func (a *ApplicationServerTransport) dispatchCreateOrUpdate(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/applications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.Application](req) @@ -98,7 +112,7 @@ func (a *ApplicationServerTransport) dispatchCreateOrUpdate(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Application, req) @@ -115,7 +129,7 @@ func (a *ApplicationServerTransport) dispatchDelete(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/applications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } applicationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationId")]) @@ -127,7 +141,7 @@ func (a *ApplicationServerTransport) dispatchDelete(req *http.Request) (*http.Re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -144,7 +158,7 @@ func (a *ApplicationServerTransport) dispatchGet(req *http.Request) (*http.Respo const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/applications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } applicationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("applicationId")]) @@ -156,7 +170,7 @@ func (a *ApplicationServerTransport) dispatchGet(req *http.Request) (*http.Respo return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Application, req) @@ -165,3 +179,9 @@ func (a *ApplicationServerTransport) dispatchGet(req *http.Request) (*http.Respo } return resp, nil } + +// set this to conditionally intercept incoming requests to ApplicationServerTransport +var applicationServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/applications_server.go b/sdk/resourcemanager/security/armsecurity/fake/applications_server.go index 07c17a643f56..222a9ee08fdd 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/applications_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/applications_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -15,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" "net/http" "regexp" + "slices" ) // ApplicationsServer is a fake server for instances of the armsecurity.ApplicationsClient type. @@ -49,21 +49,35 @@ func (a *ApplicationsServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "ApplicationsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *ApplicationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if applicationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = applicationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ApplicationsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *ApplicationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -75,7 +89,7 @@ func (a *ApplicationsServerTransport) dispatchNewListPager(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/applications` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := a.srv.NewListPager(nil) @@ -89,7 +103,7 @@ func (a *ApplicationsServerTransport) dispatchNewListPager(req *http.Request) (* if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -98,3 +112,9 @@ func (a *ApplicationsServerTransport) dispatchNewListPager(req *http.Request) (* } return resp, nil } + +// set this to conditionally intercept incoming requests to ApplicationsServerTransport +var applicationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/assessments_server.go b/sdk/resourcemanager/security/armsecurity/fake/assessments_server.go index 0d0206b6e914..4cf0762fce27 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/assessments_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/assessments_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // AssessmentsServer is a fake server for instances of the armsecurity.AssessmentsClient type. @@ -63,27 +63,41 @@ func (a *AssessmentsServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AssessmentsClient.CreateOrUpdate": - resp, err = a.dispatchCreateOrUpdate(req) - case "AssessmentsClient.Delete": - resp, err = a.dispatchDelete(req) - case "AssessmentsClient.Get": - resp, err = a.dispatchGet(req) - case "AssessmentsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AssessmentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if assessmentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = assessmentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AssessmentsClient.CreateOrUpdate": + res.resp, res.err = a.dispatchCreateOrUpdate(req) + case "AssessmentsClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "AssessmentsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AssessmentsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AssessmentsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -93,7 +107,7 @@ func (a *AssessmentsServerTransport) dispatchCreateOrUpdate(req *http.Request) ( const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.Assessment](req) @@ -113,7 +127,7 @@ func (a *AssessmentsServerTransport) dispatchCreateOrUpdate(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AssessmentResponse, req) @@ -130,7 +144,7 @@ func (a *AssessmentsServerTransport) dispatchDelete(req *http.Request) (*http.Re const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) @@ -146,7 +160,7 @@ func (a *AssessmentsServerTransport) dispatchDelete(req *http.Request) (*http.Re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -163,7 +177,7 @@ func (a *AssessmentsServerTransport) dispatchGet(req *http.Request) (*http.Respo const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -175,11 +189,7 @@ func (a *AssessmentsServerTransport) dispatchGet(req *http.Request) (*http.Respo if err != nil { return nil, err } - expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) - if err != nil { - return nil, err - } - expandParam := getOptional(armsecurity.ExpandEnum(expandUnescaped)) + expandParam := getOptional(armsecurity.ExpandEnum(qp.Get("$expand"))) var options *armsecurity.AssessmentsClientGetOptions if expandParam != nil { options = &armsecurity.AssessmentsClientGetOptions{ @@ -191,7 +201,7 @@ func (a *AssessmentsServerTransport) dispatchGet(req *http.Request) (*http.Respo return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AssessmentResponse, req) @@ -210,7 +220,7 @@ func (a *AssessmentsServerTransport) dispatchNewListPager(req *http.Request) (*h const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assessments` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -228,7 +238,7 @@ func (a *AssessmentsServerTransport) dispatchNewListPager(req *http.Request) (*h if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -237,3 +247,9 @@ func (a *AssessmentsServerTransport) dispatchNewListPager(req *http.Request) (*h } return resp, nil } + +// set this to conditionally intercept incoming requests to AssessmentsServerTransport +var assessmentsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/assessmentsmetadata_server.go b/sdk/resourcemanager/security/armsecurity/fake/assessmentsmetadata_server.go index 6febd816e8f3..d32dbe02d210 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/assessmentsmetadata_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/assessmentsmetadata_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // AssessmentsMetadataServer is a fake server for instances of the armsecurity.AssessmentsMetadataClient type. @@ -73,31 +73,45 @@ func (a *AssessmentsMetadataServerTransport) Do(req *http.Request) (*http.Respon return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AssessmentsMetadataClient.CreateInSubscription": - resp, err = a.dispatchCreateInSubscription(req) - case "AssessmentsMetadataClient.DeleteInSubscription": - resp, err = a.dispatchDeleteInSubscription(req) - case "AssessmentsMetadataClient.Get": - resp, err = a.dispatchGet(req) - case "AssessmentsMetadataClient.GetInSubscription": - resp, err = a.dispatchGetInSubscription(req) - case "AssessmentsMetadataClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - case "AssessmentsMetadataClient.NewListBySubscriptionPager": - resp, err = a.dispatchNewListBySubscriptionPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AssessmentsMetadataServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if assessmentsMetadataServerTransportInterceptor != nil { + res.resp, res.err, intercepted = assessmentsMetadataServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AssessmentsMetadataClient.CreateInSubscription": + res.resp, res.err = a.dispatchCreateInSubscription(req) + case "AssessmentsMetadataClient.DeleteInSubscription": + res.resp, res.err = a.dispatchDeleteInSubscription(req) + case "AssessmentsMetadataClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AssessmentsMetadataClient.GetInSubscription": + res.resp, res.err = a.dispatchGetInSubscription(req) + case "AssessmentsMetadataClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + case "AssessmentsMetadataClient.NewListBySubscriptionPager": + res.resp, res.err = a.dispatchNewListBySubscriptionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AssessmentsMetadataServerTransport) dispatchCreateInSubscription(req *http.Request) (*http.Response, error) { @@ -107,7 +121,7 @@ func (a *AssessmentsMetadataServerTransport) dispatchCreateInSubscription(req *h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assessmentMetadata/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.AssessmentMetadataResponse](req) @@ -123,7 +137,7 @@ func (a *AssessmentsMetadataServerTransport) dispatchCreateInSubscription(req *h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AssessmentMetadataResponse, req) @@ -140,7 +154,7 @@ func (a *AssessmentsMetadataServerTransport) dispatchDeleteInSubscription(req *h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assessmentMetadata/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } assessmentMetadataNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentMetadataName")]) @@ -152,7 +166,7 @@ func (a *AssessmentsMetadataServerTransport) dispatchDeleteInSubscription(req *h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -169,7 +183,7 @@ func (a *AssessmentsMetadataServerTransport) dispatchGet(req *http.Request) (*ht const regexStr = `/providers/Microsoft\.Security/assessmentMetadata/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } assessmentMetadataNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentMetadataName")]) @@ -181,7 +195,7 @@ func (a *AssessmentsMetadataServerTransport) dispatchGet(req *http.Request) (*ht return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AssessmentMetadataResponse, req) @@ -198,7 +212,7 @@ func (a *AssessmentsMetadataServerTransport) dispatchGetInSubscription(req *http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assessmentMetadata/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } assessmentMetadataNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("assessmentMetadataName")]) @@ -210,7 +224,7 @@ func (a *AssessmentsMetadataServerTransport) dispatchGetInSubscription(req *http return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AssessmentMetadataResponse, req) @@ -237,7 +251,7 @@ func (a *AssessmentsMetadataServerTransport) dispatchNewListPager(req *http.Requ if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -256,7 +270,7 @@ func (a *AssessmentsMetadataServerTransport) dispatchNewListBySubscriptionPager( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assessmentMetadata` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := a.srv.NewListBySubscriptionPager(nil) @@ -270,7 +284,7 @@ func (a *AssessmentsMetadataServerTransport) dispatchNewListBySubscriptionPager( if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListBySubscriptionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -279,3 +293,9 @@ func (a *AssessmentsMetadataServerTransport) dispatchNewListBySubscriptionPager( } return resp, nil } + +// set this to conditionally intercept incoming requests to AssessmentsMetadataServerTransport +var assessmentsMetadataServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/assignments_server.go b/sdk/resourcemanager/security/armsecurity/fake/assignments_server.go new file mode 100644 index 000000000000..d047e7a08706 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/fake/assignments_server.go @@ -0,0 +1,288 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" + "net/http" + "net/url" + "regexp" + "slices" +) + +// AssignmentsServer is a fake server for instances of the armsecurity.AssignmentsClient type. +type AssignmentsServer struct { + // CreateOrUpdate is the fake for method AssignmentsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, assignmentID string, assignment armsecurity.Assignment, options *armsecurity.AssignmentsClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.AssignmentsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method AssignmentsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, assignmentID string, options *armsecurity.AssignmentsClientDeleteOptions) (resp azfake.Responder[armsecurity.AssignmentsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method AssignmentsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, assignmentID string, options *armsecurity.AssignmentsClientGetOptions) (resp azfake.Responder[armsecurity.AssignmentsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method AssignmentsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, options *armsecurity.AssignmentsClientListOptions) (resp azfake.PagerResponder[armsecurity.AssignmentsClientListResponse]) + + // NewListBySubscriptionPager is the fake for method AssignmentsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armsecurity.AssignmentsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armsecurity.AssignmentsClientListBySubscriptionResponse]) +} + +// NewAssignmentsServerTransport creates a new instance of AssignmentsServerTransport with the provided implementation. +// The returned AssignmentsServerTransport instance is connected to an instance of armsecurity.AssignmentsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewAssignmentsServerTransport(srv *AssignmentsServer) *AssignmentsServerTransport { + return &AssignmentsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurity.AssignmentsClientListResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armsecurity.AssignmentsClientListBySubscriptionResponse]](), + } +} + +// AssignmentsServerTransport connects instances of armsecurity.AssignmentsClient to instances of AssignmentsServer. +// Don't use this type directly, use NewAssignmentsServerTransport instead. +type AssignmentsServerTransport struct { + srv *AssignmentsServer + newListPager *tracker[azfake.PagerResponder[armsecurity.AssignmentsClientListResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armsecurity.AssignmentsClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for AssignmentsServerTransport. +func (a *AssignmentsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return a.dispatchToMethodFake(req, method) +} + +func (a *AssignmentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if assignmentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = assignmentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AssignmentsClient.CreateOrUpdate": + res.resp, res.err = a.dispatchCreateOrUpdate(req) + case "AssignmentsClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "AssignmentsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AssignmentsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + case "AssignmentsClient.NewListBySubscriptionPager": + res.resp, res.err = a.dispatchNewListBySubscriptionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (a *AssignmentsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurity.Assignment](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + assignmentIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("assignmentId")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, assignmentIDParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Assignment, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AssignmentsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if a.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + assignmentIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("assignmentId")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Delete(req.Context(), resourceGroupNameParam, assignmentIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AssignmentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + assignmentIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("assignmentId")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), resourceGroupNameParam, assignmentIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Assignment, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *AssignmentsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := a.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assignments` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListPager(resourceGroupNameParam, nil) + newListPager = &resp + a.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.AssignmentsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + a.newListPager.remove(req) + } + return resp, nil +} + +func (a *AssignmentsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := a.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assignments` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := a.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + a.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armsecurity.AssignmentsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + a.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to AssignmentsServerTransport +var assignmentsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/automations_server.go b/sdk/resourcemanager/security/armsecurity/fake/automations_server.go index ad2974f1b320..537a09ffbda7 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/automations_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/automations_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // AutomationsServer is a fake server for instances of the armsecurity.AutomationsClient type. @@ -77,33 +77,47 @@ func (a *AutomationsServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AutomationsClient.CreateOrUpdate": - resp, err = a.dispatchCreateOrUpdate(req) - case "AutomationsClient.Delete": - resp, err = a.dispatchDelete(req) - case "AutomationsClient.Get": - resp, err = a.dispatchGet(req) - case "AutomationsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - case "AutomationsClient.NewListByResourceGroupPager": - resp, err = a.dispatchNewListByResourceGroupPager(req) - case "AutomationsClient.Update": - resp, err = a.dispatchUpdate(req) - case "AutomationsClient.Validate": - resp, err = a.dispatchValidate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AutomationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if automationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = automationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AutomationsClient.CreateOrUpdate": + res.resp, res.err = a.dispatchCreateOrUpdate(req) + case "AutomationsClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "AutomationsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AutomationsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + case "AutomationsClient.NewListByResourceGroupPager": + res.resp, res.err = a.dispatchNewListByResourceGroupPager(req) + case "AutomationsClient.Update": + res.resp, res.err = a.dispatchUpdate(req) + case "AutomationsClient.Validate": + res.resp, res.err = a.dispatchValidate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AutomationsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -113,7 +127,7 @@ func (a *AutomationsServerTransport) dispatchCreateOrUpdate(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/automations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.Automation](req) @@ -133,7 +147,7 @@ func (a *AutomationsServerTransport) dispatchCreateOrUpdate(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Automation, req) @@ -150,7 +164,7 @@ func (a *AutomationsServerTransport) dispatchDelete(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/automations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -166,7 +180,7 @@ func (a *AutomationsServerTransport) dispatchDelete(req *http.Request) (*http.Re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -183,7 +197,7 @@ func (a *AutomationsServerTransport) dispatchGet(req *http.Request) (*http.Respo const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/automations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -199,7 +213,7 @@ func (a *AutomationsServerTransport) dispatchGet(req *http.Request) (*http.Respo return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Automation, req) @@ -218,7 +232,7 @@ func (a *AutomationsServerTransport) dispatchNewListPager(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/automations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := a.srv.NewListPager(nil) @@ -232,7 +246,7 @@ func (a *AutomationsServerTransport) dispatchNewListPager(req *http.Request) (*h if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -251,7 +265,7 @@ func (a *AutomationsServerTransport) dispatchNewListByResourceGroupPager(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/automations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -269,7 +283,7 @@ func (a *AutomationsServerTransport) dispatchNewListByResourceGroupPager(req *ht if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListByResourceGroupPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -286,7 +300,7 @@ func (a *AutomationsServerTransport) dispatchUpdate(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/automations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.AutomationUpdateModel](req) @@ -306,7 +320,7 @@ func (a *AutomationsServerTransport) dispatchUpdate(req *http.Request) (*http.Re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Automation, req) @@ -323,7 +337,7 @@ func (a *AutomationsServerTransport) dispatchValidate(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/automations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/validate` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.Automation](req) @@ -343,7 +357,7 @@ func (a *AutomationsServerTransport) dispatchValidate(req *http.Request) (*http. return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AutomationValidationStatus, req) @@ -352,3 +366,9 @@ func (a *AutomationsServerTransport) dispatchValidate(req *http.Request) (*http. } return resp, nil } + +// set this to conditionally intercept incoming requests to AutomationsServerTransport +var automationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/autoprovisioningsettings_server.go b/sdk/resourcemanager/security/armsecurity/fake/autoprovisioningsettings_server.go index 5a9526b5f1a8..5d80f92bc47e 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/autoprovisioningsettings_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/autoprovisioningsettings_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // AutoProvisioningSettingsServer is a fake server for instances of the armsecurity.AutoProvisioningSettingsClient type. @@ -59,25 +59,39 @@ func (a *AutoProvisioningSettingsServerTransport) Do(req *http.Request) (*http.R return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AutoProvisioningSettingsClient.Create": - resp, err = a.dispatchCreate(req) - case "AutoProvisioningSettingsClient.Get": - resp, err = a.dispatchGet(req) - case "AutoProvisioningSettingsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AutoProvisioningSettingsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if autoProvisioningSettingsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = autoProvisioningSettingsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AutoProvisioningSettingsClient.Create": + res.resp, res.err = a.dispatchCreate(req) + case "AutoProvisioningSettingsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AutoProvisioningSettingsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AutoProvisioningSettingsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { @@ -87,7 +101,7 @@ func (a *AutoProvisioningSettingsServerTransport) dispatchCreate(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/autoProvisioningSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.AutoProvisioningSetting](req) @@ -103,7 +117,7 @@ func (a *AutoProvisioningSettingsServerTransport) dispatchCreate(req *http.Reque return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AutoProvisioningSetting, req) @@ -120,7 +134,7 @@ func (a *AutoProvisioningSettingsServerTransport) dispatchGet(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/autoProvisioningSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } settingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("settingName")]) @@ -132,7 +146,7 @@ func (a *AutoProvisioningSettingsServerTransport) dispatchGet(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AutoProvisioningSetting, req) @@ -151,7 +165,7 @@ func (a *AutoProvisioningSettingsServerTransport) dispatchNewListPager(req *http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/autoProvisioningSettings` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := a.srv.NewListPager(nil) @@ -165,7 +179,7 @@ func (a *AutoProvisioningSettingsServerTransport) dispatchNewListPager(req *http if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -174,3 +188,9 @@ func (a *AutoProvisioningSettingsServerTransport) dispatchNewListPager(req *http } return resp, nil } + +// set this to conditionally intercept incoming requests to AutoProvisioningSettingsServerTransport +var autoProvisioningSettingsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/azuredevopsorgs_server.go b/sdk/resourcemanager/security/armsecurity/fake/azuredevopsorgs_server.go index c0b701a5a4f3..ac4952ed8d4e 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/azuredevopsorgs_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/azuredevopsorgs_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // AzureDevOpsOrgsServer is a fake server for instances of the armsecurity.AzureDevOpsOrgsClient type. @@ -71,29 +71,43 @@ func (a *AzureDevOpsOrgsServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AzureDevOpsOrgsClient.BeginCreateOrUpdate": - resp, err = a.dispatchBeginCreateOrUpdate(req) - case "AzureDevOpsOrgsClient.Get": - resp, err = a.dispatchGet(req) - case "AzureDevOpsOrgsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - case "AzureDevOpsOrgsClient.ListAvailable": - resp, err = a.dispatchListAvailable(req) - case "AzureDevOpsOrgsClient.BeginUpdate": - resp, err = a.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AzureDevOpsOrgsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if azureDevOpsOrgsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = azureDevOpsOrgsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AzureDevOpsOrgsClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AzureDevOpsOrgsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AzureDevOpsOrgsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + case "AzureDevOpsOrgsClient.ListAvailable": + res.resp, res.err = a.dispatchListAvailable(req) + case "AzureDevOpsOrgsClient.BeginUpdate": + res.resp, res.err = a.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AzureDevOpsOrgsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -105,7 +119,7 @@ func (a *AzureDevOpsOrgsServerTransport) dispatchBeginCreateOrUpdate(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/azureDevOpsOrgs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.AzureDevOpsOrg](req) @@ -137,7 +151,7 @@ func (a *AzureDevOpsOrgsServerTransport) dispatchBeginCreateOrUpdate(req *http.R return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { a.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } @@ -155,7 +169,7 @@ func (a *AzureDevOpsOrgsServerTransport) dispatchGet(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/azureDevOpsOrgs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -175,7 +189,7 @@ func (a *AzureDevOpsOrgsServerTransport) dispatchGet(req *http.Request) (*http.R return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureDevOpsOrg, req) @@ -194,7 +208,7 @@ func (a *AzureDevOpsOrgsServerTransport) dispatchNewListPager(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/azureDevOpsOrgs` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -216,7 +230,7 @@ func (a *AzureDevOpsOrgsServerTransport) dispatchNewListPager(req *http.Request) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -233,7 +247,7 @@ func (a *AzureDevOpsOrgsServerTransport) dispatchListAvailable(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/listAvailableAzureDevOpsOrgs` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -249,7 +263,7 @@ func (a *AzureDevOpsOrgsServerTransport) dispatchListAvailable(req *http.Request return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureDevOpsOrgListResponse, req) @@ -268,7 +282,7 @@ func (a *AzureDevOpsOrgsServerTransport) dispatchBeginUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/azureDevOpsOrgs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.AzureDevOpsOrg](req) @@ -300,7 +314,7 @@ func (a *AzureDevOpsOrgsServerTransport) dispatchBeginUpdate(req *http.Request) return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { a.beginUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } @@ -310,3 +324,9 @@ func (a *AzureDevOpsOrgsServerTransport) dispatchBeginUpdate(req *http.Request) return resp, nil } + +// set this to conditionally intercept incoming requests to AzureDevOpsOrgsServerTransport +var azureDevOpsOrgsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/azuredevopsprojects_server.go b/sdk/resourcemanager/security/armsecurity/fake/azuredevopsprojects_server.go index 7b214a13d8fa..5fd3a692bc38 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/azuredevopsprojects_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/azuredevopsprojects_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // AzureDevOpsProjectsServer is a fake server for instances of the armsecurity.AzureDevOpsProjectsClient type. @@ -67,27 +67,41 @@ func (a *AzureDevOpsProjectsServerTransport) Do(req *http.Request) (*http.Respon return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AzureDevOpsProjectsClient.BeginCreateOrUpdate": - resp, err = a.dispatchBeginCreateOrUpdate(req) - case "AzureDevOpsProjectsClient.Get": - resp, err = a.dispatchGet(req) - case "AzureDevOpsProjectsClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - case "AzureDevOpsProjectsClient.BeginUpdate": - resp, err = a.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AzureDevOpsProjectsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if azureDevOpsProjectsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = azureDevOpsProjectsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AzureDevOpsProjectsClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AzureDevOpsProjectsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AzureDevOpsProjectsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + case "AzureDevOpsProjectsClient.BeginUpdate": + res.resp, res.err = a.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AzureDevOpsProjectsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -99,7 +113,7 @@ func (a *AzureDevOpsProjectsServerTransport) dispatchBeginCreateOrUpdate(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/azureDevOpsOrgs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.AzureDevOpsProject](req) @@ -135,7 +149,7 @@ func (a *AzureDevOpsProjectsServerTransport) dispatchBeginCreateOrUpdate(req *ht return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { a.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } @@ -153,7 +167,7 @@ func (a *AzureDevOpsProjectsServerTransport) dispatchGet(req *http.Request) (*ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/azureDevOpsOrgs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -177,7 +191,7 @@ func (a *AzureDevOpsProjectsServerTransport) dispatchGet(req *http.Request) (*ht return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureDevOpsProject, req) @@ -196,7 +210,7 @@ func (a *AzureDevOpsProjectsServerTransport) dispatchNewListPager(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/azureDevOpsOrgs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -222,7 +236,7 @@ func (a *AzureDevOpsProjectsServerTransport) dispatchNewListPager(req *http.Requ if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -241,7 +255,7 @@ func (a *AzureDevOpsProjectsServerTransport) dispatchBeginUpdate(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/azureDevOpsOrgs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.AzureDevOpsProject](req) @@ -277,7 +291,7 @@ func (a *AzureDevOpsProjectsServerTransport) dispatchBeginUpdate(req *http.Reque return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { a.beginUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } @@ -287,3 +301,9 @@ func (a *AzureDevOpsProjectsServerTransport) dispatchBeginUpdate(req *http.Reque return resp, nil } + +// set this to conditionally intercept incoming requests to AzureDevOpsProjectsServerTransport +var azureDevOpsProjectsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/azuredevopsrepos_server.go b/sdk/resourcemanager/security/armsecurity/fake/azuredevopsrepos_server.go index 69c1d7b73710..851ef3216021 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/azuredevopsrepos_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/azuredevopsrepos_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // AzureDevOpsReposServer is a fake server for instances of the armsecurity.AzureDevOpsReposClient type. @@ -67,27 +67,41 @@ func (a *AzureDevOpsReposServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return a.dispatchToMethodFake(req, method) +} - switch method { - case "AzureDevOpsReposClient.BeginCreateOrUpdate": - resp, err = a.dispatchBeginCreateOrUpdate(req) - case "AzureDevOpsReposClient.Get": - resp, err = a.dispatchGet(req) - case "AzureDevOpsReposClient.NewListPager": - resp, err = a.dispatchNewListPager(req) - case "AzureDevOpsReposClient.BeginUpdate": - resp, err = a.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (a *AzureDevOpsReposServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if azureDevOpsReposServerTransportInterceptor != nil { + res.resp, res.err, intercepted = azureDevOpsReposServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "AzureDevOpsReposClient.BeginCreateOrUpdate": + res.resp, res.err = a.dispatchBeginCreateOrUpdate(req) + case "AzureDevOpsReposClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "AzureDevOpsReposClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + case "AzureDevOpsReposClient.BeginUpdate": + res.resp, res.err = a.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (a *AzureDevOpsReposServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -99,7 +113,7 @@ func (a *AzureDevOpsReposServerTransport) dispatchBeginCreateOrUpdate(req *http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/azureDevOpsOrgs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/repos/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { + if len(matches) < 7 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.AzureDevOpsRepository](req) @@ -139,7 +153,7 @@ func (a *AzureDevOpsReposServerTransport) dispatchBeginCreateOrUpdate(req *http. return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { a.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} } @@ -157,7 +171,7 @@ func (a *AzureDevOpsReposServerTransport) dispatchGet(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/azureDevOpsOrgs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/repos/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { + if len(matches) < 7 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -185,7 +199,7 @@ func (a *AzureDevOpsReposServerTransport) dispatchGet(req *http.Request) (*http. return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AzureDevOpsRepository, req) @@ -204,7 +218,7 @@ func (a *AzureDevOpsReposServerTransport) dispatchNewListPager(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/azureDevOpsOrgs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/repos` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -234,7 +248,7 @@ func (a *AzureDevOpsReposServerTransport) dispatchNewListPager(req *http.Request if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { a.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -253,7 +267,7 @@ func (a *AzureDevOpsReposServerTransport) dispatchBeginUpdate(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/azureDevOpsOrgs/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/repos/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { + if len(matches) < 7 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.AzureDevOpsRepository](req) @@ -293,7 +307,7 @@ func (a *AzureDevOpsReposServerTransport) dispatchBeginUpdate(req *http.Request) return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { a.beginUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } @@ -303,3 +317,9 @@ func (a *AzureDevOpsReposServerTransport) dispatchBeginUpdate(req *http.Request) return resp, nil } + +// set this to conditionally intercept incoming requests to AzureDevOpsReposServerTransport +var azureDevOpsReposServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/complianceresults_server.go b/sdk/resourcemanager/security/armsecurity/fake/complianceresults_server.go index 85c9211471b2..b972e03708e2 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/complianceresults_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/complianceresults_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ComplianceResultsServer is a fake server for instances of the armsecurity.ComplianceResultsClient type. @@ -55,23 +55,37 @@ func (c *ComplianceResultsServerTransport) Do(req *http.Request) (*http.Response return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "ComplianceResultsClient.Get": - resp, err = c.dispatchGet(req) - case "ComplianceResultsClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *ComplianceResultsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if complianceResultsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = complianceResultsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ComplianceResultsClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "ComplianceResultsClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *ComplianceResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -81,7 +95,7 @@ func (c *ComplianceResultsServerTransport) dispatchGet(req *http.Request) (*http const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/complianceResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) @@ -97,7 +111,7 @@ func (c *ComplianceResultsServerTransport) dispatchGet(req *http.Request) (*http return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ComplianceResult, req) @@ -116,7 +130,7 @@ func (c *ComplianceResultsServerTransport) dispatchNewListPager(req *http.Reques const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/complianceResults` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -134,7 +148,7 @@ func (c *ComplianceResultsServerTransport) dispatchNewListPager(req *http.Reques if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -143,3 +157,9 @@ func (c *ComplianceResultsServerTransport) dispatchNewListPager(req *http.Reques } return resp, nil } + +// set this to conditionally intercept incoming requests to ComplianceResultsServerTransport +var complianceResultsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/compliances_server.go b/sdk/resourcemanager/security/armsecurity/fake/compliances_server.go index d61700db6fc7..3fc2403c99da 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/compliances_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/compliances_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // CompliancesServer is a fake server for instances of the armsecurity.CompliancesClient type. @@ -55,23 +55,37 @@ func (c *CompliancesServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "CompliancesClient.Get": - resp, err = c.dispatchGet(req) - case "CompliancesClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *CompliancesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if compliancesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = compliancesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CompliancesClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CompliancesClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *CompliancesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -81,7 +95,7 @@ func (c *CompliancesServerTransport) dispatchGet(req *http.Request) (*http.Respo const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/compliances/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -97,7 +111,7 @@ func (c *CompliancesServerTransport) dispatchGet(req *http.Request) (*http.Respo return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Compliance, req) @@ -116,7 +130,7 @@ func (c *CompliancesServerTransport) dispatchNewListPager(req *http.Request) (*h const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/compliances` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -134,7 +148,7 @@ func (c *CompliancesServerTransport) dispatchNewListPager(req *http.Request) (*h if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -143,3 +157,9 @@ func (c *CompliancesServerTransport) dispatchNewListPager(req *http.Request) (*h } return resp, nil } + +// set this to conditionally intercept incoming requests to CompliancesServerTransport +var compliancesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/connectorapplication_server.go b/sdk/resourcemanager/security/armsecurity/fake/connectorapplication_server.go index d6a7aff010c1..5852e34f7d83 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/connectorapplication_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/connectorapplication_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ConnectorApplicationServer is a fake server for instances of the armsecurity.ConnectorApplicationClient type. @@ -54,25 +54,39 @@ func (c *ConnectorApplicationServerTransport) Do(req *http.Request) (*http.Respo return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "ConnectorApplicationClient.CreateOrUpdate": - resp, err = c.dispatchCreateOrUpdate(req) - case "ConnectorApplicationClient.Delete": - resp, err = c.dispatchDelete(req) - case "ConnectorApplicationClient.Get": - resp, err = c.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *ConnectorApplicationServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if connectorApplicationServerTransportInterceptor != nil { + res.resp, res.err, intercepted = connectorApplicationServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ConnectorApplicationClient.CreateOrUpdate": + res.resp, res.err = c.dispatchCreateOrUpdate(req) + case "ConnectorApplicationClient.Delete": + res.resp, res.err = c.dispatchDelete(req) + case "ConnectorApplicationClient.Get": + res.resp, res.err = c.dispatchGet(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *ConnectorApplicationServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -82,7 +96,7 @@ func (c *ConnectorApplicationServerTransport) dispatchCreateOrUpdate(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/applications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.Application](req) @@ -106,7 +120,7 @@ func (c *ConnectorApplicationServerTransport) dispatchCreateOrUpdate(req *http.R return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Application, req) @@ -123,7 +137,7 @@ func (c *ConnectorApplicationServerTransport) dispatchDelete(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/applications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -143,7 +157,7 @@ func (c *ConnectorApplicationServerTransport) dispatchDelete(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -160,7 +174,7 @@ func (c *ConnectorApplicationServerTransport) dispatchGet(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/applications/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -180,7 +194,7 @@ func (c *ConnectorApplicationServerTransport) dispatchGet(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Application, req) @@ -189,3 +203,9 @@ func (c *ConnectorApplicationServerTransport) dispatchGet(req *http.Request) (*h } return resp, nil } + +// set this to conditionally intercept incoming requests to ConnectorApplicationServerTransport +var connectorApplicationServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/connectorapplications_server.go b/sdk/resourcemanager/security/armsecurity/fake/connectorapplications_server.go index 0af980914993..a17800896ec2 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/connectorapplications_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/connectorapplications_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ConnectorApplicationsServer is a fake server for instances of the armsecurity.ConnectorApplicationsClient type. @@ -50,21 +50,35 @@ func (c *ConnectorApplicationsServerTransport) Do(req *http.Request) (*http.Resp return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "ConnectorApplicationsClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *ConnectorApplicationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if connectorApplicationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = connectorApplicationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ConnectorApplicationsClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *ConnectorApplicationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -76,7 +90,7 @@ func (c *ConnectorApplicationsServerTransport) dispatchNewListPager(req *http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/applications` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -98,7 +112,7 @@ func (c *ConnectorApplicationsServerTransport) dispatchNewListPager(req *http.Re if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -107,3 +121,9 @@ func (c *ConnectorApplicationsServerTransport) dispatchNewListPager(req *http.Re } return resp, nil } + +// set this to conditionally intercept incoming requests to ConnectorApplicationsServerTransport +var connectorApplicationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/connectors_server.go b/sdk/resourcemanager/security/armsecurity/fake/connectors_server.go index 26508c974689..17e48e0c11e4 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/connectors_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/connectors_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ConnectorsServer is a fake server for instances of the armsecurity.ConnectorsClient type. @@ -73,31 +73,45 @@ func (c *ConnectorsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "ConnectorsClient.CreateOrUpdate": - resp, err = c.dispatchCreateOrUpdate(req) - case "ConnectorsClient.Delete": - resp, err = c.dispatchDelete(req) - case "ConnectorsClient.Get": - resp, err = c.dispatchGet(req) - case "ConnectorsClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - case "ConnectorsClient.NewListByResourceGroupPager": - resp, err = c.dispatchNewListByResourceGroupPager(req) - case "ConnectorsClient.Update": - resp, err = c.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *ConnectorsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if connectorsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = connectorsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ConnectorsClient.CreateOrUpdate": + res.resp, res.err = c.dispatchCreateOrUpdate(req) + case "ConnectorsClient.Delete": + res.resp, res.err = c.dispatchDelete(req) + case "ConnectorsClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "ConnectorsClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + case "ConnectorsClient.NewListByResourceGroupPager": + res.resp, res.err = c.dispatchNewListByResourceGroupPager(req) + case "ConnectorsClient.Update": + res.resp, res.err = c.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *ConnectorsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -107,7 +121,7 @@ func (c *ConnectorsServerTransport) dispatchCreateOrUpdate(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.Connector](req) @@ -127,7 +141,7 @@ func (c *ConnectorsServerTransport) dispatchCreateOrUpdate(req *http.Request) (* return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Connector, req) @@ -144,7 +158,7 @@ func (c *ConnectorsServerTransport) dispatchDelete(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -160,7 +174,7 @@ func (c *ConnectorsServerTransport) dispatchDelete(req *http.Request) (*http.Res return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -177,7 +191,7 @@ func (c *ConnectorsServerTransport) dispatchGet(req *http.Request) (*http.Respon const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -193,7 +207,7 @@ func (c *ConnectorsServerTransport) dispatchGet(req *http.Request) (*http.Respon return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Connector, req) @@ -212,7 +226,7 @@ func (c *ConnectorsServerTransport) dispatchNewListPager(req *http.Request) (*ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := c.srv.NewListPager(nil) @@ -226,7 +240,7 @@ func (c *ConnectorsServerTransport) dispatchNewListPager(req *http.Request) (*ht if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -245,7 +259,7 @@ func (c *ConnectorsServerTransport) dispatchNewListByResourceGroupPager(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -263,7 +277,7 @@ func (c *ConnectorsServerTransport) dispatchNewListByResourceGroupPager(req *htt if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListByResourceGroupPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -280,7 +294,7 @@ func (c *ConnectorsServerTransport) dispatchUpdate(req *http.Request) (*http.Res const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.Connector](req) @@ -300,7 +314,7 @@ func (c *ConnectorsServerTransport) dispatchUpdate(req *http.Request) (*http.Res return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Connector, req) @@ -309,3 +323,9 @@ func (c *ConnectorsServerTransport) dispatchUpdate(req *http.Request) (*http.Res } return resp, nil } + +// set this to conditionally intercept incoming requests to ConnectorsServerTransport +var connectorsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/contacts_server.go b/sdk/resourcemanager/security/armsecurity/fake/contacts_server.go index 595f58e7fb34..08039ce54da1 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/contacts_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/contacts_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ContactsServer is a fake server for instances of the armsecurity.ContactsClient type. @@ -63,27 +63,41 @@ func (c *ContactsServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return c.dispatchToMethodFake(req, method) +} - switch method { - case "ContactsClient.Create": - resp, err = c.dispatchCreate(req) - case "ContactsClient.Delete": - resp, err = c.dispatchDelete(req) - case "ContactsClient.Get": - resp, err = c.dispatchGet(req) - case "ContactsClient.NewListPager": - resp, err = c.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (c *ContactsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if contactsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = contactsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ContactsClient.Create": + res.resp, res.err = c.dispatchCreate(req) + case "ContactsClient.Delete": + res.resp, res.err = c.dispatchDelete(req) + case "ContactsClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "ContactsClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (c *ContactsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { @@ -93,7 +107,7 @@ func (c *ContactsServerTransport) dispatchCreate(req *http.Request) (*http.Respo const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityContacts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.Contact](req) @@ -115,7 +129,7 @@ func (c *ContactsServerTransport) dispatchCreate(req *http.Request) (*http.Respo return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Contact, req) @@ -132,7 +146,7 @@ func (c *ContactsServerTransport) dispatchDelete(req *http.Request) (*http.Respo const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityContacts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } securityContactNameParam, err := parseWithCast(matches[regex.SubexpIndex("securityContactName")], func(v string) (armsecurity.SecurityContactName, error) { @@ -150,7 +164,7 @@ func (c *ContactsServerTransport) dispatchDelete(req *http.Request) (*http.Respo return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -167,7 +181,7 @@ func (c *ContactsServerTransport) dispatchGet(req *http.Request) (*http.Response const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityContacts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } securityContactNameParam, err := parseWithCast(matches[regex.SubexpIndex("securityContactName")], func(v string) (armsecurity.SecurityContactName, error) { @@ -185,7 +199,7 @@ func (c *ContactsServerTransport) dispatchGet(req *http.Request) (*http.Response return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Contact, req) @@ -204,7 +218,7 @@ func (c *ContactsServerTransport) dispatchNewListPager(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityContacts` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := c.srv.NewListPager(nil) @@ -218,7 +232,7 @@ func (c *ContactsServerTransport) dispatchNewListPager(req *http.Request) (*http if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { c.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -227,3 +241,9 @@ func (c *ContactsServerTransport) dispatchNewListPager(req *http.Request) (*http } return resp, nil } + +// set this to conditionally intercept incoming requests to ContactsServerTransport +var contactsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/customassessmentautomations_server.go b/sdk/resourcemanager/security/armsecurity/fake/customassessmentautomations_server.go deleted file mode 100644 index 7ed40b83f81a..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/customassessmentautomations_server.go +++ /dev/null @@ -1,268 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" - "net/http" - "net/url" - "regexp" -) - -// CustomAssessmentAutomationsServer is a fake server for instances of the armsecurity.CustomAssessmentAutomationsClient type. -type CustomAssessmentAutomationsServer struct { - // Create is the fake for method CustomAssessmentAutomationsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, customAssessmentAutomationName string, customAssessmentAutomationBody armsecurity.CustomAssessmentAutomationRequest, options *armsecurity.CustomAssessmentAutomationsClientCreateOptions) (resp azfake.Responder[armsecurity.CustomAssessmentAutomationsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method CustomAssessmentAutomationsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, customAssessmentAutomationName string, options *armsecurity.CustomAssessmentAutomationsClientDeleteOptions) (resp azfake.Responder[armsecurity.CustomAssessmentAutomationsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method CustomAssessmentAutomationsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, customAssessmentAutomationName string, options *armsecurity.CustomAssessmentAutomationsClientGetOptions) (resp azfake.Responder[armsecurity.CustomAssessmentAutomationsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method CustomAssessmentAutomationsClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armsecurity.CustomAssessmentAutomationsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armsecurity.CustomAssessmentAutomationsClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method CustomAssessmentAutomationsClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armsecurity.CustomAssessmentAutomationsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armsecurity.CustomAssessmentAutomationsClientListBySubscriptionResponse]) -} - -// NewCustomAssessmentAutomationsServerTransport creates a new instance of CustomAssessmentAutomationsServerTransport with the provided implementation. -// The returned CustomAssessmentAutomationsServerTransport instance is connected to an instance of armsecurity.CustomAssessmentAutomationsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewCustomAssessmentAutomationsServerTransport(srv *CustomAssessmentAutomationsServer) *CustomAssessmentAutomationsServerTransport { - return &CustomAssessmentAutomationsServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armsecurity.CustomAssessmentAutomationsClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armsecurity.CustomAssessmentAutomationsClientListBySubscriptionResponse]](), - } -} - -// CustomAssessmentAutomationsServerTransport connects instances of armsecurity.CustomAssessmentAutomationsClient to instances of CustomAssessmentAutomationsServer. -// Don't use this type directly, use NewCustomAssessmentAutomationsServerTransport instead. -type CustomAssessmentAutomationsServerTransport struct { - srv *CustomAssessmentAutomationsServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armsecurity.CustomAssessmentAutomationsClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armsecurity.CustomAssessmentAutomationsClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for CustomAssessmentAutomationsServerTransport. -func (c *CustomAssessmentAutomationsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "CustomAssessmentAutomationsClient.Create": - resp, err = c.dispatchCreate(req) - case "CustomAssessmentAutomationsClient.Delete": - resp, err = c.dispatchDelete(req) - case "CustomAssessmentAutomationsClient.Get": - resp, err = c.dispatchGet(req) - case "CustomAssessmentAutomationsClient.NewListByResourceGroupPager": - resp, err = c.dispatchNewListByResourceGroupPager(req) - case "CustomAssessmentAutomationsClient.NewListBySubscriptionPager": - resp, err = c.dispatchNewListBySubscriptionPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (c *CustomAssessmentAutomationsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if c.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/customAssessmentAutomations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.CustomAssessmentAutomationRequest](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - customAssessmentAutomationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customAssessmentAutomationName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Create(req.Context(), resourceGroupNameParam, customAssessmentAutomationNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CustomAssessmentAutomation, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *CustomAssessmentAutomationsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if c.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/customAssessmentAutomations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - customAssessmentAutomationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customAssessmentAutomationName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Delete(req.Context(), resourceGroupNameParam, customAssessmentAutomationNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *CustomAssessmentAutomationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if c.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/customAssessmentAutomations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - customAssessmentAutomationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customAssessmentAutomationName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, customAssessmentAutomationNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CustomAssessmentAutomation, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *CustomAssessmentAutomationsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if c.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := c.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/customAssessmentAutomations` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - c.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armsecurity.CustomAssessmentAutomationsClientListByResourceGroupResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - c.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - c.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (c *CustomAssessmentAutomationsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if c.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := c.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/customAssessmentAutomations` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := c.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - c.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armsecurity.CustomAssessmentAutomationsClientListBySubscriptionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - c.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - c.newListBySubscriptionPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/customentitystoreassignments_server.go b/sdk/resourcemanager/security/armsecurity/fake/customentitystoreassignments_server.go deleted file mode 100644 index f8a6ef046d5a..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/customentitystoreassignments_server.go +++ /dev/null @@ -1,268 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" - "net/http" - "net/url" - "regexp" -) - -// CustomEntityStoreAssignmentsServer is a fake server for instances of the armsecurity.CustomEntityStoreAssignmentsClient type. -type CustomEntityStoreAssignmentsServer struct { - // Create is the fake for method CustomEntityStoreAssignmentsClient.Create - // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated - Create func(ctx context.Context, resourceGroupName string, customEntityStoreAssignmentName string, customEntityStoreAssignmentRequestBody armsecurity.CustomEntityStoreAssignmentRequest, options *armsecurity.CustomEntityStoreAssignmentsClientCreateOptions) (resp azfake.Responder[armsecurity.CustomEntityStoreAssignmentsClientCreateResponse], errResp azfake.ErrorResponder) - - // Delete is the fake for method CustomEntityStoreAssignmentsClient.Delete - // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, resourceGroupName string, customEntityStoreAssignmentName string, options *armsecurity.CustomEntityStoreAssignmentsClientDeleteOptions) (resp azfake.Responder[armsecurity.CustomEntityStoreAssignmentsClientDeleteResponse], errResp azfake.ErrorResponder) - - // Get is the fake for method CustomEntityStoreAssignmentsClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, customEntityStoreAssignmentName string, options *armsecurity.CustomEntityStoreAssignmentsClientGetOptions) (resp azfake.Responder[armsecurity.CustomEntityStoreAssignmentsClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByResourceGroupPager is the fake for method CustomEntityStoreAssignmentsClient.NewListByResourceGroupPager - // HTTP status codes to indicate success: http.StatusOK - NewListByResourceGroupPager func(resourceGroupName string, options *armsecurity.CustomEntityStoreAssignmentsClientListByResourceGroupOptions) (resp azfake.PagerResponder[armsecurity.CustomEntityStoreAssignmentsClientListByResourceGroupResponse]) - - // NewListBySubscriptionPager is the fake for method CustomEntityStoreAssignmentsClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armsecurity.CustomEntityStoreAssignmentsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armsecurity.CustomEntityStoreAssignmentsClientListBySubscriptionResponse]) -} - -// NewCustomEntityStoreAssignmentsServerTransport creates a new instance of CustomEntityStoreAssignmentsServerTransport with the provided implementation. -// The returned CustomEntityStoreAssignmentsServerTransport instance is connected to an instance of armsecurity.CustomEntityStoreAssignmentsClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewCustomEntityStoreAssignmentsServerTransport(srv *CustomEntityStoreAssignmentsServer) *CustomEntityStoreAssignmentsServerTransport { - return &CustomEntityStoreAssignmentsServerTransport{ - srv: srv, - newListByResourceGroupPager: newTracker[azfake.PagerResponder[armsecurity.CustomEntityStoreAssignmentsClientListByResourceGroupResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armsecurity.CustomEntityStoreAssignmentsClientListBySubscriptionResponse]](), - } -} - -// CustomEntityStoreAssignmentsServerTransport connects instances of armsecurity.CustomEntityStoreAssignmentsClient to instances of CustomEntityStoreAssignmentsServer. -// Don't use this type directly, use NewCustomEntityStoreAssignmentsServerTransport instead. -type CustomEntityStoreAssignmentsServerTransport struct { - srv *CustomEntityStoreAssignmentsServer - newListByResourceGroupPager *tracker[azfake.PagerResponder[armsecurity.CustomEntityStoreAssignmentsClientListByResourceGroupResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armsecurity.CustomEntityStoreAssignmentsClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for CustomEntityStoreAssignmentsServerTransport. -func (c *CustomEntityStoreAssignmentsServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "CustomEntityStoreAssignmentsClient.Create": - resp, err = c.dispatchCreate(req) - case "CustomEntityStoreAssignmentsClient.Delete": - resp, err = c.dispatchDelete(req) - case "CustomEntityStoreAssignmentsClient.Get": - resp, err = c.dispatchGet(req) - case "CustomEntityStoreAssignmentsClient.NewListByResourceGroupPager": - resp, err = c.dispatchNewListByResourceGroupPager(req) - case "CustomEntityStoreAssignmentsClient.NewListBySubscriptionPager": - resp, err = c.dispatchNewListBySubscriptionPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (c *CustomEntityStoreAssignmentsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { - if c.srv.Create == nil { - return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/customEntityStoreAssignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - body, err := server.UnmarshalRequestAsJSON[armsecurity.CustomEntityStoreAssignmentRequest](req) - if err != nil { - return nil, err - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - customEntityStoreAssignmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customEntityStoreAssignmentName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Create(req.Context(), resourceGroupNameParam, customEntityStoreAssignmentNameParam, body, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CustomEntityStoreAssignment, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *CustomEntityStoreAssignmentsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { - if c.srv.Delete == nil { - return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/customEntityStoreAssignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - customEntityStoreAssignmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customEntityStoreAssignmentName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Delete(req.Context(), resourceGroupNameParam, customEntityStoreAssignmentNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} - } - resp, err := server.NewResponse(respContent, req, nil) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *CustomEntityStoreAssignmentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if c.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/customEntityStoreAssignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - customEntityStoreAssignmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customEntityStoreAssignmentName")]) - if err != nil { - return nil, err - } - respr, errRespr := c.srv.Get(req.Context(), resourceGroupNameParam, customEntityStoreAssignmentNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CustomEntityStoreAssignment, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (c *CustomEntityStoreAssignmentsServerTransport) dispatchNewListByResourceGroupPager(req *http.Request) (*http.Response, error) { - if c.srv.NewListByResourceGroupPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByResourceGroupPager not implemented")} - } - newListByResourceGroupPager := c.newListByResourceGroupPager.get(req) - if newListByResourceGroupPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourcegroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/customEntityStoreAssignments` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resp := c.srv.NewListByResourceGroupPager(resourceGroupNameParam, nil) - newListByResourceGroupPager = &resp - c.newListByResourceGroupPager.add(req, newListByResourceGroupPager) - server.PagerResponderInjectNextLinks(newListByResourceGroupPager, req, func(page *armsecurity.CustomEntityStoreAssignmentsClientListByResourceGroupResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByResourceGroupPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - c.newListByResourceGroupPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByResourceGroupPager) { - c.newListByResourceGroupPager.remove(req) - } - return resp, nil -} - -func (c *CustomEntityStoreAssignmentsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if c.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := c.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/customEntityStoreAssignments` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := c.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - c.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armsecurity.CustomEntityStoreAssignmentsClientListBySubscriptionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - c.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - c.newListBySubscriptionPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/customrecommendations_server.go b/sdk/resourcemanager/security/armsecurity/fake/customrecommendations_server.go new file mode 100644 index 000000000000..b3f39e2977fe --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/fake/customrecommendations_server.go @@ -0,0 +1,247 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" + "net/http" + "net/url" + "regexp" + "slices" +) + +// CustomRecommendationsServer is a fake server for instances of the armsecurity.CustomRecommendationsClient type. +type CustomRecommendationsServer struct { + // CreateOrUpdate is the fake for method CustomRecommendationsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, scope string, customRecommendationName string, customRecommendationBody armsecurity.CustomRecommendation, options *armsecurity.CustomRecommendationsClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.CustomRecommendationsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method CustomRecommendationsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, scope string, customRecommendationName string, options *armsecurity.CustomRecommendationsClientDeleteOptions) (resp azfake.Responder[armsecurity.CustomRecommendationsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method CustomRecommendationsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, scope string, customRecommendationName string, options *armsecurity.CustomRecommendationsClientGetOptions) (resp azfake.Responder[armsecurity.CustomRecommendationsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method CustomRecommendationsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(scope string, options *armsecurity.CustomRecommendationsClientListOptions) (resp azfake.PagerResponder[armsecurity.CustomRecommendationsClientListResponse]) +} + +// NewCustomRecommendationsServerTransport creates a new instance of CustomRecommendationsServerTransport with the provided implementation. +// The returned CustomRecommendationsServerTransport instance is connected to an instance of armsecurity.CustomRecommendationsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewCustomRecommendationsServerTransport(srv *CustomRecommendationsServer) *CustomRecommendationsServerTransport { + return &CustomRecommendationsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurity.CustomRecommendationsClientListResponse]](), + } +} + +// CustomRecommendationsServerTransport connects instances of armsecurity.CustomRecommendationsClient to instances of CustomRecommendationsServer. +// Don't use this type directly, use NewCustomRecommendationsServerTransport instead. +type CustomRecommendationsServerTransport struct { + srv *CustomRecommendationsServer + newListPager *tracker[azfake.PagerResponder[armsecurity.CustomRecommendationsClientListResponse]] +} + +// Do implements the policy.Transporter interface for CustomRecommendationsServerTransport. +func (c *CustomRecommendationsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return c.dispatchToMethodFake(req, method) +} + +func (c *CustomRecommendationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if customRecommendationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = customRecommendationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "CustomRecommendationsClient.CreateOrUpdate": + res.resp, res.err = c.dispatchCreateOrUpdate(req) + case "CustomRecommendationsClient.Delete": + res.resp, res.err = c.dispatchDelete(req) + case "CustomRecommendationsClient.Get": + res.resp, res.err = c.dispatchGet(req) + case "CustomRecommendationsClient.NewListPager": + res.resp, res.err = c.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (c *CustomRecommendationsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if c.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/customRecommendations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurity.CustomRecommendation](req) + if err != nil { + return nil, err + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + customRecommendationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customRecommendationName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.CreateOrUpdate(req.Context(), scopeParam, customRecommendationNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CustomRecommendation, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CustomRecommendationsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if c.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/customRecommendations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + customRecommendationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customRecommendationName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Delete(req.Context(), scopeParam, customRecommendationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CustomRecommendationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if c.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/customRecommendations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + customRecommendationNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("customRecommendationName")]) + if err != nil { + return nil, err + } + respr, errRespr := c.srv.Get(req.Context(), scopeParam, customRecommendationNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).CustomRecommendation, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (c *CustomRecommendationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if c.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := c.newListPager.get(req) + if newListPager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/customRecommendations` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + resp := c.srv.NewListPager(scopeParam, nil) + newListPager = &resp + c.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.CustomRecommendationsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + c.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + c.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to CustomRecommendationsServerTransport +var customRecommendationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/date_type.go b/sdk/resourcemanager/security/armsecurity/fake/date_type.go deleted file mode 100644 index fc08a215e031..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/date_type.go +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "time" -) - -const ( - fullDateJSON = `"2006-01-02"` - jsonFormat = `"%04d-%02d-%02d"` -) - -type dateType time.Time - -func (t dateType) MarshalJSON() ([]byte, error) { - return []byte(fmt.Sprintf(jsonFormat, time.Time(t).Year(), time.Time(t).Month(), time.Time(t).Day())), nil -} - -func (d *dateType) UnmarshalJSON(data []byte) (err error) { - t, err := time.Parse(fullDateJSON, string(data)) - *d = (dateType)(t) - return err -} - -func populateDateType(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateType)(t) -} - -func unpopulateDateType(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateType - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/defenderforstorage_server.go b/sdk/resourcemanager/security/armsecurity/fake/defenderforstorage_server.go index 7aefc81a7c8f..df2973752052 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/defenderforstorage_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/defenderforstorage_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,14 +11,20 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" "net/http" "net/url" "regexp" + "slices" ) // DefenderForStorageServer is a fake server for instances of the armsecurity.DefenderForStorageClient type. type DefenderForStorageServer struct { + // CancelMalwareScan is the fake for method DefenderForStorageClient.CancelMalwareScan + // HTTP status codes to indicate success: http.StatusOK + CancelMalwareScan func(ctx context.Context, resourceID string, settingName armsecurity.SettingName, scanID string, options *armsecurity.DefenderForStorageClientCancelMalwareScanOptions) (resp azfake.Responder[armsecurity.DefenderForStorageClientCancelMalwareScanResponse], errResp azfake.ErrorResponder) + // Create is the fake for method DefenderForStorageClient.Create // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated Create func(ctx context.Context, resourceID string, settingName armsecurity.SettingName, defenderForStorageSetting armsecurity.DefenderForStorageSetting, options *armsecurity.DefenderForStorageClientCreateOptions) (resp azfake.Responder[armsecurity.DefenderForStorageClientCreateResponse], errResp azfake.ErrorResponder) @@ -27,19 +32,35 @@ type DefenderForStorageServer struct { // Get is the fake for method DefenderForStorageClient.Get // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, resourceID string, settingName armsecurity.SettingName, options *armsecurity.DefenderForStorageClientGetOptions) (resp azfake.Responder[armsecurity.DefenderForStorageClientGetResponse], errResp azfake.ErrorResponder) + + // GetMalwareScan is the fake for method DefenderForStorageClient.GetMalwareScan + // HTTP status codes to indicate success: http.StatusOK + GetMalwareScan func(ctx context.Context, resourceID string, settingName armsecurity.SettingName, scanID string, options *armsecurity.DefenderForStorageClientGetMalwareScanOptions) (resp azfake.Responder[armsecurity.DefenderForStorageClientGetMalwareScanResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method DefenderForStorageClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceID string, options *armsecurity.DefenderForStorageClientListOptions) (resp azfake.PagerResponder[armsecurity.DefenderForStorageClientListResponse]) + + // StartMalwareScan is the fake for method DefenderForStorageClient.StartMalwareScan + // HTTP status codes to indicate success: http.StatusOK + StartMalwareScan func(ctx context.Context, resourceID string, settingName armsecurity.SettingName, options *armsecurity.DefenderForStorageClientStartMalwareScanOptions) (resp azfake.Responder[armsecurity.DefenderForStorageClientStartMalwareScanResponse], errResp azfake.ErrorResponder) } // NewDefenderForStorageServerTransport creates a new instance of DefenderForStorageServerTransport with the provided implementation. // The returned DefenderForStorageServerTransport instance is connected to an instance of armsecurity.DefenderForStorageClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewDefenderForStorageServerTransport(srv *DefenderForStorageServer) *DefenderForStorageServerTransport { - return &DefenderForStorageServerTransport{srv: srv} + return &DefenderForStorageServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurity.DefenderForStorageClientListResponse]](), + } } // DefenderForStorageServerTransport connects instances of armsecurity.DefenderForStorageClient to instances of DefenderForStorageServer. // Don't use this type directly, use NewDefenderForStorageServerTransport instead. type DefenderForStorageServerTransport struct { - srv *DefenderForStorageServer + srv *DefenderForStorageServer + newListPager *tracker[azfake.PagerResponder[armsecurity.DefenderForStorageClientListResponse]] } // Do implements the policy.Transporter interface for DefenderForStorageServerTransport. @@ -50,22 +71,87 @@ func (d *DefenderForStorageServerTransport) Do(req *http.Request) (*http.Respons return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} + +func (d *DefenderForStorageServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if defenderForStorageServerTransportInterceptor != nil { + res.resp, res.err, intercepted = defenderForStorageServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DefenderForStorageClient.CancelMalwareScan": + res.resp, res.err = d.dispatchCancelMalwareScan(req) + case "DefenderForStorageClient.Create": + res.resp, res.err = d.dispatchCreate(req) + case "DefenderForStorageClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DefenderForStorageClient.GetMalwareScan": + res.resp, res.err = d.dispatchGetMalwareScan(req) + case "DefenderForStorageClient.NewListPager": + res.resp, res.err = d.dispatchNewListPager(req) + case "DefenderForStorageClient.StartMalwareScan": + res.resp, res.err = d.dispatchStartMalwareScan(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() - switch method { - case "DefenderForStorageClient.Create": - resp, err = d.dispatchCreate(req) - case "DefenderForStorageClient.Get": - resp, err = d.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err } +} +func (d *DefenderForStorageServerTransport) dispatchCancelMalwareScan(req *http.Request) (*http.Response, error) { + if d.srv.CancelMalwareScan == nil { + return nil, &nonRetriableError{errors.New("fake for method CancelMalwareScan not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/defenderForStorageSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/malwareScans/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/cancelMalwareScan` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) + if err != nil { + return nil, err + } + settingNameParam, err := parseWithCast(matches[regex.SubexpIndex("settingName")], func(v string) (armsecurity.SettingName, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armsecurity.SettingName(p), nil + }) + if err != nil { + return nil, err + } + scanIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("scanId")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.CancelMalwareScan(req.Context(), resourceIDParam, settingNameParam, scanIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MalwareScan, req) if err != nil { return nil, err } - return resp, nil } @@ -76,7 +162,7 @@ func (d *DefenderForStorageServerTransport) dispatchCreate(req *http.Request) (* const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/defenderForStorageSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.DefenderForStorageSetting](req) @@ -102,7 +188,7 @@ func (d *DefenderForStorageServerTransport) dispatchCreate(req *http.Request) (* return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DefenderForStorageSetting, req) @@ -119,7 +205,7 @@ func (d *DefenderForStorageServerTransport) dispatchGet(req *http.Request) (*htt const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/defenderForStorageSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) @@ -141,7 +227,7 @@ func (d *DefenderForStorageServerTransport) dispatchGet(req *http.Request) (*htt return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DefenderForStorageSetting, req) @@ -150,3 +236,128 @@ func (d *DefenderForStorageServerTransport) dispatchGet(req *http.Request) (*htt } return resp, nil } + +func (d *DefenderForStorageServerTransport) dispatchGetMalwareScan(req *http.Request) (*http.Response, error) { + if d.srv.GetMalwareScan == nil { + return nil, &nonRetriableError{errors.New("fake for method GetMalwareScan not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/defenderForStorageSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/malwareScans/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) + if err != nil { + return nil, err + } + settingNameParam, err := parseWithCast(matches[regex.SubexpIndex("settingName")], func(v string) (armsecurity.SettingName, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armsecurity.SettingName(p), nil + }) + if err != nil { + return nil, err + } + scanIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("scanId")]) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.GetMalwareScan(req.Context(), resourceIDParam, settingNameParam, scanIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MalwareScan, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (d *DefenderForStorageServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if d.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := d.newListPager.get(req) + if newListPager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/defenderForStorageSettings` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) + if err != nil { + return nil, err + } + resp := d.srv.NewListPager(resourceIDParam, nil) + newListPager = &resp + d.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.DefenderForStorageClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + d.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + d.newListPager.remove(req) + } + return resp, nil +} + +func (d *DefenderForStorageServerTransport) dispatchStartMalwareScan(req *http.Request) (*http.Response, error) { + if d.srv.StartMalwareScan == nil { + return nil, &nonRetriableError{errors.New("fake for method StartMalwareScan not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/defenderForStorageSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/startMalwareScan` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) + if err != nil { + return nil, err + } + settingNameParam, err := parseWithCast(matches[regex.SubexpIndex("settingName")], func(v string) (armsecurity.SettingName, error) { + p, unescapeErr := url.PathUnescape(v) + if unescapeErr != nil { + return "", unescapeErr + } + return armsecurity.SettingName(p), nil + }) + if err != nil { + return nil, err + } + respr, errRespr := d.srv.StartMalwareScan(req.Context(), resourceIDParam, settingNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MalwareScan, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to DefenderForStorageServerTransport +var defenderForStorageServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/devicesecuritygroups_server.go b/sdk/resourcemanager/security/armsecurity/fake/devicesecuritygroups_server.go index d92ed61599d5..2b5f0081aa70 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/devicesecuritygroups_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/devicesecuritygroups_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // DeviceSecurityGroupsServer is a fake server for instances of the armsecurity.DeviceSecurityGroupsClient type. @@ -63,27 +63,41 @@ func (d *DeviceSecurityGroupsServerTransport) Do(req *http.Request) (*http.Respo return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - switch method { - case "DeviceSecurityGroupsClient.CreateOrUpdate": - resp, err = d.dispatchCreateOrUpdate(req) - case "DeviceSecurityGroupsClient.Delete": - resp, err = d.dispatchDelete(req) - case "DeviceSecurityGroupsClient.Get": - resp, err = d.dispatchGet(req) - case "DeviceSecurityGroupsClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DeviceSecurityGroupsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if deviceSecurityGroupsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = deviceSecurityGroupsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DeviceSecurityGroupsClient.CreateOrUpdate": + res.resp, res.err = d.dispatchCreateOrUpdate(req) + case "DeviceSecurityGroupsClient.Delete": + res.resp, res.err = d.dispatchDelete(req) + case "DeviceSecurityGroupsClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DeviceSecurityGroupsClient.NewListPager": + res.resp, res.err = d.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DeviceSecurityGroupsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -93,7 +107,7 @@ func (d *DeviceSecurityGroupsServerTransport) dispatchCreateOrUpdate(req *http.R const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/deviceSecurityGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.DeviceSecurityGroup](req) @@ -113,7 +127,7 @@ func (d *DeviceSecurityGroupsServerTransport) dispatchCreateOrUpdate(req *http.R return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DeviceSecurityGroup, req) @@ -130,7 +144,7 @@ func (d *DeviceSecurityGroupsServerTransport) dispatchDelete(req *http.Request) const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/deviceSecurityGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) @@ -146,7 +160,7 @@ func (d *DeviceSecurityGroupsServerTransport) dispatchDelete(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -163,7 +177,7 @@ func (d *DeviceSecurityGroupsServerTransport) dispatchGet(req *http.Request) (*h const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/deviceSecurityGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) @@ -179,7 +193,7 @@ func (d *DeviceSecurityGroupsServerTransport) dispatchGet(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DeviceSecurityGroup, req) @@ -198,7 +212,7 @@ func (d *DeviceSecurityGroupsServerTransport) dispatchNewListPager(req *http.Req const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/deviceSecurityGroups` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) @@ -216,7 +230,7 @@ func (d *DeviceSecurityGroupsServerTransport) dispatchNewListPager(req *http.Req if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { d.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -225,3 +239,9 @@ func (d *DeviceSecurityGroupsServerTransport) dispatchNewListPager(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to DeviceSecurityGroupsServerTransport +var deviceSecurityGroupsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/devopsconfigurations_server.go b/sdk/resourcemanager/security/armsecurity/fake/devopsconfigurations_server.go index 0120d3200f32..9e1f8b2cf69c 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/devopsconfigurations_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/devopsconfigurations_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // DevOpsConfigurationsServer is a fake server for instances of the armsecurity.DevOpsConfigurationsClient type. @@ -73,29 +73,43 @@ func (d *DevOpsConfigurationsServerTransport) Do(req *http.Request) (*http.Respo return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - switch method { - case "DevOpsConfigurationsClient.BeginCreateOrUpdate": - resp, err = d.dispatchBeginCreateOrUpdate(req) - case "DevOpsConfigurationsClient.BeginDelete": - resp, err = d.dispatchBeginDelete(req) - case "DevOpsConfigurationsClient.Get": - resp, err = d.dispatchGet(req) - case "DevOpsConfigurationsClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - case "DevOpsConfigurationsClient.BeginUpdate": - resp, err = d.dispatchBeginUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DevOpsConfigurationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if devOpsConfigurationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = devOpsConfigurationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DevOpsConfigurationsClient.BeginCreateOrUpdate": + res.resp, res.err = d.dispatchBeginCreateOrUpdate(req) + case "DevOpsConfigurationsClient.BeginDelete": + res.resp, res.err = d.dispatchBeginDelete(req) + case "DevOpsConfigurationsClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DevOpsConfigurationsClient.NewListPager": + res.resp, res.err = d.dispatchNewListPager(req) + case "DevOpsConfigurationsClient.BeginUpdate": + res.resp, res.err = d.dispatchBeginUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DevOpsConfigurationsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -107,7 +121,7 @@ func (d *DevOpsConfigurationsServerTransport) dispatchBeginCreateOrUpdate(req *h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.DevOpsConfiguration](req) @@ -135,7 +149,7 @@ func (d *DevOpsConfigurationsServerTransport) dispatchBeginCreateOrUpdate(req *h return nil, err } - if !contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated, http.StatusAccepted}, resp.StatusCode) { d.beginCreateOrUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated, http.StatusAccepted", resp.StatusCode)} } @@ -155,7 +169,7 @@ func (d *DevOpsConfigurationsServerTransport) dispatchBeginDelete(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -179,7 +193,7 @@ func (d *DevOpsConfigurationsServerTransport) dispatchBeginDelete(req *http.Requ return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { d.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -197,7 +211,7 @@ func (d *DevOpsConfigurationsServerTransport) dispatchGet(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -213,7 +227,7 @@ func (d *DevOpsConfigurationsServerTransport) dispatchGet(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DevOpsConfiguration, req) @@ -232,7 +246,7 @@ func (d *DevOpsConfigurationsServerTransport) dispatchNewListPager(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -254,7 +268,7 @@ func (d *DevOpsConfigurationsServerTransport) dispatchNewListPager(req *http.Req if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { d.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -273,7 +287,7 @@ func (d *DevOpsConfigurationsServerTransport) dispatchBeginUpdate(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.DevOpsConfiguration](req) @@ -301,7 +315,7 @@ func (d *DevOpsConfigurationsServerTransport) dispatchBeginUpdate(req *http.Requ return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { d.beginUpdate.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} } @@ -311,3 +325,9 @@ func (d *DevOpsConfigurationsServerTransport) dispatchBeginUpdate(req *http.Requ return resp, nil } + +// set this to conditionally intercept incoming requests to DevOpsConfigurationsServerTransport +var devOpsConfigurationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/devopsoperationresults_server.go b/sdk/resourcemanager/security/armsecurity/fake/devopsoperationresults_server.go index c3e7af21cb33..34b69d1df9d0 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/devopsoperationresults_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/devopsoperationresults_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // DevOpsOperationResultsServer is a fake server for instances of the armsecurity.DevOpsOperationResultsClient type. @@ -46,21 +46,35 @@ func (d *DevOpsOperationResultsServerTransport) Do(req *http.Request) (*http.Res return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - switch method { - case "DevOpsOperationResultsClient.Get": - resp, err = d.dispatchGet(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DevOpsOperationResultsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if devOpsOperationResultsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = devOpsOperationResultsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DevOpsOperationResultsClient.Get": + res.resp, res.err = d.dispatchGet(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DevOpsOperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -70,7 +84,7 @@ func (d *DevOpsOperationResultsServerTransport) dispatchGet(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -90,7 +104,7 @@ func (d *DevOpsOperationResultsServerTransport) dispatchGet(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatusResult, req) @@ -99,3 +113,9 @@ func (d *DevOpsOperationResultsServerTransport) dispatchGet(req *http.Request) ( } return resp, nil } + +// set this to conditionally intercept incoming requests to DevOpsOperationResultsServerTransport +var devOpsOperationResultsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/discoveredsecuritysolutions_server.go b/sdk/resourcemanager/security/armsecurity/fake/discoveredsecuritysolutions_server.go index e330109a6e05..4aff7e8eecb6 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/discoveredsecuritysolutions_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/discoveredsecuritysolutions_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // DiscoveredSecuritySolutionsServer is a fake server for instances of the armsecurity.DiscoveredSecuritySolutionsClient type. @@ -61,25 +61,39 @@ func (d *DiscoveredSecuritySolutionsServerTransport) Do(req *http.Request) (*htt return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return d.dispatchToMethodFake(req, method) +} - switch method { - case "DiscoveredSecuritySolutionsClient.Get": - resp, err = d.dispatchGet(req) - case "DiscoveredSecuritySolutionsClient.NewListPager": - resp, err = d.dispatchNewListPager(req) - case "DiscoveredSecuritySolutionsClient.NewListByHomeRegionPager": - resp, err = d.dispatchNewListByHomeRegionPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (d *DiscoveredSecuritySolutionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if discoveredSecuritySolutionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = discoveredSecuritySolutionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "DiscoveredSecuritySolutionsClient.Get": + res.resp, res.err = d.dispatchGet(req) + case "DiscoveredSecuritySolutionsClient.NewListPager": + res.resp, res.err = d.dispatchNewListPager(req) + case "DiscoveredSecuritySolutionsClient.NewListByHomeRegionPager": + res.resp, res.err = d.dispatchNewListByHomeRegionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (d *DiscoveredSecuritySolutionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -89,7 +103,7 @@ func (d *DiscoveredSecuritySolutionsServerTransport) dispatchGet(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/discoveredSecuritySolutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -109,7 +123,7 @@ func (d *DiscoveredSecuritySolutionsServerTransport) dispatchGet(req *http.Reque return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).DiscoveredSecuritySolution, req) @@ -128,7 +142,7 @@ func (d *DiscoveredSecuritySolutionsServerTransport) dispatchNewListPager(req *h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/discoveredSecuritySolutions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := d.srv.NewListPager(nil) @@ -142,7 +156,7 @@ func (d *DiscoveredSecuritySolutionsServerTransport) dispatchNewListPager(req *h if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { d.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -161,7 +175,7 @@ func (d *DiscoveredSecuritySolutionsServerTransport) dispatchNewListByHomeRegion const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/discoveredSecuritySolutions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) @@ -179,7 +193,7 @@ func (d *DiscoveredSecuritySolutionsServerTransport) dispatchNewListByHomeRegion if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { d.newListByHomeRegionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -188,3 +202,9 @@ func (d *DiscoveredSecuritySolutionsServerTransport) dispatchNewListByHomeRegion } return resp, nil } + +// set this to conditionally intercept incoming requests to DiscoveredSecuritySolutionsServerTransport +var discoveredSecuritySolutionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/externalsecuritysolutions_server.go b/sdk/resourcemanager/security/armsecurity/fake/externalsecuritysolutions_server.go index 7244b5491eb7..f8f2d33c2fba 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/externalsecuritysolutions_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/externalsecuritysolutions_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ExternalSecuritySolutionsServer is a fake server for instances of the armsecurity.ExternalSecuritySolutionsClient type. @@ -61,25 +61,39 @@ func (e *ExternalSecuritySolutionsServerTransport) Do(req *http.Request) (*http. return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return e.dispatchToMethodFake(req, method) +} - switch method { - case "ExternalSecuritySolutionsClient.Get": - resp, err = e.dispatchGet(req) - case "ExternalSecuritySolutionsClient.NewListPager": - resp, err = e.dispatchNewListPager(req) - case "ExternalSecuritySolutionsClient.NewListByHomeRegionPager": - resp, err = e.dispatchNewListByHomeRegionPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (e *ExternalSecuritySolutionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if externalSecuritySolutionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = externalSecuritySolutionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ExternalSecuritySolutionsClient.Get": + res.resp, res.err = e.dispatchGet(req) + case "ExternalSecuritySolutionsClient.NewListPager": + res.resp, res.err = e.dispatchNewListPager(req) + case "ExternalSecuritySolutionsClient.NewListByHomeRegionPager": + res.resp, res.err = e.dispatchNewListByHomeRegionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (e *ExternalSecuritySolutionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -89,7 +103,7 @@ func (e *ExternalSecuritySolutionsServerTransport) dispatchGet(req *http.Request const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ExternalSecuritySolutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -109,7 +123,7 @@ func (e *ExternalSecuritySolutionsServerTransport) dispatchGet(req *http.Request return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ExternalSecuritySolutionClassification, req) @@ -128,7 +142,7 @@ func (e *ExternalSecuritySolutionsServerTransport) dispatchNewListPager(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/externalSecuritySolutions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := e.srv.NewListPager(nil) @@ -142,7 +156,7 @@ func (e *ExternalSecuritySolutionsServerTransport) dispatchNewListPager(req *htt if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { e.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -161,7 +175,7 @@ func (e *ExternalSecuritySolutionsServerTransport) dispatchNewListByHomeRegionPa const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/ExternalSecuritySolutions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) @@ -179,7 +193,7 @@ func (e *ExternalSecuritySolutionsServerTransport) dispatchNewListByHomeRegionPa if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { e.newListByHomeRegionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -188,3 +202,9 @@ func (e *ExternalSecuritySolutionsServerTransport) dispatchNewListByHomeRegionPa } return resp, nil } + +// set this to conditionally intercept incoming requests to ExternalSecuritySolutionsServerTransport +var externalSecuritySolutionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/githubissues_server.go b/sdk/resourcemanager/security/armsecurity/fake/githubissues_server.go new file mode 100644 index 000000000000..db4dfb28624f --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/fake/githubissues_server.go @@ -0,0 +1,151 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" + "net/http" + "net/url" + "reflect" + "regexp" + "slices" +) + +// GitHubIssuesServer is a fake server for instances of the armsecurity.GitHubIssuesClient type. +type GitHubIssuesServer struct { + // BeginCreate is the fake for method GitHubIssuesClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginCreate func(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, repoName string, options *armsecurity.GitHubIssuesClientBeginCreateOptions) (resp azfake.PollerResponder[armsecurity.GitHubIssuesClientCreateResponse], errResp azfake.ErrorResponder) +} + +// NewGitHubIssuesServerTransport creates a new instance of GitHubIssuesServerTransport with the provided implementation. +// The returned GitHubIssuesServerTransport instance is connected to an instance of armsecurity.GitHubIssuesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewGitHubIssuesServerTransport(srv *GitHubIssuesServer) *GitHubIssuesServerTransport { + return &GitHubIssuesServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armsecurity.GitHubIssuesClientCreateResponse]](), + } +} + +// GitHubIssuesServerTransport connects instances of armsecurity.GitHubIssuesClient to instances of GitHubIssuesServer. +// Don't use this type directly, use NewGitHubIssuesServerTransport instead. +type GitHubIssuesServerTransport struct { + srv *GitHubIssuesServer + beginCreate *tracker[azfake.PollerResponder[armsecurity.GitHubIssuesClientCreateResponse]] +} + +// Do implements the policy.Transporter interface for GitHubIssuesServerTransport. +func (g *GitHubIssuesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return g.dispatchToMethodFake(req, method) +} + +func (g *GitHubIssuesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if gitHubIssuesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = gitHubIssuesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "GitHubIssuesClient.BeginCreate": + res.resp, res.err = g.dispatchBeginCreate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (g *GitHubIssuesServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if g.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := g.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/gitHubOwners/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/repos/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/issues` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 6 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurity.IssueCreationRequest](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + securityConnectorNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("securityConnectorName")]) + if err != nil { + return nil, err + } + ownerNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("ownerName")]) + if err != nil { + return nil, err + } + repoNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("repoName")]) + if err != nil { + return nil, err + } + var options *armsecurity.GitHubIssuesClientBeginCreateOptions + if !reflect.ValueOf(body).IsZero() { + options = &armsecurity.GitHubIssuesClientBeginCreateOptions{ + CreateIssueRequest: &body, + } + } + respr, errRespr := g.srv.BeginCreate(req.Context(), resourceGroupNameParam, securityConnectorNameParam, ownerNameParam, repoNameParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + g.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + g.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + g.beginCreate.remove(req) + } + + return resp, nil +} + +// set this to conditionally intercept incoming requests to GitHubIssuesServerTransport +var gitHubIssuesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/githubowners_server.go b/sdk/resourcemanager/security/armsecurity/fake/githubowners_server.go index af64bf3346aa..4dbe4340a338 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/githubowners_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/githubowners_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // GitHubOwnersServer is a fake server for instances of the armsecurity.GitHubOwnersClient type. @@ -59,25 +59,39 @@ func (g *GitHubOwnersServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return g.dispatchToMethodFake(req, method) +} - switch method { - case "GitHubOwnersClient.Get": - resp, err = g.dispatchGet(req) - case "GitHubOwnersClient.NewListPager": - resp, err = g.dispatchNewListPager(req) - case "GitHubOwnersClient.ListAvailable": - resp, err = g.dispatchListAvailable(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (g *GitHubOwnersServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if gitHubOwnersServerTransportInterceptor != nil { + res.resp, res.err, intercepted = gitHubOwnersServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "GitHubOwnersClient.Get": + res.resp, res.err = g.dispatchGet(req) + case "GitHubOwnersClient.NewListPager": + res.resp, res.err = g.dispatchNewListPager(req) + case "GitHubOwnersClient.ListAvailable": + res.resp, res.err = g.dispatchListAvailable(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (g *GitHubOwnersServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -87,7 +101,7 @@ func (g *GitHubOwnersServerTransport) dispatchGet(req *http.Request) (*http.Resp const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/gitHubOwners/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -107,7 +121,7 @@ func (g *GitHubOwnersServerTransport) dispatchGet(req *http.Request) (*http.Resp return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GitHubOwner, req) @@ -126,7 +140,7 @@ func (g *GitHubOwnersServerTransport) dispatchNewListPager(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/gitHubOwners` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -148,7 +162,7 @@ func (g *GitHubOwnersServerTransport) dispatchNewListPager(req *http.Request) (* if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { g.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -165,7 +179,7 @@ func (g *GitHubOwnersServerTransport) dispatchListAvailable(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/listAvailableGitHubOwners` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -181,7 +195,7 @@ func (g *GitHubOwnersServerTransport) dispatchListAvailable(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GitHubOwnerListResponse, req) @@ -190,3 +204,9 @@ func (g *GitHubOwnersServerTransport) dispatchListAvailable(req *http.Request) ( } return resp, nil } + +// set this to conditionally intercept incoming requests to GitHubOwnersServerTransport +var gitHubOwnersServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/githubrepos_server.go b/sdk/resourcemanager/security/armsecurity/fake/githubrepos_server.go index 8f66d4275192..71a0cbfb9f18 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/githubrepos_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/githubrepos_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // GitHubReposServer is a fake server for instances of the armsecurity.GitHubReposClient type. @@ -55,23 +55,37 @@ func (g *GitHubReposServerTransport) Do(req *http.Request) (*http.Response, erro return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return g.dispatchToMethodFake(req, method) +} - switch method { - case "GitHubReposClient.Get": - resp, err = g.dispatchGet(req) - case "GitHubReposClient.NewListPager": - resp, err = g.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (g *GitHubReposServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if gitHubReposServerTransportInterceptor != nil { + res.resp, res.err, intercepted = gitHubReposServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "GitHubReposClient.Get": + res.resp, res.err = g.dispatchGet(req) + case "GitHubReposClient.NewListPager": + res.resp, res.err = g.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (g *GitHubReposServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -81,7 +95,7 @@ func (g *GitHubReposServerTransport) dispatchGet(req *http.Request) (*http.Respo const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/gitHubOwners/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/repos/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -105,7 +119,7 @@ func (g *GitHubReposServerTransport) dispatchGet(req *http.Request) (*http.Respo return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GitHubRepository, req) @@ -124,7 +138,7 @@ func (g *GitHubReposServerTransport) dispatchNewListPager(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/gitHubOwners/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/repos` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -150,7 +164,7 @@ func (g *GitHubReposServerTransport) dispatchNewListPager(req *http.Request) (*h if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { g.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -159,3 +173,9 @@ func (g *GitHubReposServerTransport) dispatchNewListPager(req *http.Request) (*h } return resp, nil } + +// set this to conditionally intercept incoming requests to GitHubReposServerTransport +var gitHubReposServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/gitlabgroups_server.go b/sdk/resourcemanager/security/armsecurity/fake/gitlabgroups_server.go index 702d8906663d..ca7e12b2ce71 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/gitlabgroups_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/gitlabgroups_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // GitLabGroupsServer is a fake server for instances of the armsecurity.GitLabGroupsClient type. @@ -59,25 +59,39 @@ func (g *GitLabGroupsServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return g.dispatchToMethodFake(req, method) +} - switch method { - case "GitLabGroupsClient.Get": - resp, err = g.dispatchGet(req) - case "GitLabGroupsClient.NewListPager": - resp, err = g.dispatchNewListPager(req) - case "GitLabGroupsClient.ListAvailable": - resp, err = g.dispatchListAvailable(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (g *GitLabGroupsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if gitLabGroupsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = gitLabGroupsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "GitLabGroupsClient.Get": + res.resp, res.err = g.dispatchGet(req) + case "GitLabGroupsClient.NewListPager": + res.resp, res.err = g.dispatchNewListPager(req) + case "GitLabGroupsClient.ListAvailable": + res.resp, res.err = g.dispatchListAvailable(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (g *GitLabGroupsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -87,7 +101,7 @@ func (g *GitLabGroupsServerTransport) dispatchGet(req *http.Request) (*http.Resp const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/gitLabGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -107,7 +121,7 @@ func (g *GitLabGroupsServerTransport) dispatchGet(req *http.Request) (*http.Resp return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GitLabGroup, req) @@ -126,7 +140,7 @@ func (g *GitLabGroupsServerTransport) dispatchNewListPager(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/gitLabGroups` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -148,7 +162,7 @@ func (g *GitLabGroupsServerTransport) dispatchNewListPager(req *http.Request) (* if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { g.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -165,7 +179,7 @@ func (g *GitLabGroupsServerTransport) dispatchListAvailable(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/listAvailableGitLabGroups` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -181,7 +195,7 @@ func (g *GitLabGroupsServerTransport) dispatchListAvailable(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GitLabGroupListResponse, req) @@ -190,3 +204,9 @@ func (g *GitLabGroupsServerTransport) dispatchListAvailable(req *http.Request) ( } return resp, nil } + +// set this to conditionally intercept incoming requests to GitLabGroupsServerTransport +var gitLabGroupsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/gitlabprojects_server.go b/sdk/resourcemanager/security/armsecurity/fake/gitlabprojects_server.go index c137e2ba9675..88abcacc3f7b 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/gitlabprojects_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/gitlabprojects_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // GitLabProjectsServer is a fake server for instances of the armsecurity.GitLabProjectsClient type. @@ -55,23 +55,37 @@ func (g *GitLabProjectsServerTransport) Do(req *http.Request) (*http.Response, e return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return g.dispatchToMethodFake(req, method) +} - switch method { - case "GitLabProjectsClient.Get": - resp, err = g.dispatchGet(req) - case "GitLabProjectsClient.NewListPager": - resp, err = g.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (g *GitLabProjectsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if gitLabProjectsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = gitLabProjectsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "GitLabProjectsClient.Get": + res.resp, res.err = g.dispatchGet(req) + case "GitLabProjectsClient.NewListPager": + res.resp, res.err = g.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (g *GitLabProjectsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -81,7 +95,7 @@ func (g *GitLabProjectsServerTransport) dispatchGet(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/gitLabGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -105,7 +119,7 @@ func (g *GitLabProjectsServerTransport) dispatchGet(req *http.Request) (*http.Re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GitLabProject, req) @@ -124,7 +138,7 @@ func (g *GitLabProjectsServerTransport) dispatchNewListPager(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/gitLabGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/projects` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -150,7 +164,7 @@ func (g *GitLabProjectsServerTransport) dispatchNewListPager(req *http.Request) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { g.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -159,3 +173,9 @@ func (g *GitLabProjectsServerTransport) dispatchNewListPager(req *http.Request) } return resp, nil } + +// set this to conditionally intercept incoming requests to GitLabProjectsServerTransport +var gitLabProjectsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/gitlabsubgroups_server.go b/sdk/resourcemanager/security/armsecurity/fake/gitlabsubgroups_server.go index 9c236c402283..dc1b770bbd1e 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/gitlabsubgroups_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/gitlabsubgroups_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // GitLabSubgroupsServer is a fake server for instances of the armsecurity.GitLabSubgroupsClient type. @@ -46,21 +46,35 @@ func (g *GitLabSubgroupsServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return g.dispatchToMethodFake(req, method) +} - switch method { - case "GitLabSubgroupsClient.List": - resp, err = g.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (g *GitLabSubgroupsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if gitLabSubgroupsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = gitLabSubgroupsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "GitLabSubgroupsClient.List": + res.resp, res.err = g.dispatchList(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (g *GitLabSubgroupsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { @@ -70,7 +84,7 @@ func (g *GitLabSubgroupsServerTransport) dispatchList(req *http.Request) (*http. const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityConnectors/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/devops/default/gitLabGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/listSubgroups` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -90,7 +104,7 @@ func (g *GitLabSubgroupsServerTransport) dispatchList(req *http.Request) (*http. return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GitLabGroupListResponse, req) @@ -99,3 +113,9 @@ func (g *GitLabSubgroupsServerTransport) dispatchList(req *http.Request) (*http. } return resp, nil } + +// set this to conditionally intercept incoming requests to GitLabSubgroupsServerTransport +var gitLabSubgroupsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/governanceassignments_server.go b/sdk/resourcemanager/security/armsecurity/fake/governanceassignments_server.go index 80a726337920..ac635ed45fe8 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/governanceassignments_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/governanceassignments_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // GovernanceAssignmentsServer is a fake server for instances of the armsecurity.GovernanceAssignmentsClient type. @@ -63,27 +63,41 @@ func (g *GovernanceAssignmentsServerTransport) Do(req *http.Request) (*http.Resp return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return g.dispatchToMethodFake(req, method) +} - switch method { - case "GovernanceAssignmentsClient.CreateOrUpdate": - resp, err = g.dispatchCreateOrUpdate(req) - case "GovernanceAssignmentsClient.Delete": - resp, err = g.dispatchDelete(req) - case "GovernanceAssignmentsClient.Get": - resp, err = g.dispatchGet(req) - case "GovernanceAssignmentsClient.NewListPager": - resp, err = g.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (g *GovernanceAssignmentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if governanceAssignmentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = governanceAssignmentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "GovernanceAssignmentsClient.CreateOrUpdate": + res.resp, res.err = g.dispatchCreateOrUpdate(req) + case "GovernanceAssignmentsClient.Delete": + res.resp, res.err = g.dispatchDelete(req) + case "GovernanceAssignmentsClient.Get": + res.resp, res.err = g.dispatchGet(req) + case "GovernanceAssignmentsClient.NewListPager": + res.resp, res.err = g.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (g *GovernanceAssignmentsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -93,7 +107,7 @@ func (g *GovernanceAssignmentsServerTransport) dispatchCreateOrUpdate(req *http. const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/governanceAssignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.GovernanceAssignment](req) @@ -117,7 +131,7 @@ func (g *GovernanceAssignmentsServerTransport) dispatchCreateOrUpdate(req *http. return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GovernanceAssignment, req) @@ -134,7 +148,7 @@ func (g *GovernanceAssignmentsServerTransport) dispatchDelete(req *http.Request) const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/governanceAssignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -154,7 +168,7 @@ func (g *GovernanceAssignmentsServerTransport) dispatchDelete(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -171,7 +185,7 @@ func (g *GovernanceAssignmentsServerTransport) dispatchGet(req *http.Request) (* const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/governanceAssignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -191,7 +205,7 @@ func (g *GovernanceAssignmentsServerTransport) dispatchGet(req *http.Request) (* return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GovernanceAssignment, req) @@ -210,7 +224,7 @@ func (g *GovernanceAssignmentsServerTransport) dispatchNewListPager(req *http.Re const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/governanceAssignments` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -232,7 +246,7 @@ func (g *GovernanceAssignmentsServerTransport) dispatchNewListPager(req *http.Re if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { g.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -241,3 +255,9 @@ func (g *GovernanceAssignmentsServerTransport) dispatchNewListPager(req *http.Re } return resp, nil } + +// set this to conditionally intercept incoming requests to GovernanceAssignmentsServerTransport +var governanceAssignmentsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/governancerules_server.go b/sdk/resourcemanager/security/armsecurity/fake/governancerules_server.go index b67ecb9e6a95..19177768a06f 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/governancerules_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/governancerules_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -18,6 +17,7 @@ import ( "net/url" "reflect" "regexp" + "slices" ) // GovernanceRulesServer is a fake server for instances of the armsecurity.GovernanceRulesClient type. @@ -31,7 +31,7 @@ type GovernanceRulesServer struct { BeginDelete func(ctx context.Context, scope string, ruleID string, options *armsecurity.GovernanceRulesClientBeginDeleteOptions) (resp azfake.PollerResponder[armsecurity.GovernanceRulesClientDeleteResponse], errResp azfake.ErrorResponder) // BeginExecute is the fake for method GovernanceRulesClient.BeginExecute - // HTTP status codes to indicate success: http.StatusAccepted + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent BeginExecute func(ctx context.Context, scope string, ruleID string, options *armsecurity.GovernanceRulesClientBeginExecuteOptions) (resp azfake.PollerResponder[armsecurity.GovernanceRulesClientExecuteResponse], errResp azfake.ErrorResponder) // Get is the fake for method GovernanceRulesClient.Get @@ -76,31 +76,45 @@ func (g *GovernanceRulesServerTransport) Do(req *http.Request) (*http.Response, return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return g.dispatchToMethodFake(req, method) +} - switch method { - case "GovernanceRulesClient.CreateOrUpdate": - resp, err = g.dispatchCreateOrUpdate(req) - case "GovernanceRulesClient.BeginDelete": - resp, err = g.dispatchBeginDelete(req) - case "GovernanceRulesClient.BeginExecute": - resp, err = g.dispatchBeginExecute(req) - case "GovernanceRulesClient.Get": - resp, err = g.dispatchGet(req) - case "GovernanceRulesClient.NewListPager": - resp, err = g.dispatchNewListPager(req) - case "GovernanceRulesClient.OperationResults": - resp, err = g.dispatchOperationResults(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (g *GovernanceRulesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if governanceRulesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = governanceRulesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "GovernanceRulesClient.CreateOrUpdate": + res.resp, res.err = g.dispatchCreateOrUpdate(req) + case "GovernanceRulesClient.BeginDelete": + res.resp, res.err = g.dispatchBeginDelete(req) + case "GovernanceRulesClient.BeginExecute": + res.resp, res.err = g.dispatchBeginExecute(req) + case "GovernanceRulesClient.Get": + res.resp, res.err = g.dispatchGet(req) + case "GovernanceRulesClient.NewListPager": + res.resp, res.err = g.dispatchNewListPager(req) + case "GovernanceRulesClient.OperationResults": + res.resp, res.err = g.dispatchOperationResults(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (g *GovernanceRulesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -110,7 +124,7 @@ func (g *GovernanceRulesServerTransport) dispatchCreateOrUpdate(req *http.Reques const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/governanceRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.GovernanceRule](req) @@ -130,7 +144,7 @@ func (g *GovernanceRulesServerTransport) dispatchCreateOrUpdate(req *http.Reques return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GovernanceRule, req) @@ -149,7 +163,7 @@ func (g *GovernanceRulesServerTransport) dispatchBeginDelete(req *http.Request) const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/governanceRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -173,7 +187,7 @@ func (g *GovernanceRulesServerTransport) dispatchBeginDelete(req *http.Request) return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { g.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -193,7 +207,7 @@ func (g *GovernanceRulesServerTransport) dispatchBeginExecute(req *http.Request) const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/governanceRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/execute` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.ExecuteGovernanceRuleParams](req) @@ -227,9 +241,9 @@ func (g *GovernanceRulesServerTransport) dispatchBeginExecute(req *http.Request) return nil, err } - if !contains([]int{http.StatusAccepted}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { g.beginExecute.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", resp.StatusCode)} + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } if !server.PollerResponderMore(beginExecute) { g.beginExecute.remove(req) @@ -245,7 +259,7 @@ func (g *GovernanceRulesServerTransport) dispatchGet(req *http.Request) (*http.R const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/governanceRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -261,7 +275,7 @@ func (g *GovernanceRulesServerTransport) dispatchGet(req *http.Request) (*http.R return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GovernanceRule, req) @@ -280,7 +294,7 @@ func (g *GovernanceRulesServerTransport) dispatchNewListPager(req *http.Request) const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/governanceRules` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -298,7 +312,7 @@ func (g *GovernanceRulesServerTransport) dispatchNewListPager(req *http.Request) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { g.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -315,7 +329,7 @@ func (g *GovernanceRulesServerTransport) dispatchOperationResults(req *http.Requ const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/governanceRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -335,15 +349,21 @@ func (g *GovernanceRulesServerTransport) dispatchOperationResults(req *http.Requ return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusAccepted}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationResultAutoGenerated, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationResult, req) if err != nil { return nil, err } if val := server.GetResponse(respr).Location; val != nil { - resp.Header.Set("location", *val) + resp.Header.Set("Location", *val) } return resp, nil } + +// set this to conditionally intercept incoming requests to GovernanceRulesServerTransport +var governanceRulesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/healthreports_server.go b/sdk/resourcemanager/security/armsecurity/fake/healthreports_server.go index 9414ef025555..9a23c7a121ca 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/healthreports_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/healthreports_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // HealthReportsServer is a fake server for instances of the armsecurity.HealthReportsClient type. @@ -55,23 +55,37 @@ func (h *HealthReportsServerTransport) Do(req *http.Request) (*http.Response, er return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return h.dispatchToMethodFake(req, method) +} - switch method { - case "HealthReportsClient.Get": - resp, err = h.dispatchGet(req) - case "HealthReportsClient.NewListPager": - resp, err = h.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (h *HealthReportsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if healthReportsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = healthReportsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "HealthReportsClient.Get": + res.resp, res.err = h.dispatchGet(req) + case "HealthReportsClient.NewListPager": + res.resp, res.err = h.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (h *HealthReportsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -81,7 +95,7 @@ func (h *HealthReportsServerTransport) dispatchGet(req *http.Request) (*http.Res const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/healthReports/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) @@ -97,7 +111,7 @@ func (h *HealthReportsServerTransport) dispatchGet(req *http.Request) (*http.Res return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).HealthReport, req) @@ -116,7 +130,7 @@ func (h *HealthReportsServerTransport) dispatchNewListPager(req *http.Request) ( const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/healthReports` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -134,7 +148,7 @@ func (h *HealthReportsServerTransport) dispatchNewListPager(req *http.Request) ( if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { h.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -143,3 +157,9 @@ func (h *HealthReportsServerTransport) dispatchNewListPager(req *http.Request) ( } return resp, nil } + +// set this to conditionally intercept incoming requests to HealthReportsServerTransport +var healthReportsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/informationprotectionpolicies_server.go b/sdk/resourcemanager/security/armsecurity/fake/informationprotectionpolicies_server.go index 06dabc319cdf..13ee0c8aefe8 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/informationprotectionpolicies_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/informationprotectionpolicies_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // InformationProtectionPoliciesServer is a fake server for instances of the armsecurity.InformationProtectionPoliciesClient type. @@ -59,25 +59,39 @@ func (i *InformationProtectionPoliciesServerTransport) Do(req *http.Request) (*h return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return i.dispatchToMethodFake(req, method) +} - switch method { - case "InformationProtectionPoliciesClient.CreateOrUpdate": - resp, err = i.dispatchCreateOrUpdate(req) - case "InformationProtectionPoliciesClient.Get": - resp, err = i.dispatchGet(req) - case "InformationProtectionPoliciesClient.NewListPager": - resp, err = i.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (i *InformationProtectionPoliciesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if informationProtectionPoliciesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = informationProtectionPoliciesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "InformationProtectionPoliciesClient.CreateOrUpdate": + res.resp, res.err = i.dispatchCreateOrUpdate(req) + case "InformationProtectionPoliciesClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "InformationProtectionPoliciesClient.NewListPager": + res.resp, res.err = i.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (i *InformationProtectionPoliciesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -87,7 +101,7 @@ func (i *InformationProtectionPoliciesServerTransport) dispatchCreateOrUpdate(re const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/informationProtectionPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.InformationProtectionPolicy](req) @@ -113,7 +127,7 @@ func (i *InformationProtectionPoliciesServerTransport) dispatchCreateOrUpdate(re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).InformationProtectionPolicy, req) @@ -130,7 +144,7 @@ func (i *InformationProtectionPoliciesServerTransport) dispatchGet(req *http.Req const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/informationProtectionPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -152,7 +166,7 @@ func (i *InformationProtectionPoliciesServerTransport) dispatchGet(req *http.Req return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).InformationProtectionPolicy, req) @@ -171,7 +185,7 @@ func (i *InformationProtectionPoliciesServerTransport) dispatchNewListPager(req const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/informationProtectionPolicies` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -189,7 +203,7 @@ func (i *InformationProtectionPoliciesServerTransport) dispatchNewListPager(req if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { i.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -198,3 +212,9 @@ func (i *InformationProtectionPoliciesServerTransport) dispatchNewListPager(req } return resp, nil } + +// set this to conditionally intercept incoming requests to InformationProtectionPoliciesServerTransport +var informationProtectionPoliciesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/internal.go b/sdk/resourcemanager/security/armsecurity/fake/internal.go index 51d3197a56bd..362783fbf559 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/internal.go +++ b/sdk/resourcemanager/security/armsecurity/fake/internal.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -13,6 +12,11 @@ import ( "sync" ) +type result struct { + resp *http.Response + err error +} + type nonRetriableError struct { error } @@ -21,15 +25,6 @@ func (nonRetriableError) NonRetriable() { // marker method } -func contains[T comparable](s []T, v T) bool { - for _, vv := range s { - if vv == v { - return true - } - } - return false -} - func getOptional[T any](v T) *T { if reflect.ValueOf(v).IsZero() { return nil @@ -37,6 +32,14 @@ func getOptional[T any](v T) *T { return &v } +func initServer[T any](mu *sync.Mutex, dst **T, src func() *T) { + mu.Lock() + if *dst == nil { + *dst = src() + } + mu.Unlock() +} + func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) { if v == "" { return nil, nil @@ -45,7 +48,7 @@ func parseOptional[T any](v string, parse func(v string) (T, error)) (*T, error) if err != nil { return nil, err } - return &t, err + return &t, nil } func parseWithCast[T any](v string, parse func(v string) (T, error)) (T, error) { diff --git a/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolution_server.go b/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolution_server.go index 47844386407c..f0db93661efe 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolution_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolution_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // IotSecuritySolutionServer is a fake server for instances of the armsecurity.IotSecuritySolutionClient type. @@ -73,31 +73,45 @@ func (i *IotSecuritySolutionServerTransport) Do(req *http.Request) (*http.Respon return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return i.dispatchToMethodFake(req, method) +} - switch method { - case "IotSecuritySolutionClient.CreateOrUpdate": - resp, err = i.dispatchCreateOrUpdate(req) - case "IotSecuritySolutionClient.Delete": - resp, err = i.dispatchDelete(req) - case "IotSecuritySolutionClient.Get": - resp, err = i.dispatchGet(req) - case "IotSecuritySolutionClient.NewListByResourceGroupPager": - resp, err = i.dispatchNewListByResourceGroupPager(req) - case "IotSecuritySolutionClient.NewListBySubscriptionPager": - resp, err = i.dispatchNewListBySubscriptionPager(req) - case "IotSecuritySolutionClient.Update": - resp, err = i.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (i *IotSecuritySolutionServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if iotSecuritySolutionServerTransportInterceptor != nil { + res.resp, res.err, intercepted = iotSecuritySolutionServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "IotSecuritySolutionClient.CreateOrUpdate": + res.resp, res.err = i.dispatchCreateOrUpdate(req) + case "IotSecuritySolutionClient.Delete": + res.resp, res.err = i.dispatchDelete(req) + case "IotSecuritySolutionClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "IotSecuritySolutionClient.NewListByResourceGroupPager": + res.resp, res.err = i.dispatchNewListByResourceGroupPager(req) + case "IotSecuritySolutionClient.NewListBySubscriptionPager": + res.resp, res.err = i.dispatchNewListBySubscriptionPager(req) + case "IotSecuritySolutionClient.Update": + res.resp, res.err = i.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (i *IotSecuritySolutionServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -107,7 +121,7 @@ func (i *IotSecuritySolutionServerTransport) dispatchCreateOrUpdate(req *http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/iotSecuritySolutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.IoTSecuritySolutionModel](req) @@ -127,7 +141,7 @@ func (i *IotSecuritySolutionServerTransport) dispatchCreateOrUpdate(req *http.Re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).IoTSecuritySolutionModel, req) @@ -144,7 +158,7 @@ func (i *IotSecuritySolutionServerTransport) dispatchDelete(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/iotSecuritySolutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -160,7 +174,7 @@ func (i *IotSecuritySolutionServerTransport) dispatchDelete(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -177,7 +191,7 @@ func (i *IotSecuritySolutionServerTransport) dispatchGet(req *http.Request) (*ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/iotSecuritySolutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -193,7 +207,7 @@ func (i *IotSecuritySolutionServerTransport) dispatchGet(req *http.Request) (*ht return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).IoTSecuritySolutionModel, req) @@ -212,7 +226,7 @@ func (i *IotSecuritySolutionServerTransport) dispatchNewListByResourceGroupPager const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/iotSecuritySolutions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -220,11 +234,7 @@ func (i *IotSecuritySolutionServerTransport) dispatchNewListByResourceGroupPager if err != nil { return nil, err } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) + filterParam := getOptional(qp.Get("$filter")) var options *armsecurity.IotSecuritySolutionClientListByResourceGroupOptions if filterParam != nil { options = &armsecurity.IotSecuritySolutionClientListByResourceGroupOptions{ @@ -242,7 +252,7 @@ func (i *IotSecuritySolutionServerTransport) dispatchNewListByResourceGroupPager if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { i.newListByResourceGroupPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -261,15 +271,11 @@ func (i *IotSecuritySolutionServerTransport) dispatchNewListBySubscriptionPager( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/iotSecuritySolutions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) + filterParam := getOptional(qp.Get("$filter")) var options *armsecurity.IotSecuritySolutionClientListBySubscriptionOptions if filterParam != nil { options = &armsecurity.IotSecuritySolutionClientListBySubscriptionOptions{ @@ -287,7 +293,7 @@ func (i *IotSecuritySolutionServerTransport) dispatchNewListBySubscriptionPager( if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { i.newListBySubscriptionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -304,7 +310,7 @@ func (i *IotSecuritySolutionServerTransport) dispatchUpdate(req *http.Request) ( const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/iotSecuritySolutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.UpdateIotSecuritySolutionData](req) @@ -324,7 +330,7 @@ func (i *IotSecuritySolutionServerTransport) dispatchUpdate(req *http.Request) ( return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).IoTSecuritySolutionModel, req) @@ -333,3 +339,9 @@ func (i *IotSecuritySolutionServerTransport) dispatchUpdate(req *http.Request) ( } return resp, nil } + +// set this to conditionally intercept incoming requests to IotSecuritySolutionServerTransport +var iotSecuritySolutionServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionanalytics_server.go b/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionanalytics_server.go index eabbafa5b995..bb57815aa42a 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionanalytics_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionanalytics_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // IotSecuritySolutionAnalyticsServer is a fake server for instances of the armsecurity.IotSecuritySolutionAnalyticsClient type. @@ -50,23 +50,37 @@ func (i *IotSecuritySolutionAnalyticsServerTransport) Do(req *http.Request) (*ht return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return i.dispatchToMethodFake(req, method) +} - switch method { - case "IotSecuritySolutionAnalyticsClient.Get": - resp, err = i.dispatchGet(req) - case "IotSecuritySolutionAnalyticsClient.List": - resp, err = i.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (i *IotSecuritySolutionAnalyticsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if iotSecuritySolutionAnalyticsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = iotSecuritySolutionAnalyticsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "IotSecuritySolutionAnalyticsClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "IotSecuritySolutionAnalyticsClient.List": + res.resp, res.err = i.dispatchList(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (i *IotSecuritySolutionAnalyticsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -76,7 +90,7 @@ func (i *IotSecuritySolutionAnalyticsServerTransport) dispatchGet(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/iotSecuritySolutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/analyticsModels/default` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -92,7 +106,7 @@ func (i *IotSecuritySolutionAnalyticsServerTransport) dispatchGet(req *http.Requ return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).IoTSecuritySolutionAnalyticsModel, req) @@ -109,7 +123,7 @@ func (i *IotSecuritySolutionAnalyticsServerTransport) dispatchList(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/iotSecuritySolutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/analyticsModels` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -125,7 +139,7 @@ func (i *IotSecuritySolutionAnalyticsServerTransport) dispatchList(req *http.Req return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).IoTSecuritySolutionAnalyticsModelList, req) @@ -134,3 +148,9 @@ func (i *IotSecuritySolutionAnalyticsServerTransport) dispatchList(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to IotSecuritySolutionAnalyticsServerTransport +var iotSecuritySolutionAnalyticsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionsanalyticsaggregatedalert_server.go b/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionsanalyticsaggregatedalert_server.go index 0018dbc08e0c..935f6b5ec38c 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionsanalyticsaggregatedalert_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionsanalyticsaggregatedalert_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" "strconv" ) @@ -60,25 +60,39 @@ func (i *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport) Do(req *ht return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return i.dispatchToMethodFake(req, method) +} - switch method { - case "IotSecuritySolutionsAnalyticsAggregatedAlertClient.Dismiss": - resp, err = i.dispatchDismiss(req) - case "IotSecuritySolutionsAnalyticsAggregatedAlertClient.Get": - resp, err = i.dispatchGet(req) - case "IotSecuritySolutionsAnalyticsAggregatedAlertClient.NewListPager": - resp, err = i.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (i *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if iotSecuritySolutionsAnalyticsAggregatedAlertServerTransportInterceptor != nil { + res.resp, res.err, intercepted = iotSecuritySolutionsAnalyticsAggregatedAlertServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "IotSecuritySolutionsAnalyticsAggregatedAlertClient.Dismiss": + res.resp, res.err = i.dispatchDismiss(req) + case "IotSecuritySolutionsAnalyticsAggregatedAlertClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "IotSecuritySolutionsAnalyticsAggregatedAlertClient.NewListPager": + res.resp, res.err = i.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (i *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport) dispatchDismiss(req *http.Request) (*http.Response, error) { @@ -88,7 +102,7 @@ func (i *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport) dispatchDi const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/iotSecuritySolutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/analyticsModels/default/aggregatedAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/dismiss` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -108,7 +122,7 @@ func (i *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport) dispatchDi return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -125,7 +139,7 @@ func (i *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport) dispatchGe const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/iotSecuritySolutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/analyticsModels/default/aggregatedAlerts/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -145,7 +159,7 @@ func (i *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport) dispatchGe return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).IoTSecurityAggregatedAlert, req) @@ -164,7 +178,7 @@ func (i *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport) dispatchNe const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/iotSecuritySolutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/analyticsModels/default/aggregatedAlerts` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -176,11 +190,7 @@ func (i *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport) dispatchNe if err != nil { return nil, err } - topUnescaped, err := url.QueryUnescape(qp.Get("$top")) - if err != nil { - return nil, err - } - topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + topParam, err := parseOptional(qp.Get("$top"), func(v string) (int32, error) { p, parseErr := strconv.ParseInt(v, 10, 32) if parseErr != nil { return 0, parseErr @@ -207,7 +217,7 @@ func (i *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport) dispatchNe if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { i.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -216,3 +226,9 @@ func (i *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport) dispatchNe } return resp, nil } + +// set this to conditionally intercept incoming requests to IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport +var iotSecuritySolutionsAnalyticsAggregatedAlertServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionsanalyticsrecommendation_server.go b/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionsanalyticsrecommendation_server.go index f2be25572968..e961f177f413 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionsanalyticsrecommendation_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/iotsecuritysolutionsanalyticsrecommendation_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" "strconv" ) @@ -56,23 +56,37 @@ func (i *IotSecuritySolutionsAnalyticsRecommendationServerTransport) Do(req *htt return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return i.dispatchToMethodFake(req, method) +} - switch method { - case "IotSecuritySolutionsAnalyticsRecommendationClient.Get": - resp, err = i.dispatchGet(req) - case "IotSecuritySolutionsAnalyticsRecommendationClient.NewListPager": - resp, err = i.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (i *IotSecuritySolutionsAnalyticsRecommendationServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if iotSecuritySolutionsAnalyticsRecommendationServerTransportInterceptor != nil { + res.resp, res.err, intercepted = iotSecuritySolutionsAnalyticsRecommendationServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "IotSecuritySolutionsAnalyticsRecommendationClient.Get": + res.resp, res.err = i.dispatchGet(req) + case "IotSecuritySolutionsAnalyticsRecommendationClient.NewListPager": + res.resp, res.err = i.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (i *IotSecuritySolutionsAnalyticsRecommendationServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -82,7 +96,7 @@ func (i *IotSecuritySolutionsAnalyticsRecommendationServerTransport) dispatchGet const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/iotSecuritySolutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/analyticsModels/default/aggregatedRecommendations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -102,7 +116,7 @@ func (i *IotSecuritySolutionsAnalyticsRecommendationServerTransport) dispatchGet return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).IoTSecurityAggregatedRecommendation, req) @@ -121,7 +135,7 @@ func (i *IotSecuritySolutionsAnalyticsRecommendationServerTransport) dispatchNew const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/iotSecuritySolutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/analyticsModels/default/aggregatedRecommendations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -133,11 +147,7 @@ func (i *IotSecuritySolutionsAnalyticsRecommendationServerTransport) dispatchNew if err != nil { return nil, err } - topUnescaped, err := url.QueryUnescape(qp.Get("$top")) - if err != nil { - return nil, err - } - topParam, err := parseOptional(topUnescaped, func(v string) (int32, error) { + topParam, err := parseOptional(qp.Get("$top"), func(v string) (int32, error) { p, parseErr := strconv.ParseInt(v, 10, 32) if parseErr != nil { return 0, parseErr @@ -164,7 +174,7 @@ func (i *IotSecuritySolutionsAnalyticsRecommendationServerTransport) dispatchNew if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { i.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -173,3 +183,9 @@ func (i *IotSecuritySolutionsAnalyticsRecommendationServerTransport) dispatchNew } return resp, nil } + +// set this to conditionally intercept incoming requests to IotSecuritySolutionsAnalyticsRecommendationServerTransport +var iotSecuritySolutionsAnalyticsRecommendationServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/jitnetworkaccesspolicies_server.go b/sdk/resourcemanager/security/armsecurity/fake/jitnetworkaccesspolicies_server.go index aac66fc2f796..49c157d1c07f 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/jitnetworkaccesspolicies_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/jitnetworkaccesspolicies_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // JitNetworkAccessPoliciesServer is a fake server for instances of the armsecurity.JitNetworkAccessPoliciesClient type. @@ -85,35 +85,49 @@ func (j *JitNetworkAccessPoliciesServerTransport) Do(req *http.Request) (*http.R return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return j.dispatchToMethodFake(req, method) +} - switch method { - case "JitNetworkAccessPoliciesClient.CreateOrUpdate": - resp, err = j.dispatchCreateOrUpdate(req) - case "JitNetworkAccessPoliciesClient.Delete": - resp, err = j.dispatchDelete(req) - case "JitNetworkAccessPoliciesClient.Get": - resp, err = j.dispatchGet(req) - case "JitNetworkAccessPoliciesClient.Initiate": - resp, err = j.dispatchInitiate(req) - case "JitNetworkAccessPoliciesClient.NewListPager": - resp, err = j.dispatchNewListPager(req) - case "JitNetworkAccessPoliciesClient.NewListByRegionPager": - resp, err = j.dispatchNewListByRegionPager(req) - case "JitNetworkAccessPoliciesClient.NewListByResourceGroupPager": - resp, err = j.dispatchNewListByResourceGroupPager(req) - case "JitNetworkAccessPoliciesClient.NewListByResourceGroupAndRegionPager": - resp, err = j.dispatchNewListByResourceGroupAndRegionPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (j *JitNetworkAccessPoliciesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if jitNetworkAccessPoliciesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = jitNetworkAccessPoliciesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "JitNetworkAccessPoliciesClient.CreateOrUpdate": + res.resp, res.err = j.dispatchCreateOrUpdate(req) + case "JitNetworkAccessPoliciesClient.Delete": + res.resp, res.err = j.dispatchDelete(req) + case "JitNetworkAccessPoliciesClient.Get": + res.resp, res.err = j.dispatchGet(req) + case "JitNetworkAccessPoliciesClient.Initiate": + res.resp, res.err = j.dispatchInitiate(req) + case "JitNetworkAccessPoliciesClient.NewListPager": + res.resp, res.err = j.dispatchNewListPager(req) + case "JitNetworkAccessPoliciesClient.NewListByRegionPager": + res.resp, res.err = j.dispatchNewListByRegionPager(req) + case "JitNetworkAccessPoliciesClient.NewListByResourceGroupPager": + res.resp, res.err = j.dispatchNewListByResourceGroupPager(req) + case "JitNetworkAccessPoliciesClient.NewListByResourceGroupAndRegionPager": + res.resp, res.err = j.dispatchNewListByResourceGroupAndRegionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (j *JitNetworkAccessPoliciesServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -123,7 +137,7 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchCreateOrUpdate(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jitNetworkAccessPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.JitNetworkAccessPolicy](req) @@ -147,7 +161,7 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchCreateOrUpdate(req *ht return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).JitNetworkAccessPolicy, req) @@ -164,7 +178,7 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchDelete(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jitNetworkAccessPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -184,7 +198,7 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchDelete(req *http.Reque return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -201,7 +215,7 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchGet(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jitNetworkAccessPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -221,7 +235,7 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchGet(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).JitNetworkAccessPolicy, req) @@ -238,7 +252,7 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchInitiate(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jitNetworkAccessPolicies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.JitNetworkAccessPolicyInitiateRequest](req) @@ -262,7 +276,7 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchInitiate(req *http.Req return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusAccepted}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusAccepted}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).JitNetworkAccessRequest, req) @@ -281,7 +295,7 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchNewListPager(req *http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/jitNetworkAccessPolicies` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := j.srv.NewListPager(nil) @@ -295,7 +309,7 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchNewListPager(req *http if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { j.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -314,7 +328,7 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchNewListByRegionPager(r const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jitNetworkAccessPolicies` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) @@ -332,7 +346,7 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchNewListByRegionPager(r if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { j.newListByRegionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -351,7 +365,7 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchNewListByResourceGroup const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/jitNetworkAccessPolicies` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -369,7 +383,7 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchNewListByResourceGroup if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { j.newListByResourceGroupPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -388,7 +402,7 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchNewListByResourceGroup const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/jitNetworkAccessPolicies` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -410,7 +424,7 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchNewListByResourceGroup if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { j.newListByResourceGroupAndRegionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -419,3 +433,9 @@ func (j *JitNetworkAccessPoliciesServerTransport) dispatchNewListByResourceGroup } return resp, nil } + +// set this to conditionally intercept incoming requests to JitNetworkAccessPoliciesServerTransport +var jitNetworkAccessPoliciesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/locations_server.go b/sdk/resourcemanager/security/armsecurity/fake/locations_server.go index 0c7e5b6cd3dd..26d1253f200b 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/locations_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/locations_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // LocationsServer is a fake server for instances of the armsecurity.LocationsClient type. @@ -55,23 +55,37 @@ func (l *LocationsServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return l.dispatchToMethodFake(req, method) +} - switch method { - case "LocationsClient.Get": - resp, err = l.dispatchGet(req) - case "LocationsClient.NewListPager": - resp, err = l.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (l *LocationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if locationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = locationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "LocationsClient.Get": + res.resp, res.err = l.dispatchGet(req) + case "LocationsClient.NewListPager": + res.resp, res.err = l.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (l *LocationsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -81,7 +95,7 @@ func (l *LocationsServerTransport) dispatchGet(req *http.Request) (*http.Respons const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) @@ -93,7 +107,7 @@ func (l *LocationsServerTransport) dispatchGet(req *http.Request) (*http.Respons return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).AscLocation, req) @@ -112,7 +126,7 @@ func (l *LocationsServerTransport) dispatchNewListPager(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := l.srv.NewListPager(nil) @@ -126,7 +140,7 @@ func (l *LocationsServerTransport) dispatchNewListPager(req *http.Request) (*htt if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { l.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -135,3 +149,9 @@ func (l *LocationsServerTransport) dispatchNewListPager(req *http.Request) (*htt } return resp, nil } + +// set this to conditionally intercept incoming requests to LocationsServerTransport +var locationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/mdeonboardings_server.go b/sdk/resourcemanager/security/armsecurity/fake/mdeonboardings_server.go index 57c6597d975c..d081e4e389a4 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/mdeonboardings_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/mdeonboardings_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -15,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" "net/http" "regexp" + "slices" ) // MdeOnboardingsServer is a fake server for instances of the armsecurity.MdeOnboardingsClient type. @@ -49,23 +49,37 @@ func (m *MdeOnboardingsServerTransport) Do(req *http.Request) (*http.Response, e return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return m.dispatchToMethodFake(req, method) +} - switch method { - case "MdeOnboardingsClient.Get": - resp, err = m.dispatchGet(req) - case "MdeOnboardingsClient.List": - resp, err = m.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (m *MdeOnboardingsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if mdeOnboardingsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = mdeOnboardingsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "MdeOnboardingsClient.Get": + res.resp, res.err = m.dispatchGet(req) + case "MdeOnboardingsClient.List": + res.resp, res.err = m.dispatchList(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (m *MdeOnboardingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -75,7 +89,7 @@ func (m *MdeOnboardingsServerTransport) dispatchGet(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/mdeOnboardings/default` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } respr, errRespr := m.srv.Get(req.Context(), nil) @@ -83,7 +97,7 @@ func (m *MdeOnboardingsServerTransport) dispatchGet(req *http.Request) (*http.Re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MdeOnboardingData, req) @@ -100,7 +114,7 @@ func (m *MdeOnboardingsServerTransport) dispatchList(req *http.Request) (*http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/mdeOnboardings` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } respr, errRespr := m.srv.List(req.Context(), nil) @@ -108,7 +122,7 @@ func (m *MdeOnboardingsServerTransport) dispatchList(req *http.Request) (*http.R return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).MdeOnboardingDataList, req) @@ -117,3 +131,9 @@ func (m *MdeOnboardingsServerTransport) dispatchList(req *http.Request) (*http.R } return resp, nil } + +// set this to conditionally intercept incoming requests to MdeOnboardingsServerTransport +var mdeOnboardingsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/operationresults_server.go b/sdk/resourcemanager/security/armsecurity/fake/operationresults_server.go new file mode 100644 index 000000000000..8d12e6a575f4 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/fake/operationresults_server.go @@ -0,0 +1,124 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" + "net/http" + "net/url" + "regexp" + "slices" + "strconv" +) + +// OperationResultsServer is a fake server for instances of the armsecurity.OperationResultsClient type. +type OperationResultsServer struct { + // Get is the fake for method OperationResultsClient.Get + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + Get func(ctx context.Context, location string, operationID string, options *armsecurity.OperationResultsClientGetOptions) (resp azfake.Responder[armsecurity.OperationResultsClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewOperationResultsServerTransport creates a new instance of OperationResultsServerTransport with the provided implementation. +// The returned OperationResultsServerTransport instance is connected to an instance of armsecurity.OperationResultsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationResultsServerTransport(srv *OperationResultsServer) *OperationResultsServerTransport { + return &OperationResultsServerTransport{srv: srv} +} + +// OperationResultsServerTransport connects instances of armsecurity.OperationResultsClient to instances of OperationResultsServer. +// Don't use this type directly, use NewOperationResultsServerTransport instead. +type OperationResultsServerTransport struct { + srv *OperationResultsServer +} + +// Do implements the policy.Transporter interface for OperationResultsServerTransport. +func (o *OperationResultsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OperationResultsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if operationResultsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationResultsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationResultsClient.Get": + res.resp, res.err = o.dispatchGet(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (o *OperationResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if o.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.Get(req.Context(), locationParam, operationIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + if val := server.GetResponse(respr).Location; val != nil { + resp.Header.Set("Location", *val) + } + if val := server.GetResponse(respr).RetryAfter; val != nil { + resp.Header.Set("Retry-After", strconv.FormatInt(int64(*val), 10)) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to OperationResultsServerTransport +var operationResultsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/operations_server.go b/sdk/resourcemanager/security/armsecurity/fake/operations_server.go index c2d9fafe772d..3d31cbcf10bf 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/operations_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/operations_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -14,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" "net/http" + "slices" ) // OperationsServer is a fake server for instances of the armsecurity.OperationsClient type. @@ -48,21 +48,35 @@ func (o *OperationsServerTransport) Do(req *http.Request) (*http.Response, error return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return o.dispatchToMethodFake(req, method) +} - switch method { - case "OperationsClient.NewListPager": - resp, err = o.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (o *OperationsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if operationsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -82,7 +96,7 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { o.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -91,3 +105,9 @@ func (o *OperationsServerTransport) dispatchNewListPager(req *http.Request) (*ht } return resp, nil } + +// set this to conditionally intercept incoming requests to OperationsServerTransport +var operationsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/operationstatuses_server.go b/sdk/resourcemanager/security/armsecurity/fake/operationstatuses_server.go new file mode 100644 index 000000000000..4dd3d7353924 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/fake/operationstatuses_server.go @@ -0,0 +1,117 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" + "net/http" + "net/url" + "regexp" + "slices" +) + +// OperationStatusesServer is a fake server for instances of the armsecurity.OperationStatusesClient type. +type OperationStatusesServer struct { + // Get is the fake for method OperationStatusesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, location string, operationID string, options *armsecurity.OperationStatusesClientGetOptions) (resp azfake.Responder[armsecurity.OperationStatusesClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewOperationStatusesServerTransport creates a new instance of OperationStatusesServerTransport with the provided implementation. +// The returned OperationStatusesServerTransport instance is connected to an instance of armsecurity.OperationStatusesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewOperationStatusesServerTransport(srv *OperationStatusesServer) *OperationStatusesServerTransport { + return &OperationStatusesServerTransport{srv: srv} +} + +// OperationStatusesServerTransport connects instances of armsecurity.OperationStatusesClient to instances of OperationStatusesServer. +// Don't use this type directly, use NewOperationStatusesServerTransport instead. +type OperationStatusesServerTransport struct { + srv *OperationStatusesServer +} + +// Do implements the policy.Transporter interface for OperationStatusesServerTransport. +func (o *OperationStatusesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return o.dispatchToMethodFake(req, method) +} + +func (o *OperationStatusesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if operationStatusesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operationStatusesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperationStatusesClient.Get": + res.resp, res.err = o.dispatchGet(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (o *OperationStatusesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if o.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/operationStatuses/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + locationParam, err := url.PathUnescape(matches[regex.SubexpIndex("location")]) + if err != nil { + return nil, err + } + operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) + if err != nil { + return nil, err + } + respr, errRespr := o.srv.Get(req.Context(), locationParam, operationIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperationStatusResult, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to OperationStatusesServerTransport +var operationStatusesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/operators_server.go b/sdk/resourcemanager/security/armsecurity/fake/operators_server.go index f8d79dccec55..dd80e4eb34ce 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/operators_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/operators_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // OperatorsServer is a fake server for instances of the armsecurity.OperatorsClient type. @@ -32,22 +32,26 @@ type OperatorsServer struct { // HTTP status codes to indicate success: http.StatusOK Get func(ctx context.Context, pricingName string, securityOperatorName string, options *armsecurity.OperatorsClientGetOptions) (resp azfake.Responder[armsecurity.OperatorsClientGetResponse], errResp azfake.ErrorResponder) - // List is the fake for method OperatorsClient.List + // NewListPager is the fake for method OperatorsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, pricingName string, options *armsecurity.OperatorsClientListOptions) (resp azfake.Responder[armsecurity.OperatorsClientListResponse], errResp azfake.ErrorResponder) + NewListPager func(pricingName string, options *armsecurity.OperatorsClientListOptions) (resp azfake.PagerResponder[armsecurity.OperatorsClientListResponse]) } // NewOperatorsServerTransport creates a new instance of OperatorsServerTransport with the provided implementation. // The returned OperatorsServerTransport instance is connected to an instance of armsecurity.OperatorsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewOperatorsServerTransport(srv *OperatorsServer) *OperatorsServerTransport { - return &OperatorsServerTransport{srv: srv} + return &OperatorsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurity.OperatorsClientListResponse]](), + } } // OperatorsServerTransport connects instances of armsecurity.OperatorsClient to instances of OperatorsServer. // Don't use this type directly, use NewOperatorsServerTransport instead. type OperatorsServerTransport struct { - srv *OperatorsServer + srv *OperatorsServer + newListPager *tracker[azfake.PagerResponder[armsecurity.OperatorsClientListResponse]] } // Do implements the policy.Transporter interface for OperatorsServerTransport. @@ -58,27 +62,41 @@ func (o *OperatorsServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "OperatorsClient.CreateOrUpdate": - resp, err = o.dispatchCreateOrUpdate(req) - case "OperatorsClient.Delete": - resp, err = o.dispatchDelete(req) - case "OperatorsClient.Get": - resp, err = o.dispatchGet(req) - case "OperatorsClient.List": - resp, err = o.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return o.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err +func (o *OperatorsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if operatorsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = operatorsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "OperatorsClient.CreateOrUpdate": + res.resp, res.err = o.dispatchCreateOrUpdate(req) + case "OperatorsClient.Delete": + res.resp, res.err = o.dispatchDelete(req) + case "OperatorsClient.Get": + res.resp, res.err = o.dispatchGet(req) + case "OperatorsClient.NewListPager": + res.resp, res.err = o.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err } - - return resp, nil } func (o *OperatorsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -88,7 +106,7 @@ func (o *OperatorsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/pricings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securityOperators/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } pricingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("pricingName")]) @@ -104,7 +122,7 @@ func (o *OperatorsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperatorResource, req) @@ -121,7 +139,7 @@ func (o *OperatorsServerTransport) dispatchDelete(req *http.Request) (*http.Resp const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/pricings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securityOperators/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } pricingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("pricingName")]) @@ -137,7 +155,7 @@ func (o *OperatorsServerTransport) dispatchDelete(req *http.Request) (*http.Resp return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -154,7 +172,7 @@ func (o *OperatorsServerTransport) dispatchGet(req *http.Request) (*http.Respons const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/pricings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securityOperators/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } pricingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("pricingName")]) @@ -170,7 +188,7 @@ func (o *OperatorsServerTransport) dispatchGet(req *http.Request) (*http.Respons return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperatorResource, req) @@ -180,31 +198,42 @@ func (o *OperatorsServerTransport) dispatchGet(req *http.Request) (*http.Respons return resp, nil } -func (o *OperatorsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if o.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/pricings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securityOperators` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - pricingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("pricingName")]) +func (o *OperatorsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if o.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := o.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/pricings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securityOperators` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + pricingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("pricingName")]) + if err != nil { + return nil, err + } + resp := o.srv.NewListPager(pricingNameParam, nil) + newListPager = &resp + o.newListPager.add(req, newListPager) + } + resp, err := server.PagerResponderNext(newListPager, req) if err != nil { return nil, err } - respr, errRespr := o.srv.List(req.Context(), pricingNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + o.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).OperatorList, req) - if err != nil { - return nil, err + if !server.PagerResponderMore(newListPager) { + o.newListPager.remove(req) } return resp, nil } + +// set this to conditionally intercept incoming requests to OperatorsServerTransport +var operatorsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/polymorphic_helpers.go b/sdk/resourcemanager/security/armsecurity/fake/polymorphic_helpers.go index e7144a32b921..8c5aaae5592f 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/polymorphic_helpers.go +++ b/sdk/resourcemanager/security/armsecurity/fake/polymorphic_helpers.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -41,10 +40,10 @@ func unmarshalSettingClassification(rawMsg json.RawMessage) (armsecurity.Setting } var b armsecurity.SettingClassification switch m["kind"] { - case string(armsecurity.SettingKindAlertSyncSettings): - b = &armsecurity.AlertSyncSettings{} case string(armsecurity.SettingKindDataExportSettings): b = &armsecurity.DataExportSettings{} + case string(armsecurity.SettingKindAlertSyncSettings): + b = &armsecurity.AlertSyncSettings{} default: b = &armsecurity.Setting{} } diff --git a/sdk/resourcemanager/security/armsecurity/fake/pricings_server.go b/sdk/resourcemanager/security/armsecurity/fake/pricings_server.go index 60eaa5392d97..7e78fbfe8cf3 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/pricings_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/pricings_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // PricingsServer is a fake server for instances of the armsecurity.PricingsClient type. @@ -58,27 +58,41 @@ func (p *PricingsServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return p.dispatchToMethodFake(req, method) +} - switch method { - case "PricingsClient.Delete": - resp, err = p.dispatchDelete(req) - case "PricingsClient.Get": - resp, err = p.dispatchGet(req) - case "PricingsClient.List": - resp, err = p.dispatchList(req) - case "PricingsClient.Update": - resp, err = p.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (p *PricingsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if pricingsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = pricingsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PricingsClient.Delete": + res.resp, res.err = p.dispatchDelete(req) + case "PricingsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PricingsClient.List": + res.resp, res.err = p.dispatchList(req) + case "PricingsClient.Update": + res.resp, res.err = p.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (p *PricingsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { @@ -88,7 +102,7 @@ func (p *PricingsServerTransport) dispatchDelete(req *http.Request) (*http.Respo const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/pricings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeId")]) @@ -104,7 +118,7 @@ func (p *PricingsServerTransport) dispatchDelete(req *http.Request) (*http.Respo return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -121,7 +135,7 @@ func (p *PricingsServerTransport) dispatchGet(req *http.Request) (*http.Response const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/pricings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("scopeId")]) @@ -137,7 +151,7 @@ func (p *PricingsServerTransport) dispatchGet(req *http.Request) (*http.Response return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Pricing, req) @@ -154,7 +168,7 @@ func (p *PricingsServerTransport) dispatchList(req *http.Request) (*http.Respons const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/pricings` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -162,11 +176,7 @@ func (p *PricingsServerTransport) dispatchList(req *http.Request) (*http.Respons if err != nil { return nil, err } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) + filterParam := getOptional(qp.Get("$filter")) var options *armsecurity.PricingsClientListOptions if filterParam != nil { options = &armsecurity.PricingsClientListOptions{ @@ -178,7 +188,7 @@ func (p *PricingsServerTransport) dispatchList(req *http.Request) (*http.Respons return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PricingList, req) @@ -195,7 +205,7 @@ func (p *PricingsServerTransport) dispatchUpdate(req *http.Request) (*http.Respo const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/pricings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.Pricing](req) @@ -215,7 +225,7 @@ func (p *PricingsServerTransport) dispatchUpdate(req *http.Request) (*http.Respo return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Pricing, req) @@ -224,3 +234,9 @@ func (p *PricingsServerTransport) dispatchUpdate(req *http.Request) (*http.Respo } return resp, nil } + +// set this to conditionally intercept incoming requests to PricingsServerTransport +var pricingsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/privateendpointconnections_server.go b/sdk/resourcemanager/security/armsecurity/fake/privateendpointconnections_server.go new file mode 100644 index 000000000000..85e0df7f3085 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/fake/privateendpointconnections_server.go @@ -0,0 +1,301 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" + "net/http" + "net/url" + "regexp" + "slices" +) + +// PrivateEndpointConnectionsServer is a fake server for instances of the armsecurity.PrivateEndpointConnectionsClient type. +type PrivateEndpointConnectionsServer struct { + // BeginCreateOrUpdate is the fake for method PrivateEndpointConnectionsClient.BeginCreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreateOrUpdate func(ctx context.Context, resourceGroupName string, privateEndpointConnectionName string, properties armsecurity.PrivateEndpointConnectionProperties, privateLinkName armsecurity.PrivateLinkParameters, options *armsecurity.PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (resp azfake.PollerResponder[armsecurity.PrivateEndpointConnectionsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PrivateEndpointConnectionsClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, privateEndpointConnectionName string, privateLinkName armsecurity.PrivateLinkParameters, options *armsecurity.PrivateEndpointConnectionsClientBeginDeleteOptions) (resp azfake.PollerResponder[armsecurity.PrivateEndpointConnectionsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PrivateEndpointConnectionsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, privateEndpointConnectionName string, privateLinkName armsecurity.PrivateLinkParameters, options *armsecurity.PrivateEndpointConnectionsClientGetOptions) (resp azfake.Responder[armsecurity.PrivateEndpointConnectionsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method PrivateEndpointConnectionsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, privateLinkName armsecurity.PrivateLinkParameters, options *armsecurity.PrivateEndpointConnectionsClientListOptions) (resp azfake.PagerResponder[armsecurity.PrivateEndpointConnectionsClientListResponse]) +} + +// NewPrivateEndpointConnectionsServerTransport creates a new instance of PrivateEndpointConnectionsServerTransport with the provided implementation. +// The returned PrivateEndpointConnectionsServerTransport instance is connected to an instance of armsecurity.PrivateEndpointConnectionsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateEndpointConnectionsServerTransport(srv *PrivateEndpointConnectionsServer) *PrivateEndpointConnectionsServerTransport { + return &PrivateEndpointConnectionsServerTransport{ + srv: srv, + beginCreateOrUpdate: newTracker[azfake.PollerResponder[armsecurity.PrivateEndpointConnectionsClientCreateOrUpdateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armsecurity.PrivateEndpointConnectionsClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armsecurity.PrivateEndpointConnectionsClientListResponse]](), + } +} + +// PrivateEndpointConnectionsServerTransport connects instances of armsecurity.PrivateEndpointConnectionsClient to instances of PrivateEndpointConnectionsServer. +// Don't use this type directly, use NewPrivateEndpointConnectionsServerTransport instead. +type PrivateEndpointConnectionsServerTransport struct { + srv *PrivateEndpointConnectionsServer + beginCreateOrUpdate *tracker[azfake.PollerResponder[armsecurity.PrivateEndpointConnectionsClientCreateOrUpdateResponse]] + beginDelete *tracker[azfake.PollerResponder[armsecurity.PrivateEndpointConnectionsClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armsecurity.PrivateEndpointConnectionsClientListResponse]] +} + +// Do implements the policy.Transporter interface for PrivateEndpointConnectionsServerTransport. +func (p *PrivateEndpointConnectionsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if privateEndpointConnectionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateEndpointConnectionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateEndpointConnectionsClient.BeginCreateOrUpdate": + res.resp, res.err = p.dispatchBeginCreateOrUpdate(req) + case "PrivateEndpointConnectionsClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateEndpointConnectionsClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateEndpointConnectionsClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginCreateOrUpdate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreateOrUpdate not implemented")} + } + beginCreateOrUpdate := p.beginCreateOrUpdate.get(req) + if beginCreateOrUpdate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/privateLinks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurity.PrivateEndpointConnectionProperties](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + privateLinkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + privateLinkName := armsecurity.PrivateLinkParameters{ + PrivateLinkName: privateLinkNameParam, + } + respr, errRespr := p.srv.BeginCreateOrUpdate(req.Context(), resourceGroupNameParam, privateEndpointConnectionNameParam, body, privateLinkName, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreateOrUpdate = &respr + p.beginCreateOrUpdate.add(req, beginCreateOrUpdate) + } + + resp, err := server.PollerResponderNext(beginCreateOrUpdate, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginCreateOrUpdate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreateOrUpdate) { + p.beginCreateOrUpdate.remove(req) + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/privateLinks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + privateLinkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + privateLinkName := armsecurity.PrivateLinkParameters{ + PrivateLinkName: privateLinkNameParam, + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, privateEndpointConnectionNameParam, privateLinkName, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/privateLinks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + privateLinkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkName")]) + if err != nil { + return nil, err + } + privateEndpointConnectionNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateEndpointConnectionName")]) + if err != nil { + return nil, err + } + privateLinkName := armsecurity.PrivateLinkParameters{ + PrivateLinkName: privateLinkNameParam, + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, privateEndpointConnectionNameParam, privateLinkName, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateEndpointConnection, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateEndpointConnectionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := p.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/privateLinks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateEndpointConnections` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + privateLinkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkName")]) + if err != nil { + return nil, err + } + privateLinkName := armsecurity.PrivateLinkParameters{ + PrivateLinkName: privateLinkNameParam, + } + resp := p.srv.NewListPager(resourceGroupNameParam, privateLinkName, nil) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.PrivateEndpointConnectionsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + p.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to PrivateEndpointConnectionsServerTransport +var privateEndpointConnectionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/privatelinkresources_server.go b/sdk/resourcemanager/security/armsecurity/fake/privatelinkresources_server.go new file mode 100644 index 000000000000..7c99463feb08 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/fake/privatelinkresources_server.go @@ -0,0 +1,179 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" + "net/http" + "net/url" + "regexp" + "slices" +) + +// PrivateLinkResourcesServer is a fake server for instances of the armsecurity.PrivateLinkResourcesClient type. +type PrivateLinkResourcesServer struct { + // Get is the fake for method PrivateLinkResourcesClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, groupID string, privateLinkName armsecurity.PrivateLinkParameters, options *armsecurity.PrivateLinkResourcesClientGetOptions) (resp azfake.Responder[armsecurity.PrivateLinkResourcesClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method PrivateLinkResourcesClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, privateLinkName armsecurity.PrivateLinkParameters, options *armsecurity.PrivateLinkResourcesClientListOptions) (resp azfake.PagerResponder[armsecurity.PrivateLinkResourcesClientListResponse]) +} + +// NewPrivateLinkResourcesServerTransport creates a new instance of PrivateLinkResourcesServerTransport with the provided implementation. +// The returned PrivateLinkResourcesServerTransport instance is connected to an instance of armsecurity.PrivateLinkResourcesClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateLinkResourcesServerTransport(srv *PrivateLinkResourcesServer) *PrivateLinkResourcesServerTransport { + return &PrivateLinkResourcesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurity.PrivateLinkResourcesClientListResponse]](), + } +} + +// PrivateLinkResourcesServerTransport connects instances of armsecurity.PrivateLinkResourcesClient to instances of PrivateLinkResourcesServer. +// Don't use this type directly, use NewPrivateLinkResourcesServerTransport instead. +type PrivateLinkResourcesServerTransport struct { + srv *PrivateLinkResourcesServer + newListPager *tracker[azfake.PagerResponder[armsecurity.PrivateLinkResourcesClientListResponse]] +} + +// Do implements the policy.Transporter interface for PrivateLinkResourcesServerTransport. +func (p *PrivateLinkResourcesServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *PrivateLinkResourcesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if privateLinkResourcesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinkResourcesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinkResourcesClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateLinkResourcesClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (p *PrivateLinkResourcesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/privateLinks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 5 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + privateLinkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkName")]) + if err != nil { + return nil, err + } + groupIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("groupId")]) + if err != nil { + return nil, err + } + privateLinkName := armsecurity.PrivateLinkParameters{ + PrivateLinkName: privateLinkNameParam, + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, groupIDParam, privateLinkName, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkGroupResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateLinkResourcesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := p.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/privateLinks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/privateLinkResources` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + privateLinkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkName")]) + if err != nil { + return nil, err + } + privateLinkName := armsecurity.PrivateLinkParameters{ + PrivateLinkName: privateLinkNameParam, + } + resp := p.srv.NewListPager(resourceGroupNameParam, privateLinkName, nil) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.PrivateLinkResourcesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + p.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to PrivateLinkResourcesServerTransport +var privateLinkResourcesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/privatelinks_server.go b/sdk/resourcemanager/security/armsecurity/fake/privatelinks_server.go new file mode 100644 index 000000000000..983d0c6e09c2 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/fake/privatelinks_server.go @@ -0,0 +1,411 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" + "net/http" + "net/url" + "regexp" + "slices" +) + +// PrivateLinksServer is a fake server for instances of the armsecurity.PrivateLinksClient type. +type PrivateLinksServer struct { + // BeginCreate is the fake for method PrivateLinksClient.BeginCreate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + BeginCreate func(ctx context.Context, resourceGroupName string, privateLink armsecurity.PrivateLinkResource, privateLinkName armsecurity.PrivateLinkParameters, options *armsecurity.PrivateLinksClientBeginCreateOptions) (resp azfake.PollerResponder[armsecurity.PrivateLinksClientCreateResponse], errResp azfake.ErrorResponder) + + // BeginDelete is the fake for method PrivateLinksClient.BeginDelete + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted, http.StatusNoContent + BeginDelete func(ctx context.Context, resourceGroupName string, privateLinkName armsecurity.PrivateLinkParameters, options *armsecurity.PrivateLinksClientBeginDeleteOptions) (resp azfake.PollerResponder[armsecurity.PrivateLinksClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method PrivateLinksClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, privateLinkName armsecurity.PrivateLinkParameters, options *armsecurity.PrivateLinksClientGetOptions) (resp azfake.Responder[armsecurity.PrivateLinksClientGetResponse], errResp azfake.ErrorResponder) + + // Head is the fake for method PrivateLinksClient.Head + // HTTP status codes to indicate success: http.StatusOK + Head func(ctx context.Context, resourceGroupName string, privateLinkName armsecurity.PrivateLinkParameters, options *armsecurity.PrivateLinksClientHeadOptions) (resp azfake.Responder[armsecurity.PrivateLinksClientHeadResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method PrivateLinksClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, options *armsecurity.PrivateLinksClientListOptions) (resp azfake.PagerResponder[armsecurity.PrivateLinksClientListResponse]) + + // NewListBySubscriptionPager is the fake for method PrivateLinksClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armsecurity.PrivateLinksClientListBySubscriptionOptions) (resp azfake.PagerResponder[armsecurity.PrivateLinksClientListBySubscriptionResponse]) + + // Update is the fake for method PrivateLinksClient.Update + // HTTP status codes to indicate success: http.StatusOK + Update func(ctx context.Context, resourceGroupName string, privateLink armsecurity.PrivateLinkUpdate, privateLinkName armsecurity.PrivateLinkParameters, options *armsecurity.PrivateLinksClientUpdateOptions) (resp azfake.Responder[armsecurity.PrivateLinksClientUpdateResponse], errResp azfake.ErrorResponder) +} + +// NewPrivateLinksServerTransport creates a new instance of PrivateLinksServerTransport with the provided implementation. +// The returned PrivateLinksServerTransport instance is connected to an instance of armsecurity.PrivateLinksClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewPrivateLinksServerTransport(srv *PrivateLinksServer) *PrivateLinksServerTransport { + return &PrivateLinksServerTransport{ + srv: srv, + beginCreate: newTracker[azfake.PollerResponder[armsecurity.PrivateLinksClientCreateResponse]](), + beginDelete: newTracker[azfake.PollerResponder[armsecurity.PrivateLinksClientDeleteResponse]](), + newListPager: newTracker[azfake.PagerResponder[armsecurity.PrivateLinksClientListResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armsecurity.PrivateLinksClientListBySubscriptionResponse]](), + } +} + +// PrivateLinksServerTransport connects instances of armsecurity.PrivateLinksClient to instances of PrivateLinksServer. +// Don't use this type directly, use NewPrivateLinksServerTransport instead. +type PrivateLinksServerTransport struct { + srv *PrivateLinksServer + beginCreate *tracker[azfake.PollerResponder[armsecurity.PrivateLinksClientCreateResponse]] + beginDelete *tracker[azfake.PollerResponder[armsecurity.PrivateLinksClientDeleteResponse]] + newListPager *tracker[azfake.PagerResponder[armsecurity.PrivateLinksClientListResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armsecurity.PrivateLinksClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for PrivateLinksServerTransport. +func (p *PrivateLinksServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return p.dispatchToMethodFake(req, method) +} + +func (p *PrivateLinksServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if privateLinksServerTransportInterceptor != nil { + res.resp, res.err, intercepted = privateLinksServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "PrivateLinksClient.BeginCreate": + res.resp, res.err = p.dispatchBeginCreate(req) + case "PrivateLinksClient.BeginDelete": + res.resp, res.err = p.dispatchBeginDelete(req) + case "PrivateLinksClient.Get": + res.resp, res.err = p.dispatchGet(req) + case "PrivateLinksClient.Head": + res.resp, res.err = p.dispatchHead(req) + case "PrivateLinksClient.NewListPager": + res.resp, res.err = p.dispatchNewListPager(req) + case "PrivateLinksClient.NewListBySubscriptionPager": + res.resp, res.err = p.dispatchNewListBySubscriptionPager(req) + case "PrivateLinksClient.Update": + res.resp, res.err = p.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (p *PrivateLinksServerTransport) dispatchBeginCreate(req *http.Request) (*http.Response, error) { + if p.srv.BeginCreate == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginCreate not implemented")} + } + beginCreate := p.beginCreate.get(req) + if beginCreate == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/privateLinks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurity.PrivateLinkResource](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + privateLinkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkName")]) + if err != nil { + return nil, err + } + privateLinkName := armsecurity.PrivateLinkParameters{ + PrivateLinkName: privateLinkNameParam, + } + respr, errRespr := p.srv.BeginCreate(req.Context(), resourceGroupNameParam, body, privateLinkName, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginCreate = &respr + p.beginCreate.add(req, beginCreate) + } + + resp, err := server.PollerResponderNext(beginCreate, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, resp.StatusCode) { + p.beginCreate.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", resp.StatusCode)} + } + if !server.PollerResponderMore(beginCreate) { + p.beginCreate.remove(req) + } + + return resp, nil +} + +func (p *PrivateLinksServerTransport) dispatchBeginDelete(req *http.Request) (*http.Response, error) { + if p.srv.BeginDelete == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginDelete not implemented")} + } + beginDelete := p.beginDelete.get(req) + if beginDelete == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/privateLinks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + privateLinkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkName")]) + if err != nil { + return nil, err + } + privateLinkName := armsecurity.PrivateLinkParameters{ + PrivateLinkName: privateLinkNameParam, + } + respr, errRespr := p.srv.BeginDelete(req.Context(), resourceGroupNameParam, privateLinkName, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginDelete = &respr + p.beginDelete.add(req, beginDelete) + } + + resp, err := server.PollerResponderNext(beginDelete, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + p.beginDelete.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} + } + if !server.PollerResponderMore(beginDelete) { + p.beginDelete.remove(req) + } + + return resp, nil +} + +func (p *PrivateLinksServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if p.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/privateLinks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + privateLinkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkName")]) + if err != nil { + return nil, err + } + privateLinkName := armsecurity.PrivateLinkParameters{ + PrivateLinkName: privateLinkNameParam, + } + respr, errRespr := p.srv.Get(req.Context(), resourceGroupNameParam, privateLinkName, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateLinksServerTransport) dispatchHead(req *http.Request) (*http.Response, error) { + if p.srv.Head == nil { + return nil, &nonRetriableError{errors.New("fake for method Head not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/privateLinks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + privateLinkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkName")]) + if err != nil { + return nil, err + } + privateLinkName := armsecurity.PrivateLinkParameters{ + PrivateLinkName: privateLinkNameParam, + } + respr, errRespr := p.srv.Head(req.Context(), resourceGroupNameParam, privateLinkName, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (p *PrivateLinksServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := p.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/privateLinks` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := p.srv.NewListPager(resourceGroupNameParam, nil) + newListPager = &resp + p.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.PrivateLinksClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + p.newListPager.remove(req) + } + return resp, nil +} + +func (p *PrivateLinksServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if p.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := p.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/privateLinks` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := p.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + p.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armsecurity.PrivateLinksClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + p.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + p.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +func (p *PrivateLinksServerTransport) dispatchUpdate(req *http.Request) (*http.Response, error) { + if p.srv.Update == nil { + return nil, &nonRetriableError{errors.New("fake for method Update not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/privateLinks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurity.PrivateLinkUpdate](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + privateLinkNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("privateLinkName")]) + if err != nil { + return nil, err + } + privateLinkName := armsecurity.PrivateLinkParameters{ + PrivateLinkName: privateLinkNameParam, + } + respr, errRespr := p.srv.Update(req.Context(), resourceGroupNameParam, body, privateLinkName, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).PrivateLinkResource, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to PrivateLinksServerTransport +var privateLinksServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/regulatorycomplianceassessments_server.go b/sdk/resourcemanager/security/armsecurity/fake/regulatorycomplianceassessments_server.go index 76bbc5e8b2dc..68d3ecae0b35 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/regulatorycomplianceassessments_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/regulatorycomplianceassessments_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // RegulatoryComplianceAssessmentsServer is a fake server for instances of the armsecurity.RegulatoryComplianceAssessmentsClient type. @@ -55,23 +55,37 @@ func (r *RegulatoryComplianceAssessmentsServerTransport) Do(req *http.Request) ( return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "RegulatoryComplianceAssessmentsClient.Get": - resp, err = r.dispatchGet(req) - case "RegulatoryComplianceAssessmentsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *RegulatoryComplianceAssessmentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if regulatoryComplianceAssessmentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = regulatoryComplianceAssessmentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RegulatoryComplianceAssessmentsClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RegulatoryComplianceAssessmentsClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *RegulatoryComplianceAssessmentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -81,7 +95,7 @@ func (r *RegulatoryComplianceAssessmentsServerTransport) dispatchGet(req *http.R const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/regulatoryComplianceStandards/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/regulatoryComplianceControls/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/regulatoryComplianceAssessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } regulatoryComplianceStandardNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("regulatoryComplianceStandardName")]) @@ -101,7 +115,7 @@ func (r *RegulatoryComplianceAssessmentsServerTransport) dispatchGet(req *http.R return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RegulatoryComplianceAssessment, req) @@ -120,7 +134,7 @@ func (r *RegulatoryComplianceAssessmentsServerTransport) dispatchNewListPager(re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/regulatoryComplianceStandards/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/regulatoryComplianceControls/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/regulatoryComplianceAssessments` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -132,11 +146,7 @@ func (r *RegulatoryComplianceAssessmentsServerTransport) dispatchNewListPager(re if err != nil { return nil, err } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) + filterParam := getOptional(qp.Get("$filter")) var options *armsecurity.RegulatoryComplianceAssessmentsClientListOptions if filterParam != nil { options = &armsecurity.RegulatoryComplianceAssessmentsClientListOptions{ @@ -154,7 +164,7 @@ func (r *RegulatoryComplianceAssessmentsServerTransport) dispatchNewListPager(re if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { r.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -163,3 +173,9 @@ func (r *RegulatoryComplianceAssessmentsServerTransport) dispatchNewListPager(re } return resp, nil } + +// set this to conditionally intercept incoming requests to RegulatoryComplianceAssessmentsServerTransport +var regulatoryComplianceAssessmentsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/regulatorycompliancecontrols_server.go b/sdk/resourcemanager/security/armsecurity/fake/regulatorycompliancecontrols_server.go index 8788a1f80320..0a0e1238acc0 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/regulatorycompliancecontrols_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/regulatorycompliancecontrols_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // RegulatoryComplianceControlsServer is a fake server for instances of the armsecurity.RegulatoryComplianceControlsClient type. @@ -55,23 +55,37 @@ func (r *RegulatoryComplianceControlsServerTransport) Do(req *http.Request) (*ht return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "RegulatoryComplianceControlsClient.Get": - resp, err = r.dispatchGet(req) - case "RegulatoryComplianceControlsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *RegulatoryComplianceControlsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if regulatoryComplianceControlsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = regulatoryComplianceControlsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RegulatoryComplianceControlsClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RegulatoryComplianceControlsClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *RegulatoryComplianceControlsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -81,7 +95,7 @@ func (r *RegulatoryComplianceControlsServerTransport) dispatchGet(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/regulatoryComplianceStandards/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/regulatoryComplianceControls/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } regulatoryComplianceStandardNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("regulatoryComplianceStandardName")]) @@ -97,7 +111,7 @@ func (r *RegulatoryComplianceControlsServerTransport) dispatchGet(req *http.Requ return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RegulatoryComplianceControl, req) @@ -116,7 +130,7 @@ func (r *RegulatoryComplianceControlsServerTransport) dispatchNewListPager(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/regulatoryComplianceStandards/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/regulatoryComplianceControls` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -124,11 +138,7 @@ func (r *RegulatoryComplianceControlsServerTransport) dispatchNewListPager(req * if err != nil { return nil, err } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) + filterParam := getOptional(qp.Get("$filter")) var options *armsecurity.RegulatoryComplianceControlsClientListOptions if filterParam != nil { options = &armsecurity.RegulatoryComplianceControlsClientListOptions{ @@ -146,7 +156,7 @@ func (r *RegulatoryComplianceControlsServerTransport) dispatchNewListPager(req * if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { r.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -155,3 +165,9 @@ func (r *RegulatoryComplianceControlsServerTransport) dispatchNewListPager(req * } return resp, nil } + +// set this to conditionally intercept incoming requests to RegulatoryComplianceControlsServerTransport +var regulatoryComplianceControlsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/regulatorycompliancestandards_server.go b/sdk/resourcemanager/security/armsecurity/fake/regulatorycompliancestandards_server.go index 62fff8fa802a..367829a4b8e2 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/regulatorycompliancestandards_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/regulatorycompliancestandards_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // RegulatoryComplianceStandardsServer is a fake server for instances of the armsecurity.RegulatoryComplianceStandardsClient type. @@ -55,23 +55,37 @@ func (r *RegulatoryComplianceStandardsServerTransport) Do(req *http.Request) (*h return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return r.dispatchToMethodFake(req, method) +} - switch method { - case "RegulatoryComplianceStandardsClient.Get": - resp, err = r.dispatchGet(req) - case "RegulatoryComplianceStandardsClient.NewListPager": - resp, err = r.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (r *RegulatoryComplianceStandardsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if regulatoryComplianceStandardsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = regulatoryComplianceStandardsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "RegulatoryComplianceStandardsClient.Get": + res.resp, res.err = r.dispatchGet(req) + case "RegulatoryComplianceStandardsClient.NewListPager": + res.resp, res.err = r.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (r *RegulatoryComplianceStandardsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -81,7 +95,7 @@ func (r *RegulatoryComplianceStandardsServerTransport) dispatchGet(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/regulatoryComplianceStandards/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } regulatoryComplianceStandardNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("regulatoryComplianceStandardName")]) @@ -93,7 +107,7 @@ func (r *RegulatoryComplianceStandardsServerTransport) dispatchGet(req *http.Req return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RegulatoryComplianceStandard, req) @@ -112,15 +126,11 @@ func (r *RegulatoryComplianceStandardsServerTransport) dispatchNewListPager(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/regulatoryComplianceStandards` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) + filterParam := getOptional(qp.Get("$filter")) var options *armsecurity.RegulatoryComplianceStandardsClientListOptions if filterParam != nil { options = &armsecurity.RegulatoryComplianceStandardsClientListOptions{ @@ -138,7 +148,7 @@ func (r *RegulatoryComplianceStandardsServerTransport) dispatchNewListPager(req if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { r.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -147,3 +157,9 @@ func (r *RegulatoryComplianceStandardsServerTransport) dispatchNewListPager(req } return resp, nil } + +// set this to conditionally intercept incoming requests to RegulatoryComplianceStandardsServerTransport +var regulatoryComplianceStandardsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/securescorecontroldefinitions_server.go b/sdk/resourcemanager/security/armsecurity/fake/securescorecontroldefinitions_server.go index 14980e966081..ea910c4eea48 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/securescorecontroldefinitions_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/securescorecontroldefinitions_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -15,6 +14,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" "net/http" "regexp" + "slices" ) // SecureScoreControlDefinitionsServer is a fake server for instances of the armsecurity.SecureScoreControlDefinitionsClient type. @@ -55,23 +55,37 @@ func (s *SecureScoreControlDefinitionsServerTransport) Do(req *http.Request) (*h return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SecureScoreControlDefinitionsClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - case "SecureScoreControlDefinitionsClient.NewListBySubscriptionPager": - resp, err = s.dispatchNewListBySubscriptionPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SecureScoreControlDefinitionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if secureScoreControlDefinitionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = secureScoreControlDefinitionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SecureScoreControlDefinitionsClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + case "SecureScoreControlDefinitionsClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SecureScoreControlDefinitionsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -91,7 +105,7 @@ func (s *SecureScoreControlDefinitionsServerTransport) dispatchNewListPager(req if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { s.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -110,7 +124,7 @@ func (s *SecureScoreControlDefinitionsServerTransport) dispatchNewListBySubscrip const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/secureScoreControlDefinitions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := s.srv.NewListBySubscriptionPager(nil) @@ -124,7 +138,7 @@ func (s *SecureScoreControlDefinitionsServerTransport) dispatchNewListBySubscrip if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { s.newListBySubscriptionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -133,3 +147,9 @@ func (s *SecureScoreControlDefinitionsServerTransport) dispatchNewListBySubscrip } return resp, nil } + +// set this to conditionally intercept incoming requests to SecureScoreControlDefinitionsServerTransport +var secureScoreControlDefinitionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/securescorecontrols_server.go b/sdk/resourcemanager/security/armsecurity/fake/securescorecontrols_server.go index e013cea0f1e1..f2e45a33b324 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/securescorecontrols_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/securescorecontrols_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // SecureScoreControlsServer is a fake server for instances of the armsecurity.SecureScoreControlsClient type. @@ -56,23 +56,37 @@ func (s *SecureScoreControlsServerTransport) Do(req *http.Request) (*http.Respon return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SecureScoreControlsClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - case "SecureScoreControlsClient.NewListBySecureScorePager": - resp, err = s.dispatchNewListBySecureScorePager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SecureScoreControlsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if secureScoreControlsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = secureScoreControlsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SecureScoreControlsClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + case "SecureScoreControlsClient.NewListBySecureScorePager": + res.resp, res.err = s.dispatchNewListBySecureScorePager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SecureScoreControlsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { @@ -84,15 +98,11 @@ func (s *SecureScoreControlsServerTransport) dispatchNewListPager(req *http.Requ const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/secureScoreControls` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() - expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) - if err != nil { - return nil, err - } - expandParam := getOptional(armsecurity.ExpandControlsEnum(expandUnescaped)) + expandParam := getOptional(armsecurity.ExpandControlsEnum(qp.Get("$expand"))) var options *armsecurity.SecureScoreControlsClientListOptions if expandParam != nil { options = &armsecurity.SecureScoreControlsClientListOptions{ @@ -110,7 +120,7 @@ func (s *SecureScoreControlsServerTransport) dispatchNewListPager(req *http.Requ if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { s.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -129,7 +139,7 @@ func (s *SecureScoreControlsServerTransport) dispatchNewListBySecureScorePager(r const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/secureScores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/secureScoreControls` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -137,11 +147,7 @@ func (s *SecureScoreControlsServerTransport) dispatchNewListBySecureScorePager(r if err != nil { return nil, err } - expandUnescaped, err := url.QueryUnescape(qp.Get("$expand")) - if err != nil { - return nil, err - } - expandParam := getOptional(armsecurity.ExpandControlsEnum(expandUnescaped)) + expandParam := getOptional(armsecurity.ExpandControlsEnum(qp.Get("$expand"))) var options *armsecurity.SecureScoreControlsClientListBySecureScoreOptions if expandParam != nil { options = &armsecurity.SecureScoreControlsClientListBySecureScoreOptions{ @@ -159,7 +165,7 @@ func (s *SecureScoreControlsServerTransport) dispatchNewListBySecureScorePager(r if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { s.newListBySecureScorePager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -168,3 +174,9 @@ func (s *SecureScoreControlsServerTransport) dispatchNewListBySecureScorePager(r } return resp, nil } + +// set this to conditionally intercept incoming requests to SecureScoreControlsServerTransport +var secureScoreControlsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/securescores_server.go b/sdk/resourcemanager/security/armsecurity/fake/securescores_server.go index 9106891296f3..b2948ea8aea8 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/securescores_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/securescores_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // SecureScoresServer is a fake server for instances of the armsecurity.SecureScoresClient type. @@ -55,23 +55,37 @@ func (s *SecureScoresServerTransport) Do(req *http.Request) (*http.Response, err return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SecureScoresClient.Get": - resp, err = s.dispatchGet(req) - case "SecureScoresClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SecureScoresServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if secureScoresServerTransportInterceptor != nil { + res.resp, res.err, intercepted = secureScoresServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SecureScoresClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SecureScoresClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SecureScoresServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -81,7 +95,7 @@ func (s *SecureScoresServerTransport) dispatchGet(req *http.Request) (*http.Resp const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/secureScores/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } secureScoreNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("secureScoreName")]) @@ -93,7 +107,7 @@ func (s *SecureScoresServerTransport) dispatchGet(req *http.Request) (*http.Resp return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SecureScoreItem, req) @@ -112,7 +126,7 @@ func (s *SecureScoresServerTransport) dispatchNewListPager(req *http.Request) (* const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/secureScores` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := s.srv.NewListPager(nil) @@ -126,7 +140,7 @@ func (s *SecureScoresServerTransport) dispatchNewListPager(req *http.Request) (* if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { s.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -135,3 +149,9 @@ func (s *SecureScoresServerTransport) dispatchNewListPager(req *http.Request) (* } return resp, nil } + +// set this to conditionally intercept incoming requests to SecureScoresServerTransport +var secureScoresServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/sensitivitysettings_server.go b/sdk/resourcemanager/security/armsecurity/fake/sensitivitysettings_server.go index aa93aad35156..9253f9630caf 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/sensitivitysettings_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/sensitivitysettings_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -14,6 +13,7 @@ import ( "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" "net/http" + "slices" ) // SensitivitySettingsServer is a fake server for instances of the armsecurity.SensitivitySettingsClient type. @@ -52,25 +52,39 @@ func (s *SensitivitySettingsServerTransport) Do(req *http.Request) (*http.Respon return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error - - switch method { - case "SensitivitySettingsClient.CreateOrUpdate": - resp, err = s.dispatchCreateOrUpdate(req) - case "SensitivitySettingsClient.Get": - resp, err = s.dispatchGet(req) - case "SensitivitySettingsClient.List": - resp, err = s.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } + return s.dispatchToMethodFake(req, method) +} - if err != nil { - return nil, err - } +func (s *SensitivitySettingsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if sensitivitySettingsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sensitivitySettingsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SensitivitySettingsClient.CreateOrUpdate": + res.resp, res.err = s.dispatchCreateOrUpdate(req) + case "SensitivitySettingsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SensitivitySettingsClient.List": + res.resp, res.err = s.dispatchList(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - return resp, nil + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SensitivitySettingsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -86,7 +100,7 @@ func (s *SensitivitySettingsServerTransport) dispatchCreateOrUpdate(req *http.Re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GetSensitivitySettingsResponse, req) @@ -105,7 +119,7 @@ func (s *SensitivitySettingsServerTransport) dispatchGet(req *http.Request) (*ht return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GetSensitivitySettingsResponse, req) @@ -124,7 +138,7 @@ func (s *SensitivitySettingsServerTransport) dispatchList(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).GetSensitivitySettingsListResponse, req) @@ -133,3 +147,9 @@ func (s *SensitivitySettingsServerTransport) dispatchList(req *http.Request) (*h } return resp, nil } + +// set this to conditionally intercept incoming requests to SensitivitySettingsServerTransport +var sensitivitySettingsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/server_factory.go b/sdk/resourcemanager/security/armsecurity/fake/server_factory.go index ce9ad54ceab5..d30e36a90176 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/server_factory.go +++ b/sdk/resourcemanager/security/armsecurity/fake/server_factory.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,76 +15,233 @@ import ( // ServerFactory is a fake server for instances of the armsecurity.ClientFactory type. type ServerFactory struct { - APICollectionsServer APICollectionsServer - AccountConnectorsServer AccountConnectorsServer - AdaptiveApplicationControlsServer AdaptiveApplicationControlsServer - AdaptiveNetworkHardeningsServer AdaptiveNetworkHardeningsServer - AdvancedThreatProtectionServer AdvancedThreatProtectionServer - AlertsServer AlertsServer - AlertsSuppressionRulesServer AlertsSuppressionRulesServer - AllowedConnectionsServer AllowedConnectionsServer - ApplicationServer ApplicationServer - ApplicationsServer ApplicationsServer - AssessmentsServer AssessmentsServer - AssessmentsMetadataServer AssessmentsMetadataServer - AutoProvisioningSettingsServer AutoProvisioningSettingsServer - AutomationsServer AutomationsServer - AzureDevOpsOrgsServer AzureDevOpsOrgsServer - AzureDevOpsProjectsServer AzureDevOpsProjectsServer - AzureDevOpsReposServer AzureDevOpsReposServer - ComplianceResultsServer ComplianceResultsServer - CompliancesServer CompliancesServer - ConnectorApplicationServer ConnectorApplicationServer - ConnectorApplicationsServer ConnectorApplicationsServer - ConnectorsServer ConnectorsServer - ContactsServer ContactsServer - CustomAssessmentAutomationsServer CustomAssessmentAutomationsServer - CustomEntityStoreAssignmentsServer CustomEntityStoreAssignmentsServer - DefenderForStorageServer DefenderForStorageServer - DevOpsConfigurationsServer DevOpsConfigurationsServer - DevOpsOperationResultsServer DevOpsOperationResultsServer - DeviceSecurityGroupsServer DeviceSecurityGroupsServer - DiscoveredSecuritySolutionsServer DiscoveredSecuritySolutionsServer - ExternalSecuritySolutionsServer ExternalSecuritySolutionsServer - GitHubOwnersServer GitHubOwnersServer - GitHubReposServer GitHubReposServer - GitLabGroupsServer GitLabGroupsServer - GitLabProjectsServer GitLabProjectsServer - GitLabSubgroupsServer GitLabSubgroupsServer - GovernanceAssignmentsServer GovernanceAssignmentsServer - GovernanceRulesServer GovernanceRulesServer - HealthReportsServer HealthReportsServer - InformationProtectionPoliciesServer InformationProtectionPoliciesServer - IotSecuritySolutionAnalyticsServer IotSecuritySolutionAnalyticsServer - IotSecuritySolutionServer IotSecuritySolutionServer + // APICollectionsServer contains the fakes for client APICollectionsClient + APICollectionsServer APICollectionsServer + + // AdvancedThreatProtectionServer contains the fakes for client AdvancedThreatProtectionClient + AdvancedThreatProtectionServer AdvancedThreatProtectionServer + + // AlertsServer contains the fakes for client AlertsClient + AlertsServer AlertsServer + + // AlertsSuppressionRulesServer contains the fakes for client AlertsSuppressionRulesClient + AlertsSuppressionRulesServer AlertsSuppressionRulesServer + + // AllowedConnectionsServer contains the fakes for client AllowedConnectionsClient + AllowedConnectionsServer AllowedConnectionsServer + + // ApplicationServer contains the fakes for client ApplicationClient + ApplicationServer ApplicationServer + + // ApplicationsServer contains the fakes for client ApplicationsClient + ApplicationsServer ApplicationsServer + + // AssessmentsServer contains the fakes for client AssessmentsClient + AssessmentsServer AssessmentsServer + + // AssessmentsMetadataServer contains the fakes for client AssessmentsMetadataClient + AssessmentsMetadataServer AssessmentsMetadataServer + + // AssignmentsServer contains the fakes for client AssignmentsClient + AssignmentsServer AssignmentsServer + + // AutoProvisioningSettingsServer contains the fakes for client AutoProvisioningSettingsClient + AutoProvisioningSettingsServer AutoProvisioningSettingsServer + + // AutomationsServer contains the fakes for client AutomationsClient + AutomationsServer AutomationsServer + + // AzureDevOpsOrgsServer contains the fakes for client AzureDevOpsOrgsClient + AzureDevOpsOrgsServer AzureDevOpsOrgsServer + + // AzureDevOpsProjectsServer contains the fakes for client AzureDevOpsProjectsClient + AzureDevOpsProjectsServer AzureDevOpsProjectsServer + + // AzureDevOpsReposServer contains the fakes for client AzureDevOpsReposClient + AzureDevOpsReposServer AzureDevOpsReposServer + + // ComplianceResultsServer contains the fakes for client ComplianceResultsClient + ComplianceResultsServer ComplianceResultsServer + + // CompliancesServer contains the fakes for client CompliancesClient + CompliancesServer CompliancesServer + + // ConnectorApplicationServer contains the fakes for client ConnectorApplicationClient + ConnectorApplicationServer ConnectorApplicationServer + + // ConnectorApplicationsServer contains the fakes for client ConnectorApplicationsClient + ConnectorApplicationsServer ConnectorApplicationsServer + + // ConnectorsServer contains the fakes for client ConnectorsClient + ConnectorsServer ConnectorsServer + + // ContactsServer contains the fakes for client ContactsClient + ContactsServer ContactsServer + + // CustomRecommendationsServer contains the fakes for client CustomRecommendationsClient + CustomRecommendationsServer CustomRecommendationsServer + + // DefenderForStorageServer contains the fakes for client DefenderForStorageClient + DefenderForStorageServer DefenderForStorageServer + + // DevOpsConfigurationsServer contains the fakes for client DevOpsConfigurationsClient + DevOpsConfigurationsServer DevOpsConfigurationsServer + + // DevOpsOperationResultsServer contains the fakes for client DevOpsOperationResultsClient + DevOpsOperationResultsServer DevOpsOperationResultsServer + + // DeviceSecurityGroupsServer contains the fakes for client DeviceSecurityGroupsClient + DeviceSecurityGroupsServer DeviceSecurityGroupsServer + + // DiscoveredSecuritySolutionsServer contains the fakes for client DiscoveredSecuritySolutionsClient + DiscoveredSecuritySolutionsServer DiscoveredSecuritySolutionsServer + + // ExternalSecuritySolutionsServer contains the fakes for client ExternalSecuritySolutionsClient + ExternalSecuritySolutionsServer ExternalSecuritySolutionsServer + + // GitHubIssuesServer contains the fakes for client GitHubIssuesClient + GitHubIssuesServer GitHubIssuesServer + + // GitHubOwnersServer contains the fakes for client GitHubOwnersClient + GitHubOwnersServer GitHubOwnersServer + + // GitHubReposServer contains the fakes for client GitHubReposClient + GitHubReposServer GitHubReposServer + + // GitLabGroupsServer contains the fakes for client GitLabGroupsClient + GitLabGroupsServer GitLabGroupsServer + + // GitLabProjectsServer contains the fakes for client GitLabProjectsClient + GitLabProjectsServer GitLabProjectsServer + + // GitLabSubgroupsServer contains the fakes for client GitLabSubgroupsClient + GitLabSubgroupsServer GitLabSubgroupsServer + + // GovernanceAssignmentsServer contains the fakes for client GovernanceAssignmentsClient + GovernanceAssignmentsServer GovernanceAssignmentsServer + + // GovernanceRulesServer contains the fakes for client GovernanceRulesClient + GovernanceRulesServer GovernanceRulesServer + + // HealthReportsServer contains the fakes for client HealthReportsClient + HealthReportsServer HealthReportsServer + + // InformationProtectionPoliciesServer contains the fakes for client InformationProtectionPoliciesClient + InformationProtectionPoliciesServer InformationProtectionPoliciesServer + + // IotSecuritySolutionAnalyticsServer contains the fakes for client IotSecuritySolutionAnalyticsClient + IotSecuritySolutionAnalyticsServer IotSecuritySolutionAnalyticsServer + + // IotSecuritySolutionServer contains the fakes for client IotSecuritySolutionClient + IotSecuritySolutionServer IotSecuritySolutionServer + + // IotSecuritySolutionsAnalyticsAggregatedAlertServer contains the fakes for client IotSecuritySolutionsAnalyticsAggregatedAlertClient IotSecuritySolutionsAnalyticsAggregatedAlertServer IotSecuritySolutionsAnalyticsAggregatedAlertServer - IotSecuritySolutionsAnalyticsRecommendationServer IotSecuritySolutionsAnalyticsRecommendationServer - JitNetworkAccessPoliciesServer JitNetworkAccessPoliciesServer - LocationsServer LocationsServer - MdeOnboardingsServer MdeOnboardingsServer - OperationsServer OperationsServer - OperatorsServer OperatorsServer - PricingsServer PricingsServer - RegulatoryComplianceAssessmentsServer RegulatoryComplianceAssessmentsServer - RegulatoryComplianceControlsServer RegulatoryComplianceControlsServer - RegulatoryComplianceStandardsServer RegulatoryComplianceStandardsServer - SQLVulnerabilityAssessmentBaselineRulesServer SQLVulnerabilityAssessmentBaselineRulesServer - SQLVulnerabilityAssessmentScanResultsServer SQLVulnerabilityAssessmentScanResultsServer - SQLVulnerabilityAssessmentScansServer SQLVulnerabilityAssessmentScansServer - SecureScoreControlDefinitionsServer SecureScoreControlDefinitionsServer - SecureScoreControlsServer SecureScoreControlsServer - SecureScoresServer SecureScoresServer - SensitivitySettingsServer SensitivitySettingsServer - ServerVulnerabilityAssessmentServer ServerVulnerabilityAssessmentServer - ServerVulnerabilityAssessmentsSettingsServer ServerVulnerabilityAssessmentsSettingsServer - SettingsServer SettingsServer - SoftwareInventoriesServer SoftwareInventoriesServer - SolutionsServer SolutionsServer - SolutionsReferenceDataServer SolutionsReferenceDataServer - SubAssessmentsServer SubAssessmentsServer - TasksServer TasksServer - TopologyServer TopologyServer - WorkspaceSettingsServer WorkspaceSettingsServer + + // IotSecuritySolutionsAnalyticsRecommendationServer contains the fakes for client IotSecuritySolutionsAnalyticsRecommendationClient + IotSecuritySolutionsAnalyticsRecommendationServer IotSecuritySolutionsAnalyticsRecommendationServer + + // JitNetworkAccessPoliciesServer contains the fakes for client JitNetworkAccessPoliciesClient + JitNetworkAccessPoliciesServer JitNetworkAccessPoliciesServer + + // LocationsServer contains the fakes for client LocationsClient + LocationsServer LocationsServer + + // MdeOnboardingsServer contains the fakes for client MdeOnboardingsClient + MdeOnboardingsServer MdeOnboardingsServer + + // OperationResultsServer contains the fakes for client OperationResultsClient + OperationResultsServer OperationResultsServer + + // OperationStatusesServer contains the fakes for client OperationStatusesClient + OperationStatusesServer OperationStatusesServer + + // OperationsServer contains the fakes for client OperationsClient + OperationsServer OperationsServer + + // OperatorsServer contains the fakes for client OperatorsClient + OperatorsServer OperatorsServer + + // PricingsServer contains the fakes for client PricingsClient + PricingsServer PricingsServer + + // PrivateEndpointConnectionsServer contains the fakes for client PrivateEndpointConnectionsClient + PrivateEndpointConnectionsServer PrivateEndpointConnectionsServer + + // PrivateLinkResourcesServer contains the fakes for client PrivateLinkResourcesClient + PrivateLinkResourcesServer PrivateLinkResourcesServer + + // PrivateLinksServer contains the fakes for client PrivateLinksClient + PrivateLinksServer PrivateLinksServer + + // RegulatoryComplianceAssessmentsServer contains the fakes for client RegulatoryComplianceAssessmentsClient + RegulatoryComplianceAssessmentsServer RegulatoryComplianceAssessmentsServer + + // RegulatoryComplianceControlsServer contains the fakes for client RegulatoryComplianceControlsClient + RegulatoryComplianceControlsServer RegulatoryComplianceControlsServer + + // RegulatoryComplianceStandardsServer contains the fakes for client RegulatoryComplianceStandardsClient + RegulatoryComplianceStandardsServer RegulatoryComplianceStandardsServer + + // SQLVulnerabilityAssessmentBaselineRulesServer contains the fakes for client SQLVulnerabilityAssessmentBaselineRulesClient + SQLVulnerabilityAssessmentBaselineRulesServer SQLVulnerabilityAssessmentBaselineRulesServer + + // SQLVulnerabilityAssessmentScanResultsServer contains the fakes for client SQLVulnerabilityAssessmentScanResultsClient + SQLVulnerabilityAssessmentScanResultsServer SQLVulnerabilityAssessmentScanResultsServer + + // SQLVulnerabilityAssessmentScansServer contains the fakes for client SQLVulnerabilityAssessmentScansClient + SQLVulnerabilityAssessmentScansServer SQLVulnerabilityAssessmentScansServer + + // SQLVulnerabilityAssessmentSettingsServer contains the fakes for client SQLVulnerabilityAssessmentSettingsClient + SQLVulnerabilityAssessmentSettingsServer SQLVulnerabilityAssessmentSettingsServer + + // SecureScoreControlDefinitionsServer contains the fakes for client SecureScoreControlDefinitionsClient + SecureScoreControlDefinitionsServer SecureScoreControlDefinitionsServer + + // SecureScoreControlsServer contains the fakes for client SecureScoreControlsClient + SecureScoreControlsServer SecureScoreControlsServer + + // SecureScoresServer contains the fakes for client SecureScoresClient + SecureScoresServer SecureScoresServer + + // SensitivitySettingsServer contains the fakes for client SensitivitySettingsClient + SensitivitySettingsServer SensitivitySettingsServer + + // ServerVulnerabilityAssessmentServer contains the fakes for client ServerVulnerabilityAssessmentClient + ServerVulnerabilityAssessmentServer ServerVulnerabilityAssessmentServer + + // ServerVulnerabilityAssessmentsSettingsServer contains the fakes for client ServerVulnerabilityAssessmentsSettingsClient + ServerVulnerabilityAssessmentsSettingsServer ServerVulnerabilityAssessmentsSettingsServer + + // SettingsServer contains the fakes for client SettingsClient + SettingsServer SettingsServer + + // SolutionsServer contains the fakes for client SolutionsClient + SolutionsServer SolutionsServer + + // SolutionsReferenceDataServer contains the fakes for client SolutionsReferenceDataClient + SolutionsReferenceDataServer SolutionsReferenceDataServer + + // StandardAssignmentsServer contains the fakes for client StandardAssignmentsClient + StandardAssignmentsServer StandardAssignmentsServer + + // StandardsServer contains the fakes for client StandardsClient + StandardsServer StandardsServer + + // StandardsServer contains the fakes for client StandardsClient + StandardsServer StandardsServer + + // SubAssessmentsServer contains the fakes for client SubAssessmentsClient + SubAssessmentsServer SubAssessmentsServer + + // TasksServer contains the fakes for client TasksClient + TasksServer TasksServer + + // TopologyServer contains the fakes for client TopologyClient + TopologyServer TopologyServer + + // WorkspaceSettingsServer contains the fakes for client WorkspaceSettingsClient + WorkspaceSettingsServer WorkspaceSettingsServer } // NewServerFactoryTransport creates a new instance of ServerFactoryTransport with the provided implementation. @@ -103,9 +259,6 @@ type ServerFactoryTransport struct { srv *ServerFactory trMu sync.Mutex trAPICollectionsServer *APICollectionsServerTransport - trAccountConnectorsServer *AccountConnectorsServerTransport - trAdaptiveApplicationControlsServer *AdaptiveApplicationControlsServerTransport - trAdaptiveNetworkHardeningsServer *AdaptiveNetworkHardeningsServerTransport trAdvancedThreatProtectionServer *AdvancedThreatProtectionServerTransport trAlertsServer *AlertsServerTransport trAlertsSuppressionRulesServer *AlertsSuppressionRulesServerTransport @@ -114,6 +267,7 @@ type ServerFactoryTransport struct { trApplicationsServer *ApplicationsServerTransport trAssessmentsServer *AssessmentsServerTransport trAssessmentsMetadataServer *AssessmentsMetadataServerTransport + trAssignmentsServer *AssignmentsServerTransport trAutoProvisioningSettingsServer *AutoProvisioningSettingsServerTransport trAutomationsServer *AutomationsServerTransport trAzureDevOpsOrgsServer *AzureDevOpsOrgsServerTransport @@ -125,14 +279,14 @@ type ServerFactoryTransport struct { trConnectorApplicationsServer *ConnectorApplicationsServerTransport trConnectorsServer *ConnectorsServerTransport trContactsServer *ContactsServerTransport - trCustomAssessmentAutomationsServer *CustomAssessmentAutomationsServerTransport - trCustomEntityStoreAssignmentsServer *CustomEntityStoreAssignmentsServerTransport + trCustomRecommendationsServer *CustomRecommendationsServerTransport trDefenderForStorageServer *DefenderForStorageServerTransport trDevOpsConfigurationsServer *DevOpsConfigurationsServerTransport trDevOpsOperationResultsServer *DevOpsOperationResultsServerTransport trDeviceSecurityGroupsServer *DeviceSecurityGroupsServerTransport trDiscoveredSecuritySolutionsServer *DiscoveredSecuritySolutionsServerTransport trExternalSecuritySolutionsServer *ExternalSecuritySolutionsServerTransport + trGitHubIssuesServer *GitHubIssuesServerTransport trGitHubOwnersServer *GitHubOwnersServerTransport trGitHubReposServer *GitHubReposServerTransport trGitLabGroupsServer *GitLabGroupsServerTransport @@ -149,15 +303,21 @@ type ServerFactoryTransport struct { trJitNetworkAccessPoliciesServer *JitNetworkAccessPoliciesServerTransport trLocationsServer *LocationsServerTransport trMdeOnboardingsServer *MdeOnboardingsServerTransport + trOperationResultsServer *OperationResultsServerTransport + trOperationStatusesServer *OperationStatusesServerTransport trOperationsServer *OperationsServerTransport trOperatorsServer *OperatorsServerTransport trPricingsServer *PricingsServerTransport + trPrivateEndpointConnectionsServer *PrivateEndpointConnectionsServerTransport + trPrivateLinkResourcesServer *PrivateLinkResourcesServerTransport + trPrivateLinksServer *PrivateLinksServerTransport trRegulatoryComplianceAssessmentsServer *RegulatoryComplianceAssessmentsServerTransport trRegulatoryComplianceControlsServer *RegulatoryComplianceControlsServerTransport trRegulatoryComplianceStandardsServer *RegulatoryComplianceStandardsServerTransport trSQLVulnerabilityAssessmentBaselineRulesServer *SQLVulnerabilityAssessmentBaselineRulesServerTransport trSQLVulnerabilityAssessmentScanResultsServer *SQLVulnerabilityAssessmentScanResultsServerTransport trSQLVulnerabilityAssessmentScansServer *SQLVulnerabilityAssessmentScansServerTransport + trSQLVulnerabilityAssessmentSettingsServer *SQLVulnerabilityAssessmentSettingsServerTransport trSecureScoreControlDefinitionsServer *SecureScoreControlDefinitionsServerTransport trSecureScoreControlsServer *SecureScoreControlsServerTransport trSecureScoresServer *SecureScoresServerTransport @@ -165,9 +325,11 @@ type ServerFactoryTransport struct { trServerVulnerabilityAssessmentServer *ServerVulnerabilityAssessmentServerTransport trServerVulnerabilityAssessmentsSettingsServer *ServerVulnerabilityAssessmentsSettingsServerTransport trSettingsServer *SettingsServerTransport - trSoftwareInventoriesServer *SoftwareInventoriesServerTransport trSolutionsServer *SolutionsServerTransport trSolutionsReferenceDataServer *SolutionsReferenceDataServerTransport + trStandardAssignmentsServer *StandardAssignmentsServerTransport + trStandardsServer *StandardsServerTransport + trStandardsServer *StandardsServerTransport trSubAssessmentsServer *SubAssessmentsServerTransport trTasksServer *TasksServerTransport trTopologyServer *TopologyServerTransport @@ -188,312 +350,332 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { switch client { case "APICollectionsClient": - initServer(s, &s.trAPICollectionsServer, func() *APICollectionsServerTransport { + initServer(&s.trMu, &s.trAPICollectionsServer, func() *APICollectionsServerTransport { return NewAPICollectionsServerTransport(&s.srv.APICollectionsServer) }) resp, err = s.trAPICollectionsServer.Do(req) - case "AccountConnectorsClient": - initServer(s, &s.trAccountConnectorsServer, func() *AccountConnectorsServerTransport { - return NewAccountConnectorsServerTransport(&s.srv.AccountConnectorsServer) - }) - resp, err = s.trAccountConnectorsServer.Do(req) - case "AdaptiveApplicationControlsClient": - initServer(s, &s.trAdaptiveApplicationControlsServer, func() *AdaptiveApplicationControlsServerTransport { - return NewAdaptiveApplicationControlsServerTransport(&s.srv.AdaptiveApplicationControlsServer) - }) - resp, err = s.trAdaptiveApplicationControlsServer.Do(req) - case "AdaptiveNetworkHardeningsClient": - initServer(s, &s.trAdaptiveNetworkHardeningsServer, func() *AdaptiveNetworkHardeningsServerTransport { - return NewAdaptiveNetworkHardeningsServerTransport(&s.srv.AdaptiveNetworkHardeningsServer) - }) - resp, err = s.trAdaptiveNetworkHardeningsServer.Do(req) case "AdvancedThreatProtectionClient": - initServer(s, &s.trAdvancedThreatProtectionServer, func() *AdvancedThreatProtectionServerTransport { + initServer(&s.trMu, &s.trAdvancedThreatProtectionServer, func() *AdvancedThreatProtectionServerTransport { return NewAdvancedThreatProtectionServerTransport(&s.srv.AdvancedThreatProtectionServer) }) resp, err = s.trAdvancedThreatProtectionServer.Do(req) case "AlertsClient": - initServer(s, &s.trAlertsServer, func() *AlertsServerTransport { return NewAlertsServerTransport(&s.srv.AlertsServer) }) + initServer(&s.trMu, &s.trAlertsServer, func() *AlertsServerTransport { return NewAlertsServerTransport(&s.srv.AlertsServer) }) resp, err = s.trAlertsServer.Do(req) case "AlertsSuppressionRulesClient": - initServer(s, &s.trAlertsSuppressionRulesServer, func() *AlertsSuppressionRulesServerTransport { + initServer(&s.trMu, &s.trAlertsSuppressionRulesServer, func() *AlertsSuppressionRulesServerTransport { return NewAlertsSuppressionRulesServerTransport(&s.srv.AlertsSuppressionRulesServer) }) resp, err = s.trAlertsSuppressionRulesServer.Do(req) case "AllowedConnectionsClient": - initServer(s, &s.trAllowedConnectionsServer, func() *AllowedConnectionsServerTransport { + initServer(&s.trMu, &s.trAllowedConnectionsServer, func() *AllowedConnectionsServerTransport { return NewAllowedConnectionsServerTransport(&s.srv.AllowedConnectionsServer) }) resp, err = s.trAllowedConnectionsServer.Do(req) case "ApplicationClient": - initServer(s, &s.trApplicationServer, func() *ApplicationServerTransport { return NewApplicationServerTransport(&s.srv.ApplicationServer) }) + initServer(&s.trMu, &s.trApplicationServer, func() *ApplicationServerTransport { return NewApplicationServerTransport(&s.srv.ApplicationServer) }) resp, err = s.trApplicationServer.Do(req) case "ApplicationsClient": - initServer(s, &s.trApplicationsServer, func() *ApplicationsServerTransport { return NewApplicationsServerTransport(&s.srv.ApplicationsServer) }) + initServer(&s.trMu, &s.trApplicationsServer, func() *ApplicationsServerTransport { return NewApplicationsServerTransport(&s.srv.ApplicationsServer) }) resp, err = s.trApplicationsServer.Do(req) case "AssessmentsClient": - initServer(s, &s.trAssessmentsServer, func() *AssessmentsServerTransport { return NewAssessmentsServerTransport(&s.srv.AssessmentsServer) }) + initServer(&s.trMu, &s.trAssessmentsServer, func() *AssessmentsServerTransport { return NewAssessmentsServerTransport(&s.srv.AssessmentsServer) }) resp, err = s.trAssessmentsServer.Do(req) case "AssessmentsMetadataClient": - initServer(s, &s.trAssessmentsMetadataServer, func() *AssessmentsMetadataServerTransport { + initServer(&s.trMu, &s.trAssessmentsMetadataServer, func() *AssessmentsMetadataServerTransport { return NewAssessmentsMetadataServerTransport(&s.srv.AssessmentsMetadataServer) }) resp, err = s.trAssessmentsMetadataServer.Do(req) + case "AssignmentsClient": + initServer(&s.trMu, &s.trAssignmentsServer, func() *AssignmentsServerTransport { return NewAssignmentsServerTransport(&s.srv.AssignmentsServer) }) + resp, err = s.trAssignmentsServer.Do(req) case "AutoProvisioningSettingsClient": - initServer(s, &s.trAutoProvisioningSettingsServer, func() *AutoProvisioningSettingsServerTransport { + initServer(&s.trMu, &s.trAutoProvisioningSettingsServer, func() *AutoProvisioningSettingsServerTransport { return NewAutoProvisioningSettingsServerTransport(&s.srv.AutoProvisioningSettingsServer) }) resp, err = s.trAutoProvisioningSettingsServer.Do(req) case "AutomationsClient": - initServer(s, &s.trAutomationsServer, func() *AutomationsServerTransport { return NewAutomationsServerTransport(&s.srv.AutomationsServer) }) + initServer(&s.trMu, &s.trAutomationsServer, func() *AutomationsServerTransport { return NewAutomationsServerTransport(&s.srv.AutomationsServer) }) resp, err = s.trAutomationsServer.Do(req) case "AzureDevOpsOrgsClient": - initServer(s, &s.trAzureDevOpsOrgsServer, func() *AzureDevOpsOrgsServerTransport { + initServer(&s.trMu, &s.trAzureDevOpsOrgsServer, func() *AzureDevOpsOrgsServerTransport { return NewAzureDevOpsOrgsServerTransport(&s.srv.AzureDevOpsOrgsServer) }) resp, err = s.trAzureDevOpsOrgsServer.Do(req) case "AzureDevOpsProjectsClient": - initServer(s, &s.trAzureDevOpsProjectsServer, func() *AzureDevOpsProjectsServerTransport { + initServer(&s.trMu, &s.trAzureDevOpsProjectsServer, func() *AzureDevOpsProjectsServerTransport { return NewAzureDevOpsProjectsServerTransport(&s.srv.AzureDevOpsProjectsServer) }) resp, err = s.trAzureDevOpsProjectsServer.Do(req) case "AzureDevOpsReposClient": - initServer(s, &s.trAzureDevOpsReposServer, func() *AzureDevOpsReposServerTransport { + initServer(&s.trMu, &s.trAzureDevOpsReposServer, func() *AzureDevOpsReposServerTransport { return NewAzureDevOpsReposServerTransport(&s.srv.AzureDevOpsReposServer) }) resp, err = s.trAzureDevOpsReposServer.Do(req) case "ComplianceResultsClient": - initServer(s, &s.trComplianceResultsServer, func() *ComplianceResultsServerTransport { + initServer(&s.trMu, &s.trComplianceResultsServer, func() *ComplianceResultsServerTransport { return NewComplianceResultsServerTransport(&s.srv.ComplianceResultsServer) }) resp, err = s.trComplianceResultsServer.Do(req) case "CompliancesClient": - initServer(s, &s.trCompliancesServer, func() *CompliancesServerTransport { return NewCompliancesServerTransport(&s.srv.CompliancesServer) }) + initServer(&s.trMu, &s.trCompliancesServer, func() *CompliancesServerTransport { return NewCompliancesServerTransport(&s.srv.CompliancesServer) }) resp, err = s.trCompliancesServer.Do(req) case "ConnectorApplicationClient": - initServer(s, &s.trConnectorApplicationServer, func() *ConnectorApplicationServerTransport { + initServer(&s.trMu, &s.trConnectorApplicationServer, func() *ConnectorApplicationServerTransport { return NewConnectorApplicationServerTransport(&s.srv.ConnectorApplicationServer) }) resp, err = s.trConnectorApplicationServer.Do(req) case "ConnectorApplicationsClient": - initServer(s, &s.trConnectorApplicationsServer, func() *ConnectorApplicationsServerTransport { + initServer(&s.trMu, &s.trConnectorApplicationsServer, func() *ConnectorApplicationsServerTransport { return NewConnectorApplicationsServerTransport(&s.srv.ConnectorApplicationsServer) }) resp, err = s.trConnectorApplicationsServer.Do(req) case "ConnectorsClient": - initServer(s, &s.trConnectorsServer, func() *ConnectorsServerTransport { return NewConnectorsServerTransport(&s.srv.ConnectorsServer) }) + initServer(&s.trMu, &s.trConnectorsServer, func() *ConnectorsServerTransport { return NewConnectorsServerTransport(&s.srv.ConnectorsServer) }) resp, err = s.trConnectorsServer.Do(req) case "ContactsClient": - initServer(s, &s.trContactsServer, func() *ContactsServerTransport { return NewContactsServerTransport(&s.srv.ContactsServer) }) + initServer(&s.trMu, &s.trContactsServer, func() *ContactsServerTransport { return NewContactsServerTransport(&s.srv.ContactsServer) }) resp, err = s.trContactsServer.Do(req) - case "CustomAssessmentAutomationsClient": - initServer(s, &s.trCustomAssessmentAutomationsServer, func() *CustomAssessmentAutomationsServerTransport { - return NewCustomAssessmentAutomationsServerTransport(&s.srv.CustomAssessmentAutomationsServer) - }) - resp, err = s.trCustomAssessmentAutomationsServer.Do(req) - case "CustomEntityStoreAssignmentsClient": - initServer(s, &s.trCustomEntityStoreAssignmentsServer, func() *CustomEntityStoreAssignmentsServerTransport { - return NewCustomEntityStoreAssignmentsServerTransport(&s.srv.CustomEntityStoreAssignmentsServer) + case "CustomRecommendationsClient": + initServer(&s.trMu, &s.trCustomRecommendationsServer, func() *CustomRecommendationsServerTransport { + return NewCustomRecommendationsServerTransport(&s.srv.CustomRecommendationsServer) }) - resp, err = s.trCustomEntityStoreAssignmentsServer.Do(req) + resp, err = s.trCustomRecommendationsServer.Do(req) case "DefenderForStorageClient": - initServer(s, &s.trDefenderForStorageServer, func() *DefenderForStorageServerTransport { + initServer(&s.trMu, &s.trDefenderForStorageServer, func() *DefenderForStorageServerTransport { return NewDefenderForStorageServerTransport(&s.srv.DefenderForStorageServer) }) resp, err = s.trDefenderForStorageServer.Do(req) case "DevOpsConfigurationsClient": - initServer(s, &s.trDevOpsConfigurationsServer, func() *DevOpsConfigurationsServerTransport { + initServer(&s.trMu, &s.trDevOpsConfigurationsServer, func() *DevOpsConfigurationsServerTransport { return NewDevOpsConfigurationsServerTransport(&s.srv.DevOpsConfigurationsServer) }) resp, err = s.trDevOpsConfigurationsServer.Do(req) case "DevOpsOperationResultsClient": - initServer(s, &s.trDevOpsOperationResultsServer, func() *DevOpsOperationResultsServerTransport { + initServer(&s.trMu, &s.trDevOpsOperationResultsServer, func() *DevOpsOperationResultsServerTransport { return NewDevOpsOperationResultsServerTransport(&s.srv.DevOpsOperationResultsServer) }) resp, err = s.trDevOpsOperationResultsServer.Do(req) case "DeviceSecurityGroupsClient": - initServer(s, &s.trDeviceSecurityGroupsServer, func() *DeviceSecurityGroupsServerTransport { + initServer(&s.trMu, &s.trDeviceSecurityGroupsServer, func() *DeviceSecurityGroupsServerTransport { return NewDeviceSecurityGroupsServerTransport(&s.srv.DeviceSecurityGroupsServer) }) resp, err = s.trDeviceSecurityGroupsServer.Do(req) case "DiscoveredSecuritySolutionsClient": - initServer(s, &s.trDiscoveredSecuritySolutionsServer, func() *DiscoveredSecuritySolutionsServerTransport { + initServer(&s.trMu, &s.trDiscoveredSecuritySolutionsServer, func() *DiscoveredSecuritySolutionsServerTransport { return NewDiscoveredSecuritySolutionsServerTransport(&s.srv.DiscoveredSecuritySolutionsServer) }) resp, err = s.trDiscoveredSecuritySolutionsServer.Do(req) case "ExternalSecuritySolutionsClient": - initServer(s, &s.trExternalSecuritySolutionsServer, func() *ExternalSecuritySolutionsServerTransport { + initServer(&s.trMu, &s.trExternalSecuritySolutionsServer, func() *ExternalSecuritySolutionsServerTransport { return NewExternalSecuritySolutionsServerTransport(&s.srv.ExternalSecuritySolutionsServer) }) resp, err = s.trExternalSecuritySolutionsServer.Do(req) + case "GitHubIssuesClient": + initServer(&s.trMu, &s.trGitHubIssuesServer, func() *GitHubIssuesServerTransport { return NewGitHubIssuesServerTransport(&s.srv.GitHubIssuesServer) }) + resp, err = s.trGitHubIssuesServer.Do(req) case "GitHubOwnersClient": - initServer(s, &s.trGitHubOwnersServer, func() *GitHubOwnersServerTransport { return NewGitHubOwnersServerTransport(&s.srv.GitHubOwnersServer) }) + initServer(&s.trMu, &s.trGitHubOwnersServer, func() *GitHubOwnersServerTransport { return NewGitHubOwnersServerTransport(&s.srv.GitHubOwnersServer) }) resp, err = s.trGitHubOwnersServer.Do(req) case "GitHubReposClient": - initServer(s, &s.trGitHubReposServer, func() *GitHubReposServerTransport { return NewGitHubReposServerTransport(&s.srv.GitHubReposServer) }) + initServer(&s.trMu, &s.trGitHubReposServer, func() *GitHubReposServerTransport { return NewGitHubReposServerTransport(&s.srv.GitHubReposServer) }) resp, err = s.trGitHubReposServer.Do(req) case "GitLabGroupsClient": - initServer(s, &s.trGitLabGroupsServer, func() *GitLabGroupsServerTransport { return NewGitLabGroupsServerTransport(&s.srv.GitLabGroupsServer) }) + initServer(&s.trMu, &s.trGitLabGroupsServer, func() *GitLabGroupsServerTransport { return NewGitLabGroupsServerTransport(&s.srv.GitLabGroupsServer) }) resp, err = s.trGitLabGroupsServer.Do(req) case "GitLabProjectsClient": - initServer(s, &s.trGitLabProjectsServer, func() *GitLabProjectsServerTransport { + initServer(&s.trMu, &s.trGitLabProjectsServer, func() *GitLabProjectsServerTransport { return NewGitLabProjectsServerTransport(&s.srv.GitLabProjectsServer) }) resp, err = s.trGitLabProjectsServer.Do(req) case "GitLabSubgroupsClient": - initServer(s, &s.trGitLabSubgroupsServer, func() *GitLabSubgroupsServerTransport { + initServer(&s.trMu, &s.trGitLabSubgroupsServer, func() *GitLabSubgroupsServerTransport { return NewGitLabSubgroupsServerTransport(&s.srv.GitLabSubgroupsServer) }) resp, err = s.trGitLabSubgroupsServer.Do(req) case "GovernanceAssignmentsClient": - initServer(s, &s.trGovernanceAssignmentsServer, func() *GovernanceAssignmentsServerTransport { + initServer(&s.trMu, &s.trGovernanceAssignmentsServer, func() *GovernanceAssignmentsServerTransport { return NewGovernanceAssignmentsServerTransport(&s.srv.GovernanceAssignmentsServer) }) resp, err = s.trGovernanceAssignmentsServer.Do(req) case "GovernanceRulesClient": - initServer(s, &s.trGovernanceRulesServer, func() *GovernanceRulesServerTransport { + initServer(&s.trMu, &s.trGovernanceRulesServer, func() *GovernanceRulesServerTransport { return NewGovernanceRulesServerTransport(&s.srv.GovernanceRulesServer) }) resp, err = s.trGovernanceRulesServer.Do(req) case "HealthReportsClient": - initServer(s, &s.trHealthReportsServer, func() *HealthReportsServerTransport { + initServer(&s.trMu, &s.trHealthReportsServer, func() *HealthReportsServerTransport { return NewHealthReportsServerTransport(&s.srv.HealthReportsServer) }) resp, err = s.trHealthReportsServer.Do(req) case "InformationProtectionPoliciesClient": - initServer(s, &s.trInformationProtectionPoliciesServer, func() *InformationProtectionPoliciesServerTransport { + initServer(&s.trMu, &s.trInformationProtectionPoliciesServer, func() *InformationProtectionPoliciesServerTransport { return NewInformationProtectionPoliciesServerTransport(&s.srv.InformationProtectionPoliciesServer) }) resp, err = s.trInformationProtectionPoliciesServer.Do(req) case "IotSecuritySolutionAnalyticsClient": - initServer(s, &s.trIotSecuritySolutionAnalyticsServer, func() *IotSecuritySolutionAnalyticsServerTransport { + initServer(&s.trMu, &s.trIotSecuritySolutionAnalyticsServer, func() *IotSecuritySolutionAnalyticsServerTransport { return NewIotSecuritySolutionAnalyticsServerTransport(&s.srv.IotSecuritySolutionAnalyticsServer) }) resp, err = s.trIotSecuritySolutionAnalyticsServer.Do(req) case "IotSecuritySolutionClient": - initServer(s, &s.trIotSecuritySolutionServer, func() *IotSecuritySolutionServerTransport { + initServer(&s.trMu, &s.trIotSecuritySolutionServer, func() *IotSecuritySolutionServerTransport { return NewIotSecuritySolutionServerTransport(&s.srv.IotSecuritySolutionServer) }) resp, err = s.trIotSecuritySolutionServer.Do(req) case "IotSecuritySolutionsAnalyticsAggregatedAlertClient": - initServer(s, &s.trIotSecuritySolutionsAnalyticsAggregatedAlertServer, func() *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport { + initServer(&s.trMu, &s.trIotSecuritySolutionsAnalyticsAggregatedAlertServer, func() *IotSecuritySolutionsAnalyticsAggregatedAlertServerTransport { return NewIotSecuritySolutionsAnalyticsAggregatedAlertServerTransport(&s.srv.IotSecuritySolutionsAnalyticsAggregatedAlertServer) }) resp, err = s.trIotSecuritySolutionsAnalyticsAggregatedAlertServer.Do(req) case "IotSecuritySolutionsAnalyticsRecommendationClient": - initServer(s, &s.trIotSecuritySolutionsAnalyticsRecommendationServer, func() *IotSecuritySolutionsAnalyticsRecommendationServerTransport { + initServer(&s.trMu, &s.trIotSecuritySolutionsAnalyticsRecommendationServer, func() *IotSecuritySolutionsAnalyticsRecommendationServerTransport { return NewIotSecuritySolutionsAnalyticsRecommendationServerTransport(&s.srv.IotSecuritySolutionsAnalyticsRecommendationServer) }) resp, err = s.trIotSecuritySolutionsAnalyticsRecommendationServer.Do(req) case "JitNetworkAccessPoliciesClient": - initServer(s, &s.trJitNetworkAccessPoliciesServer, func() *JitNetworkAccessPoliciesServerTransport { + initServer(&s.trMu, &s.trJitNetworkAccessPoliciesServer, func() *JitNetworkAccessPoliciesServerTransport { return NewJitNetworkAccessPoliciesServerTransport(&s.srv.JitNetworkAccessPoliciesServer) }) resp, err = s.trJitNetworkAccessPoliciesServer.Do(req) case "LocationsClient": - initServer(s, &s.trLocationsServer, func() *LocationsServerTransport { return NewLocationsServerTransport(&s.srv.LocationsServer) }) + initServer(&s.trMu, &s.trLocationsServer, func() *LocationsServerTransport { return NewLocationsServerTransport(&s.srv.LocationsServer) }) resp, err = s.trLocationsServer.Do(req) case "MdeOnboardingsClient": - initServer(s, &s.trMdeOnboardingsServer, func() *MdeOnboardingsServerTransport { + initServer(&s.trMu, &s.trMdeOnboardingsServer, func() *MdeOnboardingsServerTransport { return NewMdeOnboardingsServerTransport(&s.srv.MdeOnboardingsServer) }) resp, err = s.trMdeOnboardingsServer.Do(req) + case "OperationResultsClient": + initServer(&s.trMu, &s.trOperationResultsServer, func() *OperationResultsServerTransport { + return NewOperationResultsServerTransport(&s.srv.OperationResultsServer) + }) + resp, err = s.trOperationResultsServer.Do(req) + case "OperationStatusesClient": + initServer(&s.trMu, &s.trOperationStatusesServer, func() *OperationStatusesServerTransport { + return NewOperationStatusesServerTransport(&s.srv.OperationStatusesServer) + }) + resp, err = s.trOperationStatusesServer.Do(req) case "OperationsClient": - initServer(s, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) + initServer(&s.trMu, &s.trOperationsServer, func() *OperationsServerTransport { return NewOperationsServerTransport(&s.srv.OperationsServer) }) resp, err = s.trOperationsServer.Do(req) case "OperatorsClient": - initServer(s, &s.trOperatorsServer, func() *OperatorsServerTransport { return NewOperatorsServerTransport(&s.srv.OperatorsServer) }) + initServer(&s.trMu, &s.trOperatorsServer, func() *OperatorsServerTransport { return NewOperatorsServerTransport(&s.srv.OperatorsServer) }) resp, err = s.trOperatorsServer.Do(req) case "PricingsClient": - initServer(s, &s.trPricingsServer, func() *PricingsServerTransport { return NewPricingsServerTransport(&s.srv.PricingsServer) }) + initServer(&s.trMu, &s.trPricingsServer, func() *PricingsServerTransport { return NewPricingsServerTransport(&s.srv.PricingsServer) }) resp, err = s.trPricingsServer.Do(req) + case "PrivateEndpointConnectionsClient": + initServer(&s.trMu, &s.trPrivateEndpointConnectionsServer, func() *PrivateEndpointConnectionsServerTransport { + return NewPrivateEndpointConnectionsServerTransport(&s.srv.PrivateEndpointConnectionsServer) + }) + resp, err = s.trPrivateEndpointConnectionsServer.Do(req) + case "PrivateLinkResourcesClient": + initServer(&s.trMu, &s.trPrivateLinkResourcesServer, func() *PrivateLinkResourcesServerTransport { + return NewPrivateLinkResourcesServerTransport(&s.srv.PrivateLinkResourcesServer) + }) + resp, err = s.trPrivateLinkResourcesServer.Do(req) + case "PrivateLinksClient": + initServer(&s.trMu, &s.trPrivateLinksServer, func() *PrivateLinksServerTransport { return NewPrivateLinksServerTransport(&s.srv.PrivateLinksServer) }) + resp, err = s.trPrivateLinksServer.Do(req) case "RegulatoryComplianceAssessmentsClient": - initServer(s, &s.trRegulatoryComplianceAssessmentsServer, func() *RegulatoryComplianceAssessmentsServerTransport { + initServer(&s.trMu, &s.trRegulatoryComplianceAssessmentsServer, func() *RegulatoryComplianceAssessmentsServerTransport { return NewRegulatoryComplianceAssessmentsServerTransport(&s.srv.RegulatoryComplianceAssessmentsServer) }) resp, err = s.trRegulatoryComplianceAssessmentsServer.Do(req) case "RegulatoryComplianceControlsClient": - initServer(s, &s.trRegulatoryComplianceControlsServer, func() *RegulatoryComplianceControlsServerTransport { + initServer(&s.trMu, &s.trRegulatoryComplianceControlsServer, func() *RegulatoryComplianceControlsServerTransport { return NewRegulatoryComplianceControlsServerTransport(&s.srv.RegulatoryComplianceControlsServer) }) resp, err = s.trRegulatoryComplianceControlsServer.Do(req) case "RegulatoryComplianceStandardsClient": - initServer(s, &s.trRegulatoryComplianceStandardsServer, func() *RegulatoryComplianceStandardsServerTransport { + initServer(&s.trMu, &s.trRegulatoryComplianceStandardsServer, func() *RegulatoryComplianceStandardsServerTransport { return NewRegulatoryComplianceStandardsServerTransport(&s.srv.RegulatoryComplianceStandardsServer) }) resp, err = s.trRegulatoryComplianceStandardsServer.Do(req) case "SQLVulnerabilityAssessmentBaselineRulesClient": - initServer(s, &s.trSQLVulnerabilityAssessmentBaselineRulesServer, func() *SQLVulnerabilityAssessmentBaselineRulesServerTransport { + initServer(&s.trMu, &s.trSQLVulnerabilityAssessmentBaselineRulesServer, func() *SQLVulnerabilityAssessmentBaselineRulesServerTransport { return NewSQLVulnerabilityAssessmentBaselineRulesServerTransport(&s.srv.SQLVulnerabilityAssessmentBaselineRulesServer) }) resp, err = s.trSQLVulnerabilityAssessmentBaselineRulesServer.Do(req) case "SQLVulnerabilityAssessmentScanResultsClient": - initServer(s, &s.trSQLVulnerabilityAssessmentScanResultsServer, func() *SQLVulnerabilityAssessmentScanResultsServerTransport { + initServer(&s.trMu, &s.trSQLVulnerabilityAssessmentScanResultsServer, func() *SQLVulnerabilityAssessmentScanResultsServerTransport { return NewSQLVulnerabilityAssessmentScanResultsServerTransport(&s.srv.SQLVulnerabilityAssessmentScanResultsServer) }) resp, err = s.trSQLVulnerabilityAssessmentScanResultsServer.Do(req) case "SQLVulnerabilityAssessmentScansClient": - initServer(s, &s.trSQLVulnerabilityAssessmentScansServer, func() *SQLVulnerabilityAssessmentScansServerTransport { + initServer(&s.trMu, &s.trSQLVulnerabilityAssessmentScansServer, func() *SQLVulnerabilityAssessmentScansServerTransport { return NewSQLVulnerabilityAssessmentScansServerTransport(&s.srv.SQLVulnerabilityAssessmentScansServer) }) resp, err = s.trSQLVulnerabilityAssessmentScansServer.Do(req) + case "SQLVulnerabilityAssessmentSettingsClient": + initServer(&s.trMu, &s.trSQLVulnerabilityAssessmentSettingsServer, func() *SQLVulnerabilityAssessmentSettingsServerTransport { + return NewSQLVulnerabilityAssessmentSettingsServerTransport(&s.srv.SQLVulnerabilityAssessmentSettingsServer) + }) + resp, err = s.trSQLVulnerabilityAssessmentSettingsServer.Do(req) case "SecureScoreControlDefinitionsClient": - initServer(s, &s.trSecureScoreControlDefinitionsServer, func() *SecureScoreControlDefinitionsServerTransport { + initServer(&s.trMu, &s.trSecureScoreControlDefinitionsServer, func() *SecureScoreControlDefinitionsServerTransport { return NewSecureScoreControlDefinitionsServerTransport(&s.srv.SecureScoreControlDefinitionsServer) }) resp, err = s.trSecureScoreControlDefinitionsServer.Do(req) case "SecureScoreControlsClient": - initServer(s, &s.trSecureScoreControlsServer, func() *SecureScoreControlsServerTransport { + initServer(&s.trMu, &s.trSecureScoreControlsServer, func() *SecureScoreControlsServerTransport { return NewSecureScoreControlsServerTransport(&s.srv.SecureScoreControlsServer) }) resp, err = s.trSecureScoreControlsServer.Do(req) case "SecureScoresClient": - initServer(s, &s.trSecureScoresServer, func() *SecureScoresServerTransport { return NewSecureScoresServerTransport(&s.srv.SecureScoresServer) }) + initServer(&s.trMu, &s.trSecureScoresServer, func() *SecureScoresServerTransport { return NewSecureScoresServerTransport(&s.srv.SecureScoresServer) }) resp, err = s.trSecureScoresServer.Do(req) case "SensitivitySettingsClient": - initServer(s, &s.trSensitivitySettingsServer, func() *SensitivitySettingsServerTransport { + initServer(&s.trMu, &s.trSensitivitySettingsServer, func() *SensitivitySettingsServerTransport { return NewSensitivitySettingsServerTransport(&s.srv.SensitivitySettingsServer) }) resp, err = s.trSensitivitySettingsServer.Do(req) case "ServerVulnerabilityAssessmentClient": - initServer(s, &s.trServerVulnerabilityAssessmentServer, func() *ServerVulnerabilityAssessmentServerTransport { + initServer(&s.trMu, &s.trServerVulnerabilityAssessmentServer, func() *ServerVulnerabilityAssessmentServerTransport { return NewServerVulnerabilityAssessmentServerTransport(&s.srv.ServerVulnerabilityAssessmentServer) }) resp, err = s.trServerVulnerabilityAssessmentServer.Do(req) case "ServerVulnerabilityAssessmentsSettingsClient": - initServer(s, &s.trServerVulnerabilityAssessmentsSettingsServer, func() *ServerVulnerabilityAssessmentsSettingsServerTransport { + initServer(&s.trMu, &s.trServerVulnerabilityAssessmentsSettingsServer, func() *ServerVulnerabilityAssessmentsSettingsServerTransport { return NewServerVulnerabilityAssessmentsSettingsServerTransport(&s.srv.ServerVulnerabilityAssessmentsSettingsServer) }) resp, err = s.trServerVulnerabilityAssessmentsSettingsServer.Do(req) case "SettingsClient": - initServer(s, &s.trSettingsServer, func() *SettingsServerTransport { return NewSettingsServerTransport(&s.srv.SettingsServer) }) + initServer(&s.trMu, &s.trSettingsServer, func() *SettingsServerTransport { return NewSettingsServerTransport(&s.srv.SettingsServer) }) resp, err = s.trSettingsServer.Do(req) - case "SoftwareInventoriesClient": - initServer(s, &s.trSoftwareInventoriesServer, func() *SoftwareInventoriesServerTransport { - return NewSoftwareInventoriesServerTransport(&s.srv.SoftwareInventoriesServer) - }) - resp, err = s.trSoftwareInventoriesServer.Do(req) case "SolutionsClient": - initServer(s, &s.trSolutionsServer, func() *SolutionsServerTransport { return NewSolutionsServerTransport(&s.srv.SolutionsServer) }) + initServer(&s.trMu, &s.trSolutionsServer, func() *SolutionsServerTransport { return NewSolutionsServerTransport(&s.srv.SolutionsServer) }) resp, err = s.trSolutionsServer.Do(req) case "SolutionsReferenceDataClient": - initServer(s, &s.trSolutionsReferenceDataServer, func() *SolutionsReferenceDataServerTransport { + initServer(&s.trMu, &s.trSolutionsReferenceDataServer, func() *SolutionsReferenceDataServerTransport { return NewSolutionsReferenceDataServerTransport(&s.srv.SolutionsReferenceDataServer) }) resp, err = s.trSolutionsReferenceDataServer.Do(req) + case "StandardAssignmentsClient": + initServer(&s.trMu, &s.trStandardAssignmentsServer, func() *StandardAssignmentsServerTransport { + return NewStandardAssignmentsServerTransport(&s.srv.StandardAssignmentsServer) + }) + resp, err = s.trStandardAssignmentsServer.Do(req) + case "StandardsClient": + initServer(&s.trMu, &s.trStandardsServer, func() *StandardsServerTransport { return NewStandardsServerTransport(&s.srv.StandardsServer) }) + resp, err = s.trStandardsServer.Do(req) + case "StandardsClient": + initServer(&s.trMu, &s.trStandardsServer, func() *StandardsServerTransport { return NewStandardsServerTransport(&s.srv.StandardsServer) }) + resp, err = s.trStandardsServer.Do(req) case "SubAssessmentsClient": - initServer(s, &s.trSubAssessmentsServer, func() *SubAssessmentsServerTransport { + initServer(&s.trMu, &s.trSubAssessmentsServer, func() *SubAssessmentsServerTransport { return NewSubAssessmentsServerTransport(&s.srv.SubAssessmentsServer) }) resp, err = s.trSubAssessmentsServer.Do(req) case "TasksClient": - initServer(s, &s.trTasksServer, func() *TasksServerTransport { return NewTasksServerTransport(&s.srv.TasksServer) }) + initServer(&s.trMu, &s.trTasksServer, func() *TasksServerTransport { return NewTasksServerTransport(&s.srv.TasksServer) }) resp, err = s.trTasksServer.Do(req) case "TopologyClient": - initServer(s, &s.trTopologyServer, func() *TopologyServerTransport { return NewTopologyServerTransport(&s.srv.TopologyServer) }) + initServer(&s.trMu, &s.trTopologyServer, func() *TopologyServerTransport { return NewTopologyServerTransport(&s.srv.TopologyServer) }) resp, err = s.trTopologyServer.Do(req) case "WorkspaceSettingsClient": - initServer(s, &s.trWorkspaceSettingsServer, func() *WorkspaceSettingsServerTransport { + initServer(&s.trMu, &s.trWorkspaceSettingsServer, func() *WorkspaceSettingsServerTransport { return NewWorkspaceSettingsServerTransport(&s.srv.WorkspaceSettingsServer) }) resp, err = s.trWorkspaceSettingsServer.Do(req) @@ -507,11 +689,3 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { return resp, nil } - -func initServer[T any](s *ServerFactoryTransport, dst **T, src func() *T) { - s.trMu.Lock() - if *dst == nil { - *dst = src() - } - s.trMu.Unlock() -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/servervulnerabilityassessment_server.go b/sdk/resourcemanager/security/armsecurity/fake/servervulnerabilityassessment_server.go index 373d22bf38c0..281e75d6f32a 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/servervulnerabilityassessment_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/servervulnerabilityassessment_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ServerVulnerabilityAssessmentServer is a fake server for instances of the armsecurity.ServerVulnerabilityAssessmentClient type. @@ -62,27 +62,41 @@ func (s *ServerVulnerabilityAssessmentServerTransport) Do(req *http.Request) (*h return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "ServerVulnerabilityAssessmentClient.CreateOrUpdate": - resp, err = s.dispatchCreateOrUpdate(req) - case "ServerVulnerabilityAssessmentClient.BeginDelete": - resp, err = s.dispatchBeginDelete(req) - case "ServerVulnerabilityAssessmentClient.Get": - resp, err = s.dispatchGet(req) - case "ServerVulnerabilityAssessmentClient.ListByExtendedResource": - resp, err = s.dispatchListByExtendedResource(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *ServerVulnerabilityAssessmentServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if serverVulnerabilityAssessmentServerTransportInterceptor != nil { + res.resp, res.err, intercepted = serverVulnerabilityAssessmentServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ServerVulnerabilityAssessmentClient.CreateOrUpdate": + res.resp, res.err = s.dispatchCreateOrUpdate(req) + case "ServerVulnerabilityAssessmentClient.BeginDelete": + res.resp, res.err = s.dispatchBeginDelete(req) + case "ServerVulnerabilityAssessmentClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "ServerVulnerabilityAssessmentClient.ListByExtendedResource": + res.resp, res.err = s.dispatchListByExtendedResource(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *ServerVulnerabilityAssessmentServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -92,7 +106,7 @@ func (s *ServerVulnerabilityAssessmentServerTransport) dispatchCreateOrUpdate(re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/serverVulnerabilityAssessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -116,7 +130,7 @@ func (s *ServerVulnerabilityAssessmentServerTransport) dispatchCreateOrUpdate(re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusAccepted}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusAccepted}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusAccepted", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerVulnerabilityAssessment, req) @@ -135,7 +149,7 @@ func (s *ServerVulnerabilityAssessmentServerTransport) dispatchBeginDelete(req * const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/serverVulnerabilityAssessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -167,7 +181,7 @@ func (s *ServerVulnerabilityAssessmentServerTransport) dispatchBeginDelete(req * return nil, err } - if !contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted, http.StatusNoContent}, resp.StatusCode) { s.beginDelete.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted, http.StatusNoContent", resp.StatusCode)} } @@ -185,7 +199,7 @@ func (s *ServerVulnerabilityAssessmentServerTransport) dispatchGet(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/serverVulnerabilityAssessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -209,7 +223,7 @@ func (s *ServerVulnerabilityAssessmentServerTransport) dispatchGet(req *http.Req return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerVulnerabilityAssessment, req) @@ -226,7 +240,7 @@ func (s *ServerVulnerabilityAssessmentServerTransport) dispatchListByExtendedRes const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/serverVulnerabilityAssessments` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -250,7 +264,7 @@ func (s *ServerVulnerabilityAssessmentServerTransport) dispatchListByExtendedRes return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerVulnerabilityAssessmentsList, req) @@ -259,3 +273,9 @@ func (s *ServerVulnerabilityAssessmentServerTransport) dispatchListByExtendedRes } return resp, nil } + +// set this to conditionally intercept incoming requests to ServerVulnerabilityAssessmentServerTransport +var serverVulnerabilityAssessmentServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/servervulnerabilityassessmentssettings_server.go b/sdk/resourcemanager/security/armsecurity/fake/servervulnerabilityassessmentssettings_server.go index 4f93c52bc245..b2ec3d10038c 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/servervulnerabilityassessmentssettings_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/servervulnerabilityassessmentssettings_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // ServerVulnerabilityAssessmentsSettingsServer is a fake server for instances of the armsecurity.ServerVulnerabilityAssessmentsSettingsClient type. @@ -63,27 +63,41 @@ func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) Do(req *http.Req return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "ServerVulnerabilityAssessmentsSettingsClient.CreateOrUpdate": - resp, err = s.dispatchCreateOrUpdate(req) - case "ServerVulnerabilityAssessmentsSettingsClient.Delete": - resp, err = s.dispatchDelete(req) - case "ServerVulnerabilityAssessmentsSettingsClient.Get": - resp, err = s.dispatchGet(req) - case "ServerVulnerabilityAssessmentsSettingsClient.NewListBySubscriptionPager": - resp, err = s.dispatchNewListBySubscriptionPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if serverVulnerabilityAssessmentsSettingsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = serverVulnerabilityAssessmentsSettingsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ServerVulnerabilityAssessmentsSettingsClient.CreateOrUpdate": + res.resp, res.err = s.dispatchCreateOrUpdate(req) + case "ServerVulnerabilityAssessmentsSettingsClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "ServerVulnerabilityAssessmentsSettingsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "ServerVulnerabilityAssessmentsSettingsClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { @@ -93,7 +107,7 @@ func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) dispatchCreateOr const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/serverVulnerabilityAssessmentsSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } raw, err := readRequestBody(req) @@ -119,7 +133,7 @@ func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) dispatchCreateOr return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerVulnerabilityAssessmentsSettingClassification, req) @@ -136,7 +150,7 @@ func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) dispatchDelete(r const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/serverVulnerabilityAssessmentsSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } settingKindParam, err := parseWithCast(matches[regex.SubexpIndex("settingKind")], func(v string) (armsecurity.ServerVulnerabilityAssessmentsSettingKindName, error) { @@ -154,7 +168,7 @@ func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) dispatchDelete(r return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -171,7 +185,7 @@ func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) dispatchGet(req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/serverVulnerabilityAssessmentsSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } settingKindParam, err := parseWithCast(matches[regex.SubexpIndex("settingKind")], func(v string) (armsecurity.ServerVulnerabilityAssessmentsSettingKindName, error) { @@ -189,7 +203,7 @@ func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) dispatchGet(req return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ServerVulnerabilityAssessmentsSettingClassification, req) @@ -208,7 +222,7 @@ func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) dispatchNewListB const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/serverVulnerabilityAssessmentsSettings` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := s.srv.NewListBySubscriptionPager(nil) @@ -222,7 +236,7 @@ func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) dispatchNewListB if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { s.newListBySubscriptionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -231,3 +245,9 @@ func (s *ServerVulnerabilityAssessmentsSettingsServerTransport) dispatchNewListB } return resp, nil } + +// set this to conditionally intercept incoming requests to ServerVulnerabilityAssessmentsSettingsServerTransport +var serverVulnerabilityAssessmentsSettingsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/settings_server.go b/sdk/resourcemanager/security/armsecurity/fake/settings_server.go index 65bad490e683..2d6cd08d87bf 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/settings_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/settings_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,13 +16,14 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // SettingsServer is a fake server for instances of the armsecurity.SettingsClient type. type SettingsServer struct { // Get is the fake for method SettingsClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, settingName armsecurity.SettingNameAutoGenerated, options *armsecurity.SettingsClientGetOptions) (resp azfake.Responder[armsecurity.SettingsClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, settingName armsecurity.SettingName, options *armsecurity.SettingsClientGetOptions) (resp azfake.Responder[armsecurity.SettingsClientGetResponse], errResp azfake.ErrorResponder) // NewListPager is the fake for method SettingsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK @@ -31,7 +31,7 @@ type SettingsServer struct { // Update is the fake for method SettingsClient.Update // HTTP status codes to indicate success: http.StatusOK - Update func(ctx context.Context, settingName armsecurity.SettingNameAutoGenerated, setting armsecurity.SettingClassification, options *armsecurity.SettingsClientUpdateOptions) (resp azfake.Responder[armsecurity.SettingsClientUpdateResponse], errResp azfake.ErrorResponder) + Update func(ctx context.Context, settingName armsecurity.SettingName, setting armsecurity.SettingClassification, options *armsecurity.SettingsClientUpdateOptions) (resp azfake.Responder[armsecurity.SettingsClientUpdateResponse], errResp azfake.ErrorResponder) } // NewSettingsServerTransport creates a new instance of SettingsServerTransport with the provided implementation. @@ -59,25 +59,39 @@ func (s *SettingsServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SettingsClient.Get": - resp, err = s.dispatchGet(req) - case "SettingsClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - case "SettingsClient.Update": - resp, err = s.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SettingsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if settingsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = settingsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SettingsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SettingsClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + case "SettingsClient.Update": + res.resp, res.err = s.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SettingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -87,15 +101,15 @@ func (s *SettingsServerTransport) dispatchGet(req *http.Request) (*http.Response const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/settings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } - settingNameParam, err := parseWithCast(matches[regex.SubexpIndex("settingName")], func(v string) (armsecurity.SettingNameAutoGenerated, error) { + settingNameParam, err := parseWithCast(matches[regex.SubexpIndex("settingName")], func(v string) (armsecurity.SettingName, error) { p, unescapeErr := url.PathUnescape(v) if unescapeErr != nil { return "", unescapeErr } - return armsecurity.SettingNameAutoGenerated(p), nil + return armsecurity.SettingName(p), nil }) if err != nil { return nil, err @@ -105,7 +119,7 @@ func (s *SettingsServerTransport) dispatchGet(req *http.Request) (*http.Response return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SettingClassification, req) @@ -124,7 +138,7 @@ func (s *SettingsServerTransport) dispatchNewListPager(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/settings` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := s.srv.NewListPager(nil) @@ -138,7 +152,7 @@ func (s *SettingsServerTransport) dispatchNewListPager(req *http.Request) (*http if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { s.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -155,7 +169,7 @@ func (s *SettingsServerTransport) dispatchUpdate(req *http.Request) (*http.Respo const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/settings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } raw, err := readRequestBody(req) @@ -166,12 +180,12 @@ func (s *SettingsServerTransport) dispatchUpdate(req *http.Request) (*http.Respo if err != nil { return nil, err } - settingNameParam, err := parseWithCast(matches[regex.SubexpIndex("settingName")], func(v string) (armsecurity.SettingNameAutoGenerated, error) { + settingNameParam, err := parseWithCast(matches[regex.SubexpIndex("settingName")], func(v string) (armsecurity.SettingName, error) { p, unescapeErr := url.PathUnescape(v) if unescapeErr != nil { return "", unescapeErr } - return armsecurity.SettingNameAutoGenerated(p), nil + return armsecurity.SettingName(p), nil }) if err != nil { return nil, err @@ -181,7 +195,7 @@ func (s *SettingsServerTransport) dispatchUpdate(req *http.Request) (*http.Respo return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SettingClassification, req) @@ -190,3 +204,9 @@ func (s *SettingsServerTransport) dispatchUpdate(req *http.Request) (*http.Respo } return resp, nil } + +// set this to conditionally intercept incoming requests to SettingsServerTransport +var settingsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/softwareinventories_server.go b/sdk/resourcemanager/security/armsecurity/fake/softwareinventories_server.go deleted file mode 100644 index e4b6245c40ae..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/softwareinventories_server.go +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "context" - "errors" - "fmt" - azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" - "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" - "net/http" - "net/url" - "regexp" -) - -// SoftwareInventoriesServer is a fake server for instances of the armsecurity.SoftwareInventoriesClient type. -type SoftwareInventoriesServer struct { - // Get is the fake for method SoftwareInventoriesClient.Get - // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, softwareName string, options *armsecurity.SoftwareInventoriesClientGetOptions) (resp azfake.Responder[armsecurity.SoftwareInventoriesClientGetResponse], errResp azfake.ErrorResponder) - - // NewListByExtendedResourcePager is the fake for method SoftwareInventoriesClient.NewListByExtendedResourcePager - // HTTP status codes to indicate success: http.StatusOK - NewListByExtendedResourcePager func(resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *armsecurity.SoftwareInventoriesClientListByExtendedResourceOptions) (resp azfake.PagerResponder[armsecurity.SoftwareInventoriesClientListByExtendedResourceResponse]) - - // NewListBySubscriptionPager is the fake for method SoftwareInventoriesClient.NewListBySubscriptionPager - // HTTP status codes to indicate success: http.StatusOK - NewListBySubscriptionPager func(options *armsecurity.SoftwareInventoriesClientListBySubscriptionOptions) (resp azfake.PagerResponder[armsecurity.SoftwareInventoriesClientListBySubscriptionResponse]) -} - -// NewSoftwareInventoriesServerTransport creates a new instance of SoftwareInventoriesServerTransport with the provided implementation. -// The returned SoftwareInventoriesServerTransport instance is connected to an instance of armsecurity.SoftwareInventoriesClient via the -// azcore.ClientOptions.Transporter field in the client's constructor parameters. -func NewSoftwareInventoriesServerTransport(srv *SoftwareInventoriesServer) *SoftwareInventoriesServerTransport { - return &SoftwareInventoriesServerTransport{ - srv: srv, - newListByExtendedResourcePager: newTracker[azfake.PagerResponder[armsecurity.SoftwareInventoriesClientListByExtendedResourceResponse]](), - newListBySubscriptionPager: newTracker[azfake.PagerResponder[armsecurity.SoftwareInventoriesClientListBySubscriptionResponse]](), - } -} - -// SoftwareInventoriesServerTransport connects instances of armsecurity.SoftwareInventoriesClient to instances of SoftwareInventoriesServer. -// Don't use this type directly, use NewSoftwareInventoriesServerTransport instead. -type SoftwareInventoriesServerTransport struct { - srv *SoftwareInventoriesServer - newListByExtendedResourcePager *tracker[azfake.PagerResponder[armsecurity.SoftwareInventoriesClientListByExtendedResourceResponse]] - newListBySubscriptionPager *tracker[azfake.PagerResponder[armsecurity.SoftwareInventoriesClientListBySubscriptionResponse]] -} - -// Do implements the policy.Transporter interface for SoftwareInventoriesServerTransport. -func (s *SoftwareInventoriesServerTransport) Do(req *http.Request) (*http.Response, error) { - rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) - method, ok := rawMethod.(string) - if !ok { - return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} - } - - var resp *http.Response - var err error - - switch method { - case "SoftwareInventoriesClient.Get": - resp, err = s.dispatchGet(req) - case "SoftwareInventoriesClient.NewListByExtendedResourcePager": - resp, err = s.dispatchNewListByExtendedResourcePager(req) - case "SoftwareInventoriesClient.NewListBySubscriptionPager": - resp, err = s.dispatchNewListBySubscriptionPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } - - if err != nil { - return nil, err - } - - return resp, nil -} - -func (s *SoftwareInventoriesServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { - if s.srv.Get == nil { - return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} - } - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/softwareInventories/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 6 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resourceNamespaceParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceNamespace")]) - if err != nil { - return nil, err - } - resourceTypeParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceType")]) - if err != nil { - return nil, err - } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) - if err != nil { - return nil, err - } - softwareNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("softwareName")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, resourceNamespaceParam, resourceTypeParam, resourceNameParam, softwareNameParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Software, req) - if err != nil { - return nil, err - } - return resp, nil -} - -func (s *SoftwareInventoriesServerTransport) dispatchNewListByExtendedResourcePager(req *http.Request) (*http.Response, error) { - if s.srv.NewListByExtendedResourcePager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListByExtendedResourcePager not implemented")} - } - newListByExtendedResourcePager := s.newListByExtendedResourcePager.get(req) - if newListByExtendedResourcePager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/softwareInventories` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) - if err != nil { - return nil, err - } - resourceNamespaceParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceNamespace")]) - if err != nil { - return nil, err - } - resourceTypeParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceType")]) - if err != nil { - return nil, err - } - resourceNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceName")]) - if err != nil { - return nil, err - } - resp := s.srv.NewListByExtendedResourcePager(resourceGroupNameParam, resourceNamespaceParam, resourceTypeParam, resourceNameParam, nil) - newListByExtendedResourcePager = &resp - s.newListByExtendedResourcePager.add(req, newListByExtendedResourcePager) - server.PagerResponderInjectNextLinks(newListByExtendedResourcePager, req, func(page *armsecurity.SoftwareInventoriesClientListByExtendedResourceResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListByExtendedResourcePager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListByExtendedResourcePager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListByExtendedResourcePager) { - s.newListByExtendedResourcePager.remove(req) - } - return resp, nil -} - -func (s *SoftwareInventoriesServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { - if s.srv.NewListBySubscriptionPager == nil { - return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} - } - newListBySubscriptionPager := s.newListBySubscriptionPager.get(req) - if newListBySubscriptionPager == nil { - const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/softwareInventories` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - resp := s.srv.NewListBySubscriptionPager(nil) - newListBySubscriptionPager = &resp - s.newListBySubscriptionPager.add(req, newListBySubscriptionPager) - server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armsecurity.SoftwareInventoriesClientListBySubscriptionResponse, createLink func() string) { - page.NextLink = to.Ptr(createLink()) - }) - } - resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) - if err != nil { - return nil, err - } - if !contains([]int{http.StatusOK}, resp.StatusCode) { - s.newListBySubscriptionPager.remove(req) - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} - } - if !server.PagerResponderMore(newListBySubscriptionPager) { - s.newListBySubscriptionPager.remove(req) - } - return resp, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/solutions_server.go b/sdk/resourcemanager/security/armsecurity/fake/solutions_server.go index eb5e217337d1..c7005ec91078 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/solutions_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/solutions_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // SolutionsServer is a fake server for instances of the armsecurity.SolutionsClient type. @@ -55,23 +55,37 @@ func (s *SolutionsServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SolutionsClient.Get": - resp, err = s.dispatchGet(req) - case "SolutionsClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SolutionsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if solutionsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = solutionsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SolutionsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SolutionsClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SolutionsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -81,7 +95,7 @@ func (s *SolutionsServerTransport) dispatchGet(req *http.Request) (*http.Respons const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securitySolutions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -101,7 +115,7 @@ func (s *SolutionsServerTransport) dispatchGet(req *http.Request) (*http.Respons return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Solution, req) @@ -120,7 +134,7 @@ func (s *SolutionsServerTransport) dispatchNewListPager(req *http.Request) (*htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securitySolutions` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := s.srv.NewListPager(nil) @@ -134,7 +148,7 @@ func (s *SolutionsServerTransport) dispatchNewListPager(req *http.Request) (*htt if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { s.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -143,3 +157,9 @@ func (s *SolutionsServerTransport) dispatchNewListPager(req *http.Request) (*htt } return resp, nil } + +// set this to conditionally intercept incoming requests to SolutionsServerTransport +var solutionsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/solutionsreferencedata_server.go b/sdk/resourcemanager/security/armsecurity/fake/solutionsreferencedata_server.go index 7be4e5200689..515060d731d5 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/solutionsreferencedata_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/solutionsreferencedata_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -16,6 +15,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // SolutionsReferenceDataServer is a fake server for instances of the armsecurity.SolutionsReferenceDataClient type. @@ -50,23 +50,37 @@ func (s *SolutionsReferenceDataServerTransport) Do(req *http.Request) (*http.Res return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SolutionsReferenceDataClient.List": - resp, err = s.dispatchList(req) - case "SolutionsReferenceDataClient.ListByHomeRegion": - resp, err = s.dispatchListByHomeRegion(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SolutionsReferenceDataServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if solutionsReferenceDataServerTransportInterceptor != nil { + res.resp, res.err, intercepted = solutionsReferenceDataServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SolutionsReferenceDataClient.List": + res.resp, res.err = s.dispatchList(req) + case "SolutionsReferenceDataClient.ListByHomeRegion": + res.resp, res.err = s.dispatchListByHomeRegion(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SolutionsReferenceDataServerTransport) dispatchList(req *http.Request) (*http.Response, error) { @@ -76,7 +90,7 @@ func (s *SolutionsReferenceDataServerTransport) dispatchList(req *http.Request) const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securitySolutionsReferenceData` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } respr, errRespr := s.srv.List(req.Context(), nil) @@ -84,7 +98,7 @@ func (s *SolutionsReferenceDataServerTransport) dispatchList(req *http.Request) return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SolutionsReferenceDataList, req) @@ -101,7 +115,7 @@ func (s *SolutionsReferenceDataServerTransport) dispatchListByHomeRegion(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/securitySolutionsReferenceData` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) @@ -113,7 +127,7 @@ func (s *SolutionsReferenceDataServerTransport) dispatchListByHomeRegion(req *ht return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SolutionsReferenceDataList, req) @@ -122,3 +136,9 @@ func (s *SolutionsReferenceDataServerTransport) dispatchListByHomeRegion(req *ht } return resp, nil } + +// set this to conditionally intercept incoming requests to SolutionsReferenceDataServerTransport +var solutionsReferenceDataServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentbaselinerules_server.go b/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentbaselinerules_server.go index ce44f50a788c..e82ddcddfda2 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentbaselinerules_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentbaselinerules_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,47 +11,53 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" "net/http" "net/url" "reflect" "regexp" + "slices" ) // SQLVulnerabilityAssessmentBaselineRulesServer is a fake server for instances of the armsecurity.SQLVulnerabilityAssessmentBaselineRulesClient type. type SQLVulnerabilityAssessmentBaselineRulesServer struct { // Add is the fake for method SQLVulnerabilityAssessmentBaselineRulesClient.Add // HTTP status codes to indicate success: http.StatusOK - Add func(ctx context.Context, workspaceID string, resourceID string, options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientAddOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientAddResponse], errResp azfake.ErrorResponder) + Add func(ctx context.Context, resourceID string, options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientAddOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientAddResponse], errResp azfake.ErrorResponder) // CreateOrUpdate is the fake for method SQLVulnerabilityAssessmentBaselineRulesClient.CreateOrUpdate - // HTTP status codes to indicate success: http.StatusOK - CreateOrUpdate func(ctx context.Context, ruleID string, workspaceID string, resourceID string, options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceID string, ruleID string, body armsecurity.RuleResultsInput, options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) // Delete is the fake for method SQLVulnerabilityAssessmentBaselineRulesClient.Delete // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent - Delete func(ctx context.Context, ruleID string, workspaceID string, resourceID string, options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientDeleteResponse], errResp azfake.ErrorResponder) + Delete func(ctx context.Context, resourceID string, ruleID string, options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientDeleteResponse], errResp azfake.ErrorResponder) // Get is the fake for method SQLVulnerabilityAssessmentBaselineRulesClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, ruleID string, workspaceID string, resourceID string, options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientGetOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, resourceID string, ruleID string, options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientGetOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientGetResponse], errResp azfake.ErrorResponder) - // List is the fake for method SQLVulnerabilityAssessmentBaselineRulesClient.List + // NewListPager is the fake for method SQLVulnerabilityAssessmentBaselineRulesClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, workspaceID string, resourceID string, options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientListOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientListResponse], errResp azfake.ErrorResponder) + NewListPager func(resourceID string, options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientListOptions) (resp azfake.PagerResponder[armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientListResponse]) } // NewSQLVulnerabilityAssessmentBaselineRulesServerTransport creates a new instance of SQLVulnerabilityAssessmentBaselineRulesServerTransport with the provided implementation. // The returned SQLVulnerabilityAssessmentBaselineRulesServerTransport instance is connected to an instance of armsecurity.SQLVulnerabilityAssessmentBaselineRulesClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewSQLVulnerabilityAssessmentBaselineRulesServerTransport(srv *SQLVulnerabilityAssessmentBaselineRulesServer) *SQLVulnerabilityAssessmentBaselineRulesServerTransport { - return &SQLVulnerabilityAssessmentBaselineRulesServerTransport{srv: srv} + return &SQLVulnerabilityAssessmentBaselineRulesServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientListResponse]](), + } } // SQLVulnerabilityAssessmentBaselineRulesServerTransport connects instances of armsecurity.SQLVulnerabilityAssessmentBaselineRulesClient to instances of SQLVulnerabilityAssessmentBaselineRulesServer. // Don't use this type directly, use NewSQLVulnerabilityAssessmentBaselineRulesServerTransport instead. type SQLVulnerabilityAssessmentBaselineRulesServerTransport struct { - srv *SQLVulnerabilityAssessmentBaselineRulesServer + srv *SQLVulnerabilityAssessmentBaselineRulesServer + newListPager *tracker[azfake.PagerResponder[armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientListResponse]] } // Do implements the policy.Transporter interface for SQLVulnerabilityAssessmentBaselineRulesServerTransport. @@ -63,29 +68,43 @@ func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) Do(req *http.Re return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SQLVulnerabilityAssessmentBaselineRulesClient.Add": - resp, err = s.dispatchAdd(req) - case "SQLVulnerabilityAssessmentBaselineRulesClient.CreateOrUpdate": - resp, err = s.dispatchCreateOrUpdate(req) - case "SQLVulnerabilityAssessmentBaselineRulesClient.Delete": - resp, err = s.dispatchDelete(req) - case "SQLVulnerabilityAssessmentBaselineRulesClient.Get": - resp, err = s.dispatchGet(req) - case "SQLVulnerabilityAssessmentBaselineRulesClient.List": - resp, err = s.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if sqlVulnerabilityAssessmentBaselineRulesServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sqlVulnerabilityAssessmentBaselineRulesServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SQLVulnerabilityAssessmentBaselineRulesClient.Add": + res.resp, res.err = s.dispatchAdd(req) + case "SQLVulnerabilityAssessmentBaselineRulesClient.CreateOrUpdate": + res.resp, res.err = s.dispatchCreateOrUpdate(req) + case "SQLVulnerabilityAssessmentBaselineRulesClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "SQLVulnerabilityAssessmentBaselineRulesClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SQLVulnerabilityAssessmentBaselineRulesClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) dispatchAdd(req *http.Request) (*http.Response, error) { @@ -95,7 +114,7 @@ func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) dispatchAdd(req const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default/baselineRules` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -103,26 +122,24 @@ func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) dispatchAdd(req if err != nil { return nil, err } - workspaceIDParam, err := url.QueryUnescape(qp.Get("workspaceId")) - if err != nil { - return nil, err - } resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) if err != nil { return nil, err } + databaseNameParam := getOptional(qp.Get("databaseName")) var options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientAddOptions - if !reflect.ValueOf(body).IsZero() { + if databaseNameParam != nil || !reflect.ValueOf(body).IsZero() { options = &armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientAddOptions{ - Body: &body, + DatabaseName: databaseNameParam, + Body: &body, } } - respr, errRespr := s.srv.Add(req.Context(), workspaceIDParam, resourceIDParam, options) + respr, errRespr := s.srv.Add(req.Context(), resourceIDParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RulesResults, req) @@ -139,7 +156,7 @@ func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) dispatchCreateO const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default/baselineRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -147,31 +164,28 @@ func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) dispatchCreateO if err != nil { return nil, err } - ruleIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleId")]) - if err != nil { - return nil, err - } - workspaceIDParam, err := url.QueryUnescape(qp.Get("workspaceId")) + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) if err != nil { return nil, err } - resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) + ruleIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleId")]) if err != nil { return nil, err } + databaseNameParam := getOptional(qp.Get("databaseName")) var options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions - if !reflect.ValueOf(body).IsZero() { + if databaseNameParam != nil { options = &armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions{ - Body: &body, + DatabaseName: databaseNameParam, } } - respr, errRespr := s.srv.CreateOrUpdate(req.Context(), ruleIDParam, workspaceIDParam, resourceIDParam, options) + respr, errRespr := s.srv.CreateOrUpdate(req.Context(), resourceIDParam, ruleIDParam, body, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RuleResults, req) if err != nil { @@ -187,28 +201,31 @@ func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) dispatchDelete( const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default/baselineRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() - ruleIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleId")]) + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) if err != nil { return nil, err } - workspaceIDParam, err := url.QueryUnescape(qp.Get("workspaceId")) + ruleIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleId")]) if err != nil { return nil, err } - resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) - if err != nil { - return nil, err + databaseNameParam := getOptional(qp.Get("databaseName")) + var options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions + if databaseNameParam != nil { + options = &armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions{ + DatabaseName: databaseNameParam, + } } - respr, errRespr := s.srv.Delete(req.Context(), ruleIDParam, workspaceIDParam, resourceIDParam, nil) + respr, errRespr := s.srv.Delete(req.Context(), resourceIDParam, ruleIDParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -225,28 +242,31 @@ func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) dispatchGet(req const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default/baselineRules/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() - ruleIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleId")]) + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) if err != nil { return nil, err } - workspaceIDParam, err := url.QueryUnescape(qp.Get("workspaceId")) + ruleIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("ruleId")]) if err != nil { return nil, err } - resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) - if err != nil { - return nil, err + databaseNameParam := getOptional(qp.Get("databaseName")) + var options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientGetOptions + if databaseNameParam != nil { + options = &armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientGetOptions{ + DatabaseName: databaseNameParam, + } } - respr, errRespr := s.srv.Get(req.Context(), ruleIDParam, workspaceIDParam, resourceIDParam, nil) + respr, errRespr := s.srv.Get(req.Context(), resourceIDParam, ruleIDParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RuleResults, req) @@ -256,36 +276,53 @@ func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) dispatchGet(req return resp, nil } -func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if s.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default/baselineRules` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - workspaceIDParam, err := url.QueryUnescape(qp.Get("workspaceId")) - if err != nil { - return nil, err - } - resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) +func (s *SQLVulnerabilityAssessmentBaselineRulesServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := s.newListPager.get(req) + if newListPager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default/baselineRules` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) + if err != nil { + return nil, err + } + databaseNameParam := getOptional(qp.Get("databaseName")) + var options *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientListOptions + if databaseNameParam != nil { + options = &armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientListOptions{ + DatabaseName: databaseNameParam, + } + } + resp := s.srv.NewListPager(resourceIDParam, options) + newListPager = &resp + s.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.SQLVulnerabilityAssessmentBaselineRulesClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) if err != nil { return nil, err } - respr, errRespr := s.srv.List(req.Context(), workspaceIDParam, resourceIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).RulesResults, req) - if err != nil { - return nil, err + if !server.PagerResponderMore(newListPager) { + s.newListPager.remove(req) } return resp, nil } + +// set this to conditionally intercept incoming requests to SQLVulnerabilityAssessmentBaselineRulesServerTransport +var sqlVulnerabilityAssessmentBaselineRulesServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentscanresults_server.go b/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentscanresults_server.go index c5ee44fa624e..ee37935409e5 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentscanresults_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentscanresults_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,34 +11,40 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" "net/http" "net/url" "regexp" + "slices" ) // SQLVulnerabilityAssessmentScanResultsServer is a fake server for instances of the armsecurity.SQLVulnerabilityAssessmentScanResultsClient type. type SQLVulnerabilityAssessmentScanResultsServer struct { // Get is the fake for method SQLVulnerabilityAssessmentScanResultsClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, scanID string, scanResultID string, workspaceID string, resourceID string, options *armsecurity.SQLVulnerabilityAssessmentScanResultsClientGetOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentScanResultsClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, scanID string, scanResultID string, resourceID string, options *armsecurity.SQLVulnerabilityAssessmentScanResultsClientGetOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentScanResultsClientGetResponse], errResp azfake.ErrorResponder) - // List is the fake for method SQLVulnerabilityAssessmentScanResultsClient.List + // NewListPager is the fake for method SQLVulnerabilityAssessmentScanResultsClient.NewListPager // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, scanID string, workspaceID string, resourceID string, options *armsecurity.SQLVulnerabilityAssessmentScanResultsClientListOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentScanResultsClientListResponse], errResp azfake.ErrorResponder) + NewListPager func(scanID string, resourceID string, options *armsecurity.SQLVulnerabilityAssessmentScanResultsClientListOptions) (resp azfake.PagerResponder[armsecurity.SQLVulnerabilityAssessmentScanResultsClientListResponse]) } // NewSQLVulnerabilityAssessmentScanResultsServerTransport creates a new instance of SQLVulnerabilityAssessmentScanResultsServerTransport with the provided implementation. // The returned SQLVulnerabilityAssessmentScanResultsServerTransport instance is connected to an instance of armsecurity.SQLVulnerabilityAssessmentScanResultsClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewSQLVulnerabilityAssessmentScanResultsServerTransport(srv *SQLVulnerabilityAssessmentScanResultsServer) *SQLVulnerabilityAssessmentScanResultsServerTransport { - return &SQLVulnerabilityAssessmentScanResultsServerTransport{srv: srv} + return &SQLVulnerabilityAssessmentScanResultsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurity.SQLVulnerabilityAssessmentScanResultsClientListResponse]](), + } } // SQLVulnerabilityAssessmentScanResultsServerTransport connects instances of armsecurity.SQLVulnerabilityAssessmentScanResultsClient to instances of SQLVulnerabilityAssessmentScanResultsServer. // Don't use this type directly, use NewSQLVulnerabilityAssessmentScanResultsServerTransport instead. type SQLVulnerabilityAssessmentScanResultsServerTransport struct { - srv *SQLVulnerabilityAssessmentScanResultsServer + srv *SQLVulnerabilityAssessmentScanResultsServer + newListPager *tracker[azfake.PagerResponder[armsecurity.SQLVulnerabilityAssessmentScanResultsClientListResponse]] } // Do implements the policy.Transporter interface for SQLVulnerabilityAssessmentScanResultsServerTransport. @@ -50,23 +55,37 @@ func (s *SQLVulnerabilityAssessmentScanResultsServerTransport) Do(req *http.Requ return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SQLVulnerabilityAssessmentScanResultsClient.Get": - resp, err = s.dispatchGet(req) - case "SQLVulnerabilityAssessmentScanResultsClient.List": - resp, err = s.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SQLVulnerabilityAssessmentScanResultsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if sqlVulnerabilityAssessmentScanResultsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sqlVulnerabilityAssessmentScanResultsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SQLVulnerabilityAssessmentScanResultsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SQLVulnerabilityAssessmentScanResultsClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SQLVulnerabilityAssessmentScanResultsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -76,7 +95,7 @@ func (s *SQLVulnerabilityAssessmentScanResultsServerTransport) dispatchGet(req * const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default/scans/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scanResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -88,20 +107,23 @@ func (s *SQLVulnerabilityAssessmentScanResultsServerTransport) dispatchGet(req * if err != nil { return nil, err } - workspaceIDParam, err := url.QueryUnescape(qp.Get("workspaceId")) - if err != nil { - return nil, err - } + databaseNameParam := getOptional(qp.Get("databaseName")) resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) if err != nil { return nil, err } - respr, errRespr := s.srv.Get(req.Context(), scanIDParam, scanResultIDParam, workspaceIDParam, resourceIDParam, nil) + var options *armsecurity.SQLVulnerabilityAssessmentScanResultsClientGetOptions + if databaseNameParam != nil { + options = &armsecurity.SQLVulnerabilityAssessmentScanResultsClientGetOptions{ + DatabaseName: databaseNameParam, + } + } + respr, errRespr := s.srv.Get(req.Context(), scanIDParam, scanResultIDParam, resourceIDParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ScanResult, req) @@ -111,40 +133,57 @@ func (s *SQLVulnerabilityAssessmentScanResultsServerTransport) dispatchGet(req * return resp, nil } -func (s *SQLVulnerabilityAssessmentScanResultsServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if s.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} - } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default/scans/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scanResults` - regex := regexp.MustCompile(regexStr) - matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { - return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) - } - qp := req.URL.Query() - scanIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("scanId")]) +func (s *SQLVulnerabilityAssessmentScanResultsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := s.newListPager.get(req) + if newListPager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default/scans/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/scanResults` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + scanIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("scanId")]) + if err != nil { + return nil, err + } + databaseNameParam := getOptional(qp.Get("databaseName")) + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) + if err != nil { + return nil, err + } + var options *armsecurity.SQLVulnerabilityAssessmentScanResultsClientListOptions + if databaseNameParam != nil { + options = &armsecurity.SQLVulnerabilityAssessmentScanResultsClientListOptions{ + DatabaseName: databaseNameParam, + } + } + resp := s.srv.NewListPager(scanIDParam, resourceIDParam, options) + newListPager = &resp + s.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.SQLVulnerabilityAssessmentScanResultsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) if err != nil { return nil, err } - workspaceIDParam, err := url.QueryUnescape(qp.Get("workspaceId")) - if err != nil { - return nil, err + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } - resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) - if err != nil { - return nil, err - } - respr, errRespr := s.srv.List(req.Context(), scanIDParam, workspaceIDParam, resourceIDParam, nil) - if respErr := server.GetError(errRespr, req); respErr != nil { - return nil, respErr - } - respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { - return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} - } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ScanResults, req) - if err != nil { - return nil, err + if !server.PagerResponderMore(newListPager) { + s.newListPager.remove(req) } return resp, nil } + +// set this to conditionally intercept incoming requests to SQLVulnerabilityAssessmentScanResultsServerTransport +var sqlVulnerabilityAssessmentScanResultsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentscans_server.go b/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentscans_server.go index 96ddc6f156ea..5724b1074606 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentscans_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentscans_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -12,34 +11,50 @@ import ( azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" "net/http" "net/url" "regexp" + "slices" ) // SQLVulnerabilityAssessmentScansServer is a fake server for instances of the armsecurity.SQLVulnerabilityAssessmentScansClient type. type SQLVulnerabilityAssessmentScansServer struct { // Get is the fake for method SQLVulnerabilityAssessmentScansClient.Get // HTTP status codes to indicate success: http.StatusOK - Get func(ctx context.Context, scanID string, workspaceID string, resourceID string, options *armsecurity.SQLVulnerabilityAssessmentScansClientGetOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentScansClientGetResponse], errResp azfake.ErrorResponder) + Get func(ctx context.Context, scanID string, resourceID string, options *armsecurity.SQLVulnerabilityAssessmentScansClientGetOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentScansClientGetResponse], errResp azfake.ErrorResponder) - // List is the fake for method SQLVulnerabilityAssessmentScansClient.List + // GetScanOperationResult is the fake for method SQLVulnerabilityAssessmentScansClient.GetScanOperationResult // HTTP status codes to indicate success: http.StatusOK - List func(ctx context.Context, workspaceID string, resourceID string, options *armsecurity.SQLVulnerabilityAssessmentScansClientListOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentScansClientListResponse], errResp azfake.ErrorResponder) + GetScanOperationResult func(ctx context.Context, resourceID string, operationID string, options *armsecurity.SQLVulnerabilityAssessmentScansClientGetScanOperationResultOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentScansClientGetScanOperationResultResponse], errResp azfake.ErrorResponder) + + // BeginInitiateScan is the fake for method SQLVulnerabilityAssessmentScansClient.BeginInitiateScan + // HTTP status codes to indicate success: http.StatusOK, http.StatusAccepted + BeginInitiateScan func(ctx context.Context, resourceID string, options *armsecurity.SQLVulnerabilityAssessmentScansClientBeginInitiateScanOptions) (resp azfake.PollerResponder[armsecurity.SQLVulnerabilityAssessmentScansClientInitiateScanResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method SQLVulnerabilityAssessmentScansClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceID string, options *armsecurity.SQLVulnerabilityAssessmentScansClientListOptions) (resp azfake.PagerResponder[armsecurity.SQLVulnerabilityAssessmentScansClientListResponse]) } // NewSQLVulnerabilityAssessmentScansServerTransport creates a new instance of SQLVulnerabilityAssessmentScansServerTransport with the provided implementation. // The returned SQLVulnerabilityAssessmentScansServerTransport instance is connected to an instance of armsecurity.SQLVulnerabilityAssessmentScansClient via the // azcore.ClientOptions.Transporter field in the client's constructor parameters. func NewSQLVulnerabilityAssessmentScansServerTransport(srv *SQLVulnerabilityAssessmentScansServer) *SQLVulnerabilityAssessmentScansServerTransport { - return &SQLVulnerabilityAssessmentScansServerTransport{srv: srv} + return &SQLVulnerabilityAssessmentScansServerTransport{ + srv: srv, + beginInitiateScan: newTracker[azfake.PollerResponder[armsecurity.SQLVulnerabilityAssessmentScansClientInitiateScanResponse]](), + newListPager: newTracker[azfake.PagerResponder[armsecurity.SQLVulnerabilityAssessmentScansClientListResponse]](), + } } // SQLVulnerabilityAssessmentScansServerTransport connects instances of armsecurity.SQLVulnerabilityAssessmentScansClient to instances of SQLVulnerabilityAssessmentScansServer. // Don't use this type directly, use NewSQLVulnerabilityAssessmentScansServerTransport instead. type SQLVulnerabilityAssessmentScansServerTransport struct { - srv *SQLVulnerabilityAssessmentScansServer + srv *SQLVulnerabilityAssessmentScansServer + beginInitiateScan *tracker[azfake.PollerResponder[armsecurity.SQLVulnerabilityAssessmentScansClientInitiateScanResponse]] + newListPager *tracker[azfake.PagerResponder[armsecurity.SQLVulnerabilityAssessmentScansClientListResponse]] } // Do implements the policy.Transporter interface for SQLVulnerabilityAssessmentScansServerTransport. @@ -50,23 +65,41 @@ func (s *SQLVulnerabilityAssessmentScansServerTransport) Do(req *http.Request) ( return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SQLVulnerabilityAssessmentScansClient.Get": - resp, err = s.dispatchGet(req) - case "SQLVulnerabilityAssessmentScansClient.List": - resp, err = s.dispatchList(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SQLVulnerabilityAssessmentScansServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if sqlVulnerabilityAssessmentScansServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sqlVulnerabilityAssessmentScansServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SQLVulnerabilityAssessmentScansClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SQLVulnerabilityAssessmentScansClient.GetScanOperationResult": + res.resp, res.err = s.dispatchGetScanOperationResult(req) + case "SQLVulnerabilityAssessmentScansClient.BeginInitiateScan": + res.resp, res.err = s.dispatchBeginInitiateScan(req) + case "SQLVulnerabilityAssessmentScansClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SQLVulnerabilityAssessmentScansServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -76,7 +109,7 @@ func (s *SQLVulnerabilityAssessmentScansServerTransport) dispatchGet(req *http.R const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default/scans/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -84,59 +117,168 @@ func (s *SQLVulnerabilityAssessmentScansServerTransport) dispatchGet(req *http.R if err != nil { return nil, err } - workspaceIDParam, err := url.QueryUnescape(qp.Get("workspaceId")) - if err != nil { - return nil, err - } + databaseNameParam := getOptional(qp.Get("databaseName")) resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) if err != nil { return nil, err } - respr, errRespr := s.srv.Get(req.Context(), scanIDParam, workspaceIDParam, resourceIDParam, nil) + var options *armsecurity.SQLVulnerabilityAssessmentScansClientGetOptions + if databaseNameParam != nil { + options = &armsecurity.SQLVulnerabilityAssessmentScansClientGetOptions{ + DatabaseName: databaseNameParam, + } + } + respr, errRespr := s.srv.Get(req.Context(), scanIDParam, resourceIDParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Scan, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ScanV2, req) if err != nil { return nil, err } return resp, nil } -func (s *SQLVulnerabilityAssessmentScansServerTransport) dispatchList(req *http.Request) (*http.Response, error) { - if s.srv.List == nil { - return nil, &nonRetriableError{errors.New("fake for method List not implemented")} +func (s *SQLVulnerabilityAssessmentScansServerTransport) dispatchGetScanOperationResult(req *http.Request) (*http.Response, error) { + if s.srv.GetScanOperationResult == nil { + return nil, &nonRetriableError{errors.New("fake for method GetScanOperationResult not implemented")} } - const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default/scans` + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default/scans/scanOperationResults/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() - workspaceIDParam, err := url.QueryUnescape(qp.Get("workspaceId")) + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) if err != nil { return nil, err } - resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) + operationIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("operationId")]) if err != nil { return nil, err } - respr, errRespr := s.srv.List(req.Context(), workspaceIDParam, resourceIDParam, nil) + databaseNameParam := getOptional(qp.Get("databaseName")) + var options *armsecurity.SQLVulnerabilityAssessmentScansClientGetScanOperationResultOptions + if databaseNameParam != nil { + options = &armsecurity.SQLVulnerabilityAssessmentScansClientGetScanOperationResultOptions{ + DatabaseName: databaseNameParam, + } + } + respr, errRespr := s.srv.GetScanOperationResult(req.Context(), resourceIDParam, operationIDParam, options) if respErr := server.GetError(errRespr, req); respErr != nil { return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } - resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Scans, req) + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SQLVulnerabilityAssessmentScanOperationResult, req) if err != nil { return nil, err } return resp, nil } + +func (s *SQLVulnerabilityAssessmentScansServerTransport) dispatchBeginInitiateScan(req *http.Request) (*http.Response, error) { + if s.srv.BeginInitiateScan == nil { + return nil, &nonRetriableError{errors.New("fake for method BeginInitiateScan not implemented")} + } + beginInitiateScan := s.beginInitiateScan.get(req) + if beginInitiateScan == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default/scans/initiateScan` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) + if err != nil { + return nil, err + } + databaseNameParam := getOptional(qp.Get("databaseName")) + var options *armsecurity.SQLVulnerabilityAssessmentScansClientBeginInitiateScanOptions + if databaseNameParam != nil { + options = &armsecurity.SQLVulnerabilityAssessmentScansClientBeginInitiateScanOptions{ + DatabaseName: databaseNameParam, + } + } + respr, errRespr := s.srv.BeginInitiateScan(req.Context(), resourceIDParam, options) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + beginInitiateScan = &respr + s.beginInitiateScan.add(req, beginInitiateScan) + } + + resp, err := server.PollerResponderNext(beginInitiateScan, req) + if err != nil { + return nil, err + } + + if !slices.Contains([]int{http.StatusOK, http.StatusAccepted}, resp.StatusCode) { + s.beginInitiateScan.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusAccepted", resp.StatusCode)} + } + if !server.PollerResponderMore(beginInitiateScan) { + s.beginInitiateScan.remove(req) + } + + return resp, nil +} + +func (s *SQLVulnerabilityAssessmentScansServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := s.newListPager.get(req) + if newListPager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default/scans` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + qp := req.URL.Query() + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) + if err != nil { + return nil, err + } + databaseNameParam := getOptional(qp.Get("databaseName")) + var options *armsecurity.SQLVulnerabilityAssessmentScansClientListOptions + if databaseNameParam != nil { + options = &armsecurity.SQLVulnerabilityAssessmentScansClientListOptions{ + DatabaseName: databaseNameParam, + } + } + resp := s.srv.NewListPager(resourceIDParam, options) + newListPager = &resp + s.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.SQLVulnerabilityAssessmentScansClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + s.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to SQLVulnerabilityAssessmentScansServerTransport +var sqlVulnerabilityAssessmentScansServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentsettings_server.go b/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentsettings_server.go new file mode 100644 index 000000000000..c51d0b8464b6 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/fake/sqlvulnerabilityassessmentsettings_server.go @@ -0,0 +1,187 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" + "net/http" + "net/url" + "regexp" + "slices" +) + +// SQLVulnerabilityAssessmentSettingsServer is a fake server for instances of the armsecurity.SQLVulnerabilityAssessmentSettingsClient type. +type SQLVulnerabilityAssessmentSettingsServer struct { + // CreateOrUpdate is the fake for method SQLVulnerabilityAssessmentSettingsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceID string, body armsecurity.SQLVulnerabilityAssessmentSettings, options *armsecurity.SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method SQLVulnerabilityAssessmentSettingsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceID string, options *armsecurity.SQLVulnerabilityAssessmentSettingsClientDeleteOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentSettingsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method SQLVulnerabilityAssessmentSettingsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceID string, options *armsecurity.SQLVulnerabilityAssessmentSettingsClientGetOptions) (resp azfake.Responder[armsecurity.SQLVulnerabilityAssessmentSettingsClientGetResponse], errResp azfake.ErrorResponder) +} + +// NewSQLVulnerabilityAssessmentSettingsServerTransport creates a new instance of SQLVulnerabilityAssessmentSettingsServerTransport with the provided implementation. +// The returned SQLVulnerabilityAssessmentSettingsServerTransport instance is connected to an instance of armsecurity.SQLVulnerabilityAssessmentSettingsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewSQLVulnerabilityAssessmentSettingsServerTransport(srv *SQLVulnerabilityAssessmentSettingsServer) *SQLVulnerabilityAssessmentSettingsServerTransport { + return &SQLVulnerabilityAssessmentSettingsServerTransport{srv: srv} +} + +// SQLVulnerabilityAssessmentSettingsServerTransport connects instances of armsecurity.SQLVulnerabilityAssessmentSettingsClient to instances of SQLVulnerabilityAssessmentSettingsServer. +// Don't use this type directly, use NewSQLVulnerabilityAssessmentSettingsServerTransport instead. +type SQLVulnerabilityAssessmentSettingsServerTransport struct { + srv *SQLVulnerabilityAssessmentSettingsServer +} + +// Do implements the policy.Transporter interface for SQLVulnerabilityAssessmentSettingsServerTransport. +func (s *SQLVulnerabilityAssessmentSettingsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *SQLVulnerabilityAssessmentSettingsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if sqlVulnerabilityAssessmentSettingsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = sqlVulnerabilityAssessmentSettingsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SQLVulnerabilityAssessmentSettingsClient.CreateOrUpdate": + res.resp, res.err = s.dispatchCreateOrUpdate(req) + case "SQLVulnerabilityAssessmentSettingsClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "SQLVulnerabilityAssessmentSettingsClient.Get": + res.resp, res.err = s.dispatchGet(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *SQLVulnerabilityAssessmentSettingsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurity.SQLVulnerabilityAssessmentSettings](req) + if err != nil { + return nil, err + } + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.CreateOrUpdate(req.Context(), resourceIDParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SQLVulnerabilityAssessmentSettings, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SQLVulnerabilityAssessmentSettingsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if s.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Delete(req.Context(), resourceIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *SQLVulnerabilityAssessmentSettingsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/sqlVulnerabilityAssessments/default` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SQLVulnerabilityAssessmentSettings, req) + if err != nil { + return nil, err + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to SQLVulnerabilityAssessmentSettingsServerTransport +var sqlVulnerabilityAssessmentSettingsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/standardassignments_server.go b/sdk/resourcemanager/security/armsecurity/fake/standardassignments_server.go new file mode 100644 index 000000000000..40cccb398598 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/fake/standardassignments_server.go @@ -0,0 +1,247 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" + "net/http" + "net/url" + "regexp" + "slices" +) + +// StandardAssignmentsServer is a fake server for instances of the armsecurity.StandardAssignmentsClient type. +type StandardAssignmentsServer struct { + // Create is the fake for method StandardAssignmentsClient.Create + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + Create func(ctx context.Context, resourceID string, standardAssignmentName string, standardAssignment armsecurity.StandardAssignment, options *armsecurity.StandardAssignmentsClientCreateOptions) (resp azfake.Responder[armsecurity.StandardAssignmentsClientCreateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method StandardAssignmentsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceID string, standardAssignmentName string, options *armsecurity.StandardAssignmentsClientDeleteOptions) (resp azfake.Responder[armsecurity.StandardAssignmentsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method StandardAssignmentsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceID string, standardAssignmentName string, options *armsecurity.StandardAssignmentsClientGetOptions) (resp azfake.Responder[armsecurity.StandardAssignmentsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method StandardAssignmentsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(scope string, options *armsecurity.StandardAssignmentsClientListOptions) (resp azfake.PagerResponder[armsecurity.StandardAssignmentsClientListResponse]) +} + +// NewStandardAssignmentsServerTransport creates a new instance of StandardAssignmentsServerTransport with the provided implementation. +// The returned StandardAssignmentsServerTransport instance is connected to an instance of armsecurity.StandardAssignmentsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewStandardAssignmentsServerTransport(srv *StandardAssignmentsServer) *StandardAssignmentsServerTransport { + return &StandardAssignmentsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurity.StandardAssignmentsClientListResponse]](), + } +} + +// StandardAssignmentsServerTransport connects instances of armsecurity.StandardAssignmentsClient to instances of StandardAssignmentsServer. +// Don't use this type directly, use NewStandardAssignmentsServerTransport instead. +type StandardAssignmentsServerTransport struct { + srv *StandardAssignmentsServer + newListPager *tracker[azfake.PagerResponder[armsecurity.StandardAssignmentsClientListResponse]] +} + +// Do implements the policy.Transporter interface for StandardAssignmentsServerTransport. +func (s *StandardAssignmentsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *StandardAssignmentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if standardAssignmentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = standardAssignmentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "StandardAssignmentsClient.Create": + res.resp, res.err = s.dispatchCreate(req) + case "StandardAssignmentsClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "StandardAssignmentsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "StandardAssignmentsClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *StandardAssignmentsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { + if s.srv.Create == nil { + return nil, &nonRetriableError{errors.New("fake for method Create not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/standardAssignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurity.StandardAssignment](req) + if err != nil { + return nil, err + } + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) + if err != nil { + return nil, err + } + standardAssignmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("standardAssignmentName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Create(req.Context(), resourceIDParam, standardAssignmentNameParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).StandardAssignment, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *StandardAssignmentsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if s.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/standardAssignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) + if err != nil { + return nil, err + } + standardAssignmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("standardAssignmentName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Delete(req.Context(), resourceIDParam, standardAssignmentNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *StandardAssignmentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/standardAssignments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceId")]) + if err != nil { + return nil, err + } + standardAssignmentNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("standardAssignmentName")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceIDParam, standardAssignmentNameParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).StandardAssignment, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *StandardAssignmentsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := s.newListPager.get(req) + if newListPager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/standardAssignments` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListPager(scopeParam, nil) + newListPager = &resp + s.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.StandardAssignmentsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + s.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to StandardAssignmentsServerTransport +var standardAssignmentsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/standards_server.go b/sdk/resourcemanager/security/armsecurity/fake/standards_server.go new file mode 100644 index 000000000000..a40f38de0c0b --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/fake/standards_server.go @@ -0,0 +1,288 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" + "net/http" + "net/url" + "regexp" + "slices" +) + +// StandardsServer is a fake server for instances of the armsecurity.StandardsClient type. +type StandardsServer struct { + // CreateOrUpdate is the fake for method StandardsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, resourceGroupName string, standardID string, standard armsecurity.Standard, options *armsecurity.StandardsClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.StandardsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method StandardsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, resourceGroupName string, standardID string, options *armsecurity.StandardsClientDeleteOptions) (resp azfake.Responder[armsecurity.StandardsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method StandardsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, resourceGroupName string, standardID string, options *armsecurity.StandardsClientGetOptions) (resp azfake.Responder[armsecurity.StandardsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method StandardsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(resourceGroupName string, options *armsecurity.StandardsClientListOptions) (resp azfake.PagerResponder[armsecurity.StandardsClientListResponse]) + + // NewListBySubscriptionPager is the fake for method StandardsClient.NewListBySubscriptionPager + // HTTP status codes to indicate success: http.StatusOK + NewListBySubscriptionPager func(options *armsecurity.StandardsClientListBySubscriptionOptions) (resp azfake.PagerResponder[armsecurity.StandardsClientListBySubscriptionResponse]) +} + +// NewStandardsServerTransport creates a new instance of StandardsServerTransport with the provided implementation. +// The returned StandardsServerTransport instance is connected to an instance of armsecurity.StandardsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewStandardsServerTransport(srv *StandardsServer) *StandardsServerTransport { + return &StandardsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurity.StandardsClientListResponse]](), + newListBySubscriptionPager: newTracker[azfake.PagerResponder[armsecurity.StandardsClientListBySubscriptionResponse]](), + } +} + +// StandardsServerTransport connects instances of armsecurity.StandardsClient to instances of StandardsServer. +// Don't use this type directly, use NewStandardsServerTransport instead. +type StandardsServerTransport struct { + srv *StandardsServer + newListPager *tracker[azfake.PagerResponder[armsecurity.StandardsClientListResponse]] + newListBySubscriptionPager *tracker[azfake.PagerResponder[armsecurity.StandardsClientListBySubscriptionResponse]] +} + +// Do implements the policy.Transporter interface for StandardsServerTransport. +func (s *StandardsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return s.dispatchToMethodFake(req, method) +} + +func (s *StandardsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if standardsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = standardsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "StandardsClient.CreateOrUpdate": + res.resp, res.err = s.dispatchCreateOrUpdate(req) + case "StandardsClient.Delete": + res.resp, res.err = s.dispatchDelete(req) + case "StandardsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "StandardsClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + case "StandardsClient.NewListBySubscriptionPager": + res.resp, res.err = s.dispatchNewListBySubscriptionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (s *StandardsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if s.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/standards/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurity.Standard](req) + if err != nil { + return nil, err + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + standardIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("standardId")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.CreateOrUpdate(req.Context(), resourceGroupNameParam, standardIDParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Standard, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *StandardsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if s.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/standards/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + standardIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("standardId")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Delete(req.Context(), resourceGroupNameParam, standardIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *StandardsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if s.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/standards/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 4 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + standardIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("standardId")]) + if err != nil { + return nil, err + } + respr, errRespr := s.srv.Get(req.Context(), resourceGroupNameParam, standardIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Standard, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (s *StandardsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := s.newListPager.get(req) + if newListPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/standards` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) + if err != nil { + return nil, err + } + resp := s.srv.NewListPager(resourceGroupNameParam, nil) + newListPager = &resp + s.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.StandardsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + s.newListPager.remove(req) + } + return resp, nil +} + +func (s *StandardsServerTransport) dispatchNewListBySubscriptionPager(req *http.Request) (*http.Response, error) { + if s.srv.NewListBySubscriptionPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListBySubscriptionPager not implemented")} + } + newListBySubscriptionPager := s.newListBySubscriptionPager.get(req) + if newListBySubscriptionPager == nil { + const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/standards` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + resp := s.srv.NewListBySubscriptionPager(nil) + newListBySubscriptionPager = &resp + s.newListBySubscriptionPager.add(req, newListBySubscriptionPager) + server.PagerResponderInjectNextLinks(newListBySubscriptionPager, req, func(page *armsecurity.StandardsClientListBySubscriptionResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListBySubscriptionPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + s.newListBySubscriptionPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListBySubscriptionPager) { + s.newListBySubscriptionPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to StandardsServerTransport +var standardsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/subassessments_server.go b/sdk/resourcemanager/security/armsecurity/fake/subassessments_server.go index 1949148846ec..0ae2e2e32d41 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/subassessments_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/subassessments_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // SubAssessmentsServer is a fake server for instances of the armsecurity.SubAssessmentsClient type. @@ -61,25 +61,39 @@ func (s *SubAssessmentsServerTransport) Do(req *http.Request) (*http.Response, e return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return s.dispatchToMethodFake(req, method) +} - switch method { - case "SubAssessmentsClient.Get": - resp, err = s.dispatchGet(req) - case "SubAssessmentsClient.NewListPager": - resp, err = s.dispatchNewListPager(req) - case "SubAssessmentsClient.NewListAllPager": - resp, err = s.dispatchNewListAllPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (s *SubAssessmentsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if subAssessmentsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = subAssessmentsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "SubAssessmentsClient.Get": + res.resp, res.err = s.dispatchGet(req) + case "SubAssessmentsClient.NewListPager": + res.resp, res.err = s.dispatchNewListPager(req) + case "SubAssessmentsClient.NewListAllPager": + res.resp, res.err = s.dispatchNewListAllPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (s *SubAssessmentsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -89,7 +103,7 @@ func (s *SubAssessmentsServerTransport) dispatchGet(req *http.Request) (*http.Re const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/subAssessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -109,7 +123,7 @@ func (s *SubAssessmentsServerTransport) dispatchGet(req *http.Request) (*http.Re return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).SubAssessment, req) @@ -128,7 +142,7 @@ func (s *SubAssessmentsServerTransport) dispatchNewListPager(req *http.Request) const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/assessments/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/subAssessments` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -150,7 +164,7 @@ func (s *SubAssessmentsServerTransport) dispatchNewListPager(req *http.Request) if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { s.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -169,7 +183,7 @@ func (s *SubAssessmentsServerTransport) dispatchNewListAllPager(req *http.Reques const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/subAssessments` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) @@ -187,7 +201,7 @@ func (s *SubAssessmentsServerTransport) dispatchNewListAllPager(req *http.Reques if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { s.newListAllPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -196,3 +210,9 @@ func (s *SubAssessmentsServerTransport) dispatchNewListAllPager(req *http.Reques } return resp, nil } + +// set this to conditionally intercept incoming requests to SubAssessmentsServerTransport +var subAssessmentsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/tasks_server.go b/sdk/resourcemanager/security/armsecurity/fake/tasks_server.go index bea9c4fe8fa0..0a0fd43fa3cd 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/tasks_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/tasks_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // TasksServer is a fake server for instances of the armsecurity.TasksClient type. @@ -79,33 +79,47 @@ func (t *TasksServerTransport) Do(req *http.Request) (*http.Response, error) { return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return t.dispatchToMethodFake(req, method) +} - switch method { - case "TasksClient.GetResourceGroupLevelTask": - resp, err = t.dispatchGetResourceGroupLevelTask(req) - case "TasksClient.GetSubscriptionLevelTask": - resp, err = t.dispatchGetSubscriptionLevelTask(req) - case "TasksClient.NewListPager": - resp, err = t.dispatchNewListPager(req) - case "TasksClient.NewListByHomeRegionPager": - resp, err = t.dispatchNewListByHomeRegionPager(req) - case "TasksClient.NewListByResourceGroupPager": - resp, err = t.dispatchNewListByResourceGroupPager(req) - case "TasksClient.UpdateResourceGroupLevelTaskState": - resp, err = t.dispatchUpdateResourceGroupLevelTaskState(req) - case "TasksClient.UpdateSubscriptionLevelTaskState": - resp, err = t.dispatchUpdateSubscriptionLevelTaskState(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (t *TasksServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if tasksServerTransportInterceptor != nil { + res.resp, res.err, intercepted = tasksServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "TasksClient.GetResourceGroupLevelTask": + res.resp, res.err = t.dispatchGetResourceGroupLevelTask(req) + case "TasksClient.GetSubscriptionLevelTask": + res.resp, res.err = t.dispatchGetSubscriptionLevelTask(req) + case "TasksClient.NewListPager": + res.resp, res.err = t.dispatchNewListPager(req) + case "TasksClient.NewListByHomeRegionPager": + res.resp, res.err = t.dispatchNewListByHomeRegionPager(req) + case "TasksClient.NewListByResourceGroupPager": + res.resp, res.err = t.dispatchNewListByResourceGroupPager(req) + case "TasksClient.UpdateResourceGroupLevelTaskState": + res.resp, res.err = t.dispatchUpdateResourceGroupLevelTaskState(req) + case "TasksClient.UpdateSubscriptionLevelTaskState": + res.resp, res.err = t.dispatchUpdateSubscriptionLevelTaskState(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (t *TasksServerTransport) dispatchGetResourceGroupLevelTask(req *http.Request) (*http.Response, error) { @@ -115,7 +129,7 @@ func (t *TasksServerTransport) dispatchGetResourceGroupLevelTask(req *http.Reque const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -135,7 +149,7 @@ func (t *TasksServerTransport) dispatchGetResourceGroupLevelTask(req *http.Reque return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Task, req) @@ -152,7 +166,7 @@ func (t *TasksServerTransport) dispatchGetSubscriptionLevelTask(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) @@ -168,7 +182,7 @@ func (t *TasksServerTransport) dispatchGetSubscriptionLevelTask(req *http.Reques return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).Task, req) @@ -187,15 +201,11 @@ func (t *TasksServerTransport) dispatchNewListPager(req *http.Request) (*http.Re const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/tasks` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) + filterParam := getOptional(qp.Get("$filter")) var options *armsecurity.TasksClientListOptions if filterParam != nil { options = &armsecurity.TasksClientListOptions{ @@ -213,7 +223,7 @@ func (t *TasksServerTransport) dispatchNewListPager(req *http.Request) (*http.Re if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { t.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -232,7 +242,7 @@ func (t *TasksServerTransport) dispatchNewListByHomeRegionPager(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -240,11 +250,7 @@ func (t *TasksServerTransport) dispatchNewListByHomeRegionPager(req *http.Reques if err != nil { return nil, err } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) + filterParam := getOptional(qp.Get("$filter")) var options *armsecurity.TasksClientListByHomeRegionOptions if filterParam != nil { options = &armsecurity.TasksClientListByHomeRegionOptions{ @@ -262,7 +268,7 @@ func (t *TasksServerTransport) dispatchNewListByHomeRegionPager(req *http.Reques if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { t.newListByHomeRegionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -281,7 +287,7 @@ func (t *TasksServerTransport) dispatchNewListByResourceGroupPager(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 3 { + if len(matches) < 4 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } qp := req.URL.Query() @@ -293,11 +299,7 @@ func (t *TasksServerTransport) dispatchNewListByResourceGroupPager(req *http.Req if err != nil { return nil, err } - filterUnescaped, err := url.QueryUnescape(qp.Get("$filter")) - if err != nil { - return nil, err - } - filterParam := getOptional(filterUnescaped) + filterParam := getOptional(qp.Get("$filter")) var options *armsecurity.TasksClientListByResourceGroupOptions if filterParam != nil { options = &armsecurity.TasksClientListByResourceGroupOptions{ @@ -315,7 +317,7 @@ func (t *TasksServerTransport) dispatchNewListByResourceGroupPager(req *http.Req if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { t.newListByResourceGroupPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -332,7 +334,7 @@ func (t *TasksServerTransport) dispatchUpdateResourceGroupLevelTaskState(req *ht const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 5 { + if len(matches) < 6 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -362,7 +364,7 @@ func (t *TasksServerTransport) dispatchUpdateResourceGroupLevelTaskState(req *ht return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -379,7 +381,7 @@ func (t *TasksServerTransport) dispatchUpdateSubscriptionLevelTaskState(req *htt const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/tasks/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) @@ -405,7 +407,7 @@ func (t *TasksServerTransport) dispatchUpdateSubscriptionLevelTaskState(req *htt return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -414,3 +416,9 @@ func (t *TasksServerTransport) dispatchUpdateSubscriptionLevelTaskState(req *htt } return resp, nil } + +// set this to conditionally intercept incoming requests to TasksServerTransport +var tasksServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/time_rfc3339.go b/sdk/resourcemanager/security/armsecurity/fake/time_rfc3339.go deleted file mode 100644 index 48727835bf70..000000000000 --- a/sdk/resourcemanager/security/armsecurity/fake/time_rfc3339.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package fake - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) - -const ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/security/armsecurity/fake/topology_server.go b/sdk/resourcemanager/security/armsecurity/fake/topology_server.go index 05d1718aea7c..d85bd4c05e01 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/topology_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/topology_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // TopologyServer is a fake server for instances of the armsecurity.TopologyClient type. @@ -61,25 +61,39 @@ func (t *TopologyServerTransport) Do(req *http.Request) (*http.Response, error) return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return t.dispatchToMethodFake(req, method) +} - switch method { - case "TopologyClient.Get": - resp, err = t.dispatchGet(req) - case "TopologyClient.NewListPager": - resp, err = t.dispatchNewListPager(req) - case "TopologyClient.NewListByHomeRegionPager": - resp, err = t.dispatchNewListByHomeRegionPager(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (t *TopologyServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if topologyServerTransportInterceptor != nil { + res.resp, res.err, intercepted = topologyServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "TopologyClient.Get": + res.resp, res.err = t.dispatchGet(req) + case "TopologyClient.NewListPager": + res.resp, res.err = t.dispatchNewListPager(req) + case "TopologyClient.NewListByHomeRegionPager": + res.resp, res.err = t.dispatchNewListByHomeRegionPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (t *TopologyServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { @@ -89,7 +103,7 @@ func (t *TopologyServerTransport) dispatchGet(req *http.Request) (*http.Response const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/resourceGroups/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topologies/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 4 { + if len(matches) < 5 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resourceGroupNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("resourceGroupName")]) @@ -109,7 +123,7 @@ func (t *TopologyServerTransport) dispatchGet(req *http.Request) (*http.Response return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).TopologyResource, req) @@ -128,7 +142,7 @@ func (t *TopologyServerTransport) dispatchNewListPager(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/topologies` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := t.srv.NewListPager(nil) @@ -142,7 +156,7 @@ func (t *TopologyServerTransport) dispatchNewListPager(req *http.Request) (*http if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { t.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -161,7 +175,7 @@ func (t *TopologyServerTransport) dispatchNewListByHomeRegionPager(req *http.Req const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/locations/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/topologies` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } ascLocationParam, err := url.PathUnescape(matches[regex.SubexpIndex("ascLocation")]) @@ -179,7 +193,7 @@ func (t *TopologyServerTransport) dispatchNewListByHomeRegionPager(req *http.Req if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { t.newListByHomeRegionPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -188,3 +202,9 @@ func (t *TopologyServerTransport) dispatchNewListByHomeRegionPager(req *http.Req } return resp, nil } + +// set this to conditionally intercept incoming requests to TopologyServerTransport +var topologyServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/workspacesettings_server.go b/sdk/resourcemanager/security/armsecurity/fake/workspacesettings_server.go index f61aafca62f8..f6816ddd45a9 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/workspacesettings_server.go +++ b/sdk/resourcemanager/security/armsecurity/fake/workspacesettings_server.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package fake @@ -17,6 +16,7 @@ import ( "net/http" "net/url" "regexp" + "slices" ) // WorkspaceSettingsServer is a fake server for instances of the armsecurity.WorkspaceSettingsClient type. @@ -67,29 +67,43 @@ func (w *WorkspaceSettingsServerTransport) Do(req *http.Request) (*http.Response return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} } - var resp *http.Response - var err error + return w.dispatchToMethodFake(req, method) +} - switch method { - case "WorkspaceSettingsClient.Create": - resp, err = w.dispatchCreate(req) - case "WorkspaceSettingsClient.Delete": - resp, err = w.dispatchDelete(req) - case "WorkspaceSettingsClient.Get": - resp, err = w.dispatchGet(req) - case "WorkspaceSettingsClient.NewListPager": - resp, err = w.dispatchNewListPager(req) - case "WorkspaceSettingsClient.Update": - resp, err = w.dispatchUpdate(req) - default: - err = fmt.Errorf("unhandled API %s", method) - } +func (w *WorkspaceSettingsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if workspaceSettingsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = workspaceSettingsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "WorkspaceSettingsClient.Create": + res.resp, res.err = w.dispatchCreate(req) + case "WorkspaceSettingsClient.Delete": + res.resp, res.err = w.dispatchDelete(req) + case "WorkspaceSettingsClient.Get": + res.resp, res.err = w.dispatchGet(req) + case "WorkspaceSettingsClient.NewListPager": + res.resp, res.err = w.dispatchNewListPager(req) + case "WorkspaceSettingsClient.Update": + res.resp, res.err = w.dispatchUpdate(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } - if err != nil { - return nil, err - } + } + resultChan <- res + }() - return resp, nil + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } } func (w *WorkspaceSettingsServerTransport) dispatchCreate(req *http.Request) (*http.Response, error) { @@ -99,7 +113,7 @@ func (w *WorkspaceSettingsServerTransport) dispatchCreate(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/workspaceSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.WorkspaceSetting](req) @@ -115,7 +129,7 @@ func (w *WorkspaceSettingsServerTransport) dispatchCreate(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).WorkspaceSetting, req) @@ -132,7 +146,7 @@ func (w *WorkspaceSettingsServerTransport) dispatchDelete(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/workspaceSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } workspaceSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceSettingName")]) @@ -144,7 +158,7 @@ func (w *WorkspaceSettingsServerTransport) dispatchDelete(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusNoContent}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusNoContent", respContent.HTTPStatus)} } resp, err := server.NewResponse(respContent, req, nil) @@ -161,7 +175,7 @@ func (w *WorkspaceSettingsServerTransport) dispatchGet(req *http.Request) (*http const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/workspaceSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } workspaceSettingNameParam, err := url.PathUnescape(matches[regex.SubexpIndex("workspaceSettingName")]) @@ -173,7 +187,7 @@ func (w *WorkspaceSettingsServerTransport) dispatchGet(req *http.Request) (*http return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).WorkspaceSetting, req) @@ -192,7 +206,7 @@ func (w *WorkspaceSettingsServerTransport) dispatchNewListPager(req *http.Reques const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/workspaceSettings` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 1 { + if len(matches) < 2 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } resp := w.srv.NewListPager(nil) @@ -206,7 +220,7 @@ func (w *WorkspaceSettingsServerTransport) dispatchNewListPager(req *http.Reques if err != nil { return nil, err } - if !contains([]int{http.StatusOK}, resp.StatusCode) { + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { w.newListPager.remove(req) return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} } @@ -223,7 +237,7 @@ func (w *WorkspaceSettingsServerTransport) dispatchUpdate(req *http.Request) (*h const regexStr = `/subscriptions/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/workspaceSettings/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` regex := regexp.MustCompile(regexStr) matches := regex.FindStringSubmatch(req.URL.EscapedPath()) - if matches == nil || len(matches) < 2 { + if len(matches) < 3 { return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) } body, err := server.UnmarshalRequestAsJSON[armsecurity.WorkspaceSetting](req) @@ -239,7 +253,7 @@ func (w *WorkspaceSettingsServerTransport) dispatchUpdate(req *http.Request) (*h return nil, respErr } respContent := server.GetResponseContent(respr) - if !contains([]int{http.StatusOK}, respContent.HTTPStatus) { + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} } resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).WorkspaceSetting, req) @@ -248,3 +262,9 @@ func (w *WorkspaceSettingsServerTransport) dispatchUpdate(req *http.Request) (*h } return resp, nil } + +// set this to conditionally intercept incoming requests to WorkspaceSettingsServerTransport +var workspaceSettingsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/githubissues_client.go b/sdk/resourcemanager/security/armsecurity/githubissues_client.go new file mode 100644 index 000000000000..9728727874e0 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/githubissues_client.go @@ -0,0 +1,134 @@ +// 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) Go Code Generator. 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" + "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" +) + +// GitHubIssuesClient contains the methods for the GitHubIssues group. +// Don't use this type directly, use NewGitHubIssuesClient() instead. +type GitHubIssuesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewGitHubIssuesClient creates a new instance of GitHubIssuesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewGitHubIssuesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GitHubIssuesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &GitHubIssuesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Creates a GitHub issue for the specified repository and assessment. +// +// Creates a GitHub issue for the specified repository and assessment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-11-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - securityConnectorName - The security connector name. +// - options - GitHubIssuesClientBeginCreateOptions contains the optional parameters for the GitHubIssuesClient.BeginCreate +// method. +func (client *GitHubIssuesClient) BeginCreate(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, repoName string, options *GitHubIssuesClientBeginCreateOptions) (*runtime.Poller[GitHubIssuesClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, securityConnectorName, ownerName, repoName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GitHubIssuesClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[GitHubIssuesClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Creates a GitHub issue for the specified repository and assessment. +// +// Creates a GitHub issue for the specified repository and assessment. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-11-01-preview +func (client *GitHubIssuesClient) create(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, repoName string, options *GitHubIssuesClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "GitHubIssuesClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, securityConnectorName, ownerName, repoName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *GitHubIssuesClient) createCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, repoName string, options *GitHubIssuesClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos/{repoName}/issues" + 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 ownerName == "" { + return nil, errors.New("parameter ownerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{ownerName}", url.PathEscape(ownerName)) + if repoName == "" { + return nil, errors.New("parameter repoName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{repoName}", url.PathEscape(repoName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-11-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + if options != nil && options.CreateIssueRequest != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, *options.CreateIssueRequest); err != nil { + return nil, err + } + return req, nil + } + return req, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/githubowners_client.go b/sdk/resourcemanager/security/armsecurity/githubowners_client.go index 12c1430d79c9..e28b2dcb99b0 100644 --- a/sdk/resourcemanager/security/armsecurity/githubowners_client.go +++ b/sdk/resourcemanager/security/armsecurity/githubowners_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type GitHubOwnersClient struct { } // NewGitHubOwnersClient creates a new instance of GitHubOwnersClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewGitHubOwnersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GitHubOwnersClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,12 +40,13 @@ func NewGitHubOwnersClient(subscriptionID string, credential azcore.TokenCredent } // Get - Returns a monitored GitHub owner. +// +// Returns a monitored GitHub owner. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - ownerName - The GitHub owner name. // - options - GitHubOwnersClientGetOptions contains the optional parameters for the GitHubOwnersClient.Get method. func (client *GitHubOwnersClient) Get(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, options *GitHubOwnersClientGetOptions) (GitHubOwnersClientGetResponse, error) { var err error @@ -71,7 +71,7 @@ func (client *GitHubOwnersClient) Get(ctx context.Context, resourceGroupName str } // getCreateRequest creates the Get request. -func (client *GitHubOwnersClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, options *GitHubOwnersClientGetOptions) (*policy.Request, error) { +func (client *GitHubOwnersClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, _ *GitHubOwnersClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -94,7 +94,7 @@ func (client *GitHubOwnersClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -111,7 +111,9 @@ func (client *GitHubOwnersClient) getHandleResponse(resp *http.Response) (GitHub // NewListPager - Returns a list of GitHub owners onboarded to the connector. // -// Generated from API version 2023-09-01-preview +// Returns a list of GitHub owners onboarded to the connector. +// +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. // - options - GitHubOwnersClientListOptions contains the optional parameters for the GitHubOwnersClient.NewListPager method. @@ -139,7 +141,7 @@ func (client *GitHubOwnersClient) NewListPager(resourceGroupName string, securit } // listCreateRequest creates the List request. -func (client *GitHubOwnersClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *GitHubOwnersClientListOptions) (*policy.Request, error) { +func (client *GitHubOwnersClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, _ *GitHubOwnersClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -158,7 +160,7 @@ func (client *GitHubOwnersClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -174,9 +176,11 @@ func (client *GitHubOwnersClient) listHandleResponse(resp *http.Response) (GitHu } // ListAvailable - Returns a list of all GitHub owners accessible by the user token consumed by the connector. +// +// Returns a list of all GitHub owners accessible by the user token consumed by the connector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. // - options - GitHubOwnersClientListAvailableOptions contains the optional parameters for the GitHubOwnersClient.ListAvailable @@ -204,7 +208,7 @@ func (client *GitHubOwnersClient) ListAvailable(ctx context.Context, resourceGro } // listAvailableCreateRequest creates the ListAvailable request. -func (client *GitHubOwnersClient) listAvailableCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *GitHubOwnersClientListAvailableOptions) (*policy.Request, error) { +func (client *GitHubOwnersClient) listAvailableCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, _ *GitHubOwnersClientListAvailableOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/listAvailableGitHubOwners" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -223,7 +227,7 @@ func (client *GitHubOwnersClient) listAvailableCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-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/githubrepos_client.go b/sdk/resourcemanager/security/armsecurity/githubrepos_client.go index d9b499d874c6..76395b85d46e 100644 --- a/sdk/resourcemanager/security/armsecurity/githubrepos_client.go +++ b/sdk/resourcemanager/security/armsecurity/githubrepos_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type GitHubReposClient struct { } // NewGitHubReposClient creates a new instance of GitHubReposClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewGitHubReposClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GitHubReposClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,13 +40,13 @@ func NewGitHubReposClient(subscriptionID string, credential azcore.TokenCredenti } // Get - Returns a monitored GitHub repository. +// +// Returns a monitored GitHub repository. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - ownerName - The GitHub owner name. -// - repoName - The repository name. // - options - GitHubReposClientGetOptions contains the optional parameters for the GitHubReposClient.Get method. func (client *GitHubReposClient) Get(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, repoName string, options *GitHubReposClientGetOptions) (GitHubReposClientGetResponse, error) { var err error @@ -72,7 +71,7 @@ func (client *GitHubReposClient) Get(ctx context.Context, resourceGroupName stri } // getCreateRequest creates the Get request. -func (client *GitHubReposClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, repoName string, options *GitHubReposClientGetOptions) (*policy.Request, error) { +func (client *GitHubReposClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, repoName string, _ *GitHubReposClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos/{repoName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -99,7 +98,7 @@ func (client *GitHubReposClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -116,10 +115,11 @@ func (client *GitHubReposClient) getHandleResponse(resp *http.Response) (GitHubR // NewListPager - Returns a list of GitHub repositories onboarded to the connector. // -// Generated from API version 2023-09-01-preview +// Returns a list of GitHub repositories onboarded to the connector. +// +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - ownerName - The GitHub owner name. // - options - GitHubReposClientListOptions contains the optional parameters for the GitHubReposClient.NewListPager method. func (client *GitHubReposClient) NewListPager(resourceGroupName string, securityConnectorName string, ownerName string, options *GitHubReposClientListOptions) *runtime.Pager[GitHubReposClientListResponse] { return runtime.NewPager(runtime.PagingHandler[GitHubReposClientListResponse]{ @@ -145,7 +145,7 @@ func (client *GitHubReposClient) NewListPager(resourceGroupName string, security } // listCreateRequest creates the List request. -func (client *GitHubReposClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, options *GitHubReposClientListOptions) (*policy.Request, error) { +func (client *GitHubReposClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, _ *GitHubReposClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitHubOwners/{ownerName}/repos" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -168,7 +168,7 @@ func (client *GitHubReposClient) listCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-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/gitlabgroups_client.go b/sdk/resourcemanager/security/armsecurity/gitlabgroups_client.go index 8f6f1648f63e..e26a00047dec 100644 --- a/sdk/resourcemanager/security/armsecurity/gitlabgroups_client.go +++ b/sdk/resourcemanager/security/armsecurity/gitlabgroups_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type GitLabGroupsClient struct { } // NewGitLabGroupsClient creates a new instance of GitLabGroupsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewGitLabGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GitLabGroupsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,12 +40,13 @@ func NewGitLabGroupsClient(subscriptionID string, credential azcore.TokenCredent } // Get - Returns a monitored GitLab Group resource for a given fully-qualified name. +// +// Returns a monitored GitLab Group resource for a given fully-qualified name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - groupFQName - The GitLab group fully-qualified name. // - options - GitLabGroupsClientGetOptions contains the optional parameters for the GitLabGroupsClient.Get method. func (client *GitLabGroupsClient) Get(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, options *GitLabGroupsClientGetOptions) (GitLabGroupsClientGetResponse, error) { var err error @@ -71,7 +71,7 @@ func (client *GitLabGroupsClient) Get(ctx context.Context, resourceGroupName str } // getCreateRequest creates the Get request. -func (client *GitLabGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, options *GitLabGroupsClientGetOptions) (*policy.Request, error) { +func (client *GitLabGroupsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, _ *GitLabGroupsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -94,7 +94,7 @@ func (client *GitLabGroupsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -111,7 +111,9 @@ func (client *GitLabGroupsClient) getHandleResponse(resp *http.Response) (GitLab // NewListPager - Returns a list of GitLab groups onboarded to the connector. // -// Generated from API version 2023-09-01-preview +// Returns a list of GitLab groups onboarded to the connector. +// +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. // - options - GitLabGroupsClientListOptions contains the optional parameters for the GitLabGroupsClient.NewListPager method. @@ -139,7 +141,7 @@ func (client *GitLabGroupsClient) NewListPager(resourceGroupName string, securit } // listCreateRequest creates the List request. -func (client *GitLabGroupsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *GitLabGroupsClientListOptions) (*policy.Request, error) { +func (client *GitLabGroupsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, _ *GitLabGroupsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -158,7 +160,7 @@ func (client *GitLabGroupsClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -174,9 +176,11 @@ func (client *GitLabGroupsClient) listHandleResponse(resp *http.Response) (GitLa } // ListAvailable - Returns a list of all GitLab groups accessible by the user token consumed by the connector. +// +// Returns a list of all GitLab groups accessible by the user token consumed by the connector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. // - options - GitLabGroupsClientListAvailableOptions contains the optional parameters for the GitLabGroupsClient.ListAvailable @@ -204,7 +208,7 @@ func (client *GitLabGroupsClient) ListAvailable(ctx context.Context, resourceGro } // listAvailableCreateRequest creates the ListAvailable request. -func (client *GitLabGroupsClient) listAvailableCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *GitLabGroupsClientListAvailableOptions) (*policy.Request, error) { +func (client *GitLabGroupsClient) listAvailableCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, _ *GitLabGroupsClientListAvailableOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/listAvailableGitLabGroups" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -223,7 +227,7 @@ func (client *GitLabGroupsClient) listAvailableCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-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/gitlabprojects_client.go b/sdk/resourcemanager/security/armsecurity/gitlabprojects_client.go index d6ab964da0b7..0c6fde5c57b4 100644 --- a/sdk/resourcemanager/security/armsecurity/gitlabprojects_client.go +++ b/sdk/resourcemanager/security/armsecurity/gitlabprojects_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type GitLabProjectsClient struct { } // NewGitLabProjectsClient creates a new instance of GitLabProjectsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewGitLabProjectsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GitLabProjectsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,13 +40,13 @@ func NewGitLabProjectsClient(subscriptionID string, credential azcore.TokenCrede } // Get - Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. +// +// Returns a monitored GitLab Project resource for a given fully-qualified group name and project name. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - groupFQName - The GitLab group fully-qualified name. -// - projectName - The project name. // - options - GitLabProjectsClientGetOptions contains the optional parameters for the GitLabProjectsClient.Get method. func (client *GitLabProjectsClient) Get(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, projectName string, options *GitLabProjectsClientGetOptions) (GitLabProjectsClientGetResponse, error) { var err error @@ -72,7 +71,7 @@ func (client *GitLabProjectsClient) Get(ctx context.Context, resourceGroupName s } // getCreateRequest creates the Get request. -func (client *GitLabProjectsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, projectName string, options *GitLabProjectsClientGetOptions) (*policy.Request, error) { +func (client *GitLabProjectsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, projectName string, _ *GitLabProjectsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects/{projectName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -99,7 +98,7 @@ func (client *GitLabProjectsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -116,10 +115,11 @@ func (client *GitLabProjectsClient) getHandleResponse(resp *http.Response) (GitL // NewListPager - Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector. // -// Generated from API version 2023-09-01-preview +// Gets a list of GitLab projects that are directly owned by given group and onboarded to the connector. +// +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - groupFQName - The GitLab group fully-qualified name. // - options - GitLabProjectsClientListOptions contains the optional parameters for the GitLabProjectsClient.NewListPager method. func (client *GitLabProjectsClient) NewListPager(resourceGroupName string, securityConnectorName string, groupFQName string, options *GitLabProjectsClientListOptions) *runtime.Pager[GitLabProjectsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[GitLabProjectsClientListResponse]{ @@ -145,7 +145,7 @@ func (client *GitLabProjectsClient) NewListPager(resourceGroupName string, secur } // listCreateRequest creates the List request. -func (client *GitLabProjectsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, options *GitLabProjectsClientListOptions) (*policy.Request, error) { +func (client *GitLabProjectsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, _ *GitLabProjectsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/projects" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -168,7 +168,7 @@ func (client *GitLabProjectsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-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/gitlabsubgroups_client.go b/sdk/resourcemanager/security/armsecurity/gitlabsubgroups_client.go index d07630a087d9..55a8c73044bd 100644 --- a/sdk/resourcemanager/security/armsecurity/gitlabsubgroups_client.go +++ b/sdk/resourcemanager/security/armsecurity/gitlabsubgroups_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type GitLabSubgroupsClient struct { } // NewGitLabSubgroupsClient creates a new instance of GitLabSubgroupsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewGitLabSubgroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GitLabSubgroupsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,12 +40,13 @@ func NewGitLabSubgroupsClient(subscriptionID string, credential azcore.TokenCred } // List - Gets nested subgroups of given GitLab Group which are onboarded to the connector. +// +// Gets nested subgroups of given GitLab Group which are onboarded to the connector. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-09-01-preview +// Generated from API version 2025-11-01-preview // - resourceGroupName - The name of the resource group. The name is case insensitive. // - securityConnectorName - The security connector name. -// - groupFQName - The GitLab group fully-qualified name. // - options - GitLabSubgroupsClientListOptions contains the optional parameters for the GitLabSubgroupsClient.List method. func (client *GitLabSubgroupsClient) List(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, options *GitLabSubgroupsClientListOptions) (GitLabSubgroupsClientListResponse, error) { var err error @@ -71,7 +71,7 @@ func (client *GitLabSubgroupsClient) List(ctx context.Context, resourceGroupName } // listCreateRequest creates the List request. -func (client *GitLabSubgroupsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, options *GitLabSubgroupsClientListOptions) (*policy.Request, error) { +func (client *GitLabSubgroupsClient) listCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, groupFQName string, _ *GitLabSubgroupsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}/devops/default/gitLabGroups/{groupFQName}/listSubgroups" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -94,7 +94,7 @@ func (client *GitLabSubgroupsClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-09-01-preview") + reqQP.Set("api-version", "2025-11-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/go.mod b/sdk/resourcemanager/security/armsecurity/go.mod index 749a60e168da..b08c5a2449a5 100644 --- a/sdk/resourcemanager/security/armsecurity/go.mod +++ b/sdk/resourcemanager/security/armsecurity/go.mod @@ -3,19 +3,19 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurit go 1.25.0 require ( - github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 + github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1 github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 ) require ( - github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 // indirect + github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 // indirect github.com/AzureAD/microsoft-authentication-library-for-go v1.7.0 // indirect github.com/golang-jwt/jwt/v5 v5.3.1 // indirect github.com/google/uuid v1.6.0 // indirect github.com/kylelemons/godebug v1.1.0 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect - golang.org/x/crypto v0.49.0 // indirect - golang.org/x/net v0.52.0 // indirect - golang.org/x/sys v0.42.0 // indirect - golang.org/x/text v0.35.0 // indirect + golang.org/x/crypto v0.50.0 // indirect + golang.org/x/net v0.53.0 // indirect + golang.org/x/sys v0.43.0 // indirect + golang.org/x/text v0.36.0 // indirect ) diff --git a/sdk/resourcemanager/security/armsecurity/go.sum b/sdk/resourcemanager/security/armsecurity/go.sum index 39dc1cef1d34..8811f5b1cf99 100644 --- a/sdk/resourcemanager/security/armsecurity/go.sum +++ b/sdk/resourcemanager/security/armsecurity/go.sum @@ -1,11 +1,11 @@ -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0 h1:fou+2+WFTib47nS+nz/ozhEBnvU96bKHy6LjRsY4E28= -github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.0/go.mod h1:t76Ruy8AHvUAC8GfMWJMa0ElSbuIcO03NLpynfbgsPA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1 h1:jHb/wfvRikGdxMXYV3QG/SzUOPYN9KEUUuC0Yd0/vC0= +github.com/Azure/azure-sdk-for-go/sdk/azcore v1.21.1/go.mod h1:pzBXCYn05zvYIrwLgtK8Ap8QcjRg+0i76tMQdWN6wOk= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1 h1:Hk5QBxZQC1jb2Fwj6mpzme37xbCDdNTxU7O9eb5+LB4= github.com/Azure/azure-sdk-for-go/sdk/azidentity v1.13.1/go.mod h1:IYus9qsFobWIc2YVwe/WPjcnyCkPKtnHAqUYeebc8z0= github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2 h1:yz1bePFlP5Vws5+8ez6T3HWXPmwOK7Yvq8QxDBD3SKY= github.com/Azure/azure-sdk-for-go/sdk/azidentity/cache v0.3.2/go.mod h1:Pa9ZNPuoNu/GztvBSKk9J1cDJW6vk/n0zLtV4mgd8N8= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2 h1:9iefClla7iYpfYWdzPCRDozdmndjTm8DXdpCzPajMgA= -github.com/Azure/azure-sdk-for-go/sdk/internal v1.11.2/go.mod h1:XtLgD3ZD34DAaVIIAyG3objl5DynM3CQ/vMcbBNJZGI= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0 h1:fhqpLE3UEXi9lPaBRpQ6XuRW0nU7hgg4zlmZZa+a9q4= +github.com/Azure/azure-sdk-for-go/sdk/internal v1.12.0/go.mod h1:7dCRMLwisfRH3dBupKeNCioWYUZ4SS09Z14H+7i8ZoY= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1 h1:WJTmL004Abzc5wDB5VtZG2PJk5ndYDgVacGqfirKxjM= github.com/AzureAD/microsoft-authentication-extensions-for-go/cache v0.1.1/go.mod h1:tCcJZ0uHAmvjsVYzEFivsRTN00oz5BEsRgQHu5JZ9WE= github.com/AzureAD/microsoft-authentication-library-for-go v1.7.0 h1:4iB+IesclUXdP0ICgAabvq2FYLXrJWKx1fJQ+GxSo3Y= @@ -26,14 +26,14 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= -golang.org/x/crypto v0.49.0 h1:+Ng2ULVvLHnJ/ZFEq4KdcDd/cfjrrjjNSXNzxg0Y4U4= -golang.org/x/crypto v0.49.0/go.mod h1:ErX4dUh2UM+CFYiXZRTcMpEcN8b/1gxEuv3nODoYtCA= -golang.org/x/net v0.52.0 h1:He/TN1l0e4mmR3QqHMT2Xab3Aj3L9qjbhRm78/6jrW0= -golang.org/x/net v0.52.0/go.mod h1:R1MAz7uMZxVMualyPXb+VaqGSa3LIaUqk0eEt3w36Sw= +golang.org/x/crypto v0.50.0 h1:zO47/JPrL6vsNkINmLoo/PH1gcxpls50DNogFvB5ZGI= +golang.org/x/crypto v0.50.0/go.mod h1:3muZ7vA7PBCE6xgPX7nkzzjiUq87kRItoJQM1Yo8S+Q= +golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= +golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= -golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/text v0.35.0 h1:JOVx6vVDFokkpaq1AEptVzLTpDe9KGpj5tR4/X+ybL8= -golang.org/x/text v0.35.0/go.mod h1:khi/HExzZJ2pGnjenulevKNX1W67CUy0AsXcNubPGCA= +golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= +golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/text v0.36.0 h1:JfKh3XmcRPqZPKevfXVpI1wXPTqbkE5f7JA92a55Yxg= +golang.org/x/text v0.36.0/go.mod h1:NIdBknypM8iqVmPiuco0Dh6P5Jcdk8lJL0CUebqK164= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/security/armsecurity/governanceassignments_client.go b/sdk/resourcemanager/security/armsecurity/governanceassignments_client.go index 0b6d547621ca..0db01e5e9dc4 100644 --- a/sdk/resourcemanager/security/armsecurity/governanceassignments_client.go +++ b/sdk/resourcemanager/security/armsecurity/governanceassignments_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,7 +24,7 @@ type GovernanceAssignmentsClient struct { // 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. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewGovernanceAssignmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GovernanceAssignmentsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,11 +40,9 @@ func NewGovernanceAssignmentsClient(credential azcore.TokenCredential, options * // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-01-01-preview -// - scope - The scope of the Governance assignments. Valid scopes are: subscription (format: 'subscriptions/{subscriptionId}'), -// or security connector (format: -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})' -// - assessmentName - The Assessment Key - A unique key for the assessment type -// - assignmentKey - The governance assignment key - the assessment key of the required governance assignment +// - scope - The scope of the governance assignment. +// - assessmentName - The assessment key of the governance assignment. +// - assignmentKey - The governance assignment key. // - governanceAssignment - Governance assignment over a subscription scope // - options - GovernanceAssignmentsClientCreateOrUpdateOptions contains the optional parameters for the GovernanceAssignmentsClient.CreateOrUpdate // method. @@ -72,12 +69,12 @@ func (client *GovernanceAssignmentsClient) CreateOrUpdate(ctx context.Context, s } // 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) { +func (client *GovernanceAssignmentsClient) createOrUpdateCreateRequest(ctx context.Context, scope string, assessmentName string, assignmentKey string, governanceAssignment GovernanceAssignment, _ *GovernanceAssignmentsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" if scope == "" { return nil, errors.New("parameter scope cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if assessmentName == "" { return nil, errors.New("parameter assessmentName cannot be empty") } @@ -94,6 +91,7 @@ func (client *GovernanceAssignmentsClient) createOrUpdateCreateRequest(ctx conte reqQP.Set("api-version", "2022-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, governanceAssignment); err != nil { return nil, err } @@ -113,11 +111,9 @@ func (client *GovernanceAssignmentsClient) createOrUpdateHandleResponse(resp *ht // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-01-01-preview -// - scope - The scope of the Governance assignments. Valid scopes are: subscription (format: 'subscriptions/{subscriptionId}'), -// or security connector (format: -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})' -// - assessmentName - The Assessment Key - A unique key for the assessment type -// - assignmentKey - The governance assignment key - the assessment key of the required governance assignment +// - scope - The scope of the governance assignment. +// - assessmentName - The assessment key of the governance assignment. +// - assignmentKey - The governance assignment key. // - 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) { @@ -142,12 +138,12 @@ func (client *GovernanceAssignmentsClient) Delete(ctx context.Context, scope str } // deleteCreateRequest creates the Delete request. -func (client *GovernanceAssignmentsClient) deleteCreateRequest(ctx context.Context, scope string, assessmentName string, assignmentKey string, options *GovernanceAssignmentsClientDeleteOptions) (*policy.Request, error) { +func (client *GovernanceAssignmentsClient) deleteCreateRequest(ctx context.Context, scope string, assessmentName string, assignmentKey string, _ *GovernanceAssignmentsClientDeleteOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" if scope == "" { return nil, errors.New("parameter scope cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if assessmentName == "" { return nil, errors.New("parameter assessmentName cannot be empty") } @@ -170,11 +166,9 @@ func (client *GovernanceAssignmentsClient) deleteCreateRequest(ctx context.Conte // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-01-01-preview -// - scope - The scope of the Governance assignments. Valid scopes are: subscription (format: 'subscriptions/{subscriptionId}'), -// or security connector (format: -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})' -// - assessmentName - The Assessment Key - A unique key for the assessment type -// - assignmentKey - The governance assignment key - the assessment key of the required governance assignment +// - scope - The scope of the governance assignment. +// - assessmentName - The assessment key of the governance assignment. +// - assignmentKey - The governance assignment key. // - 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) { @@ -200,12 +194,12 @@ func (client *GovernanceAssignmentsClient) Get(ctx context.Context, scope string } // getCreateRequest creates the Get request. -func (client *GovernanceAssignmentsClient) getCreateRequest(ctx context.Context, scope string, assessmentName string, assignmentKey string, options *GovernanceAssignmentsClientGetOptions) (*policy.Request, error) { +func (client *GovernanceAssignmentsClient) getCreateRequest(ctx context.Context, scope string, assessmentName string, assignmentKey string, _ *GovernanceAssignmentsClientGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments/{assignmentKey}" if scope == "" { return nil, errors.New("parameter scope cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if assessmentName == "" { return nil, errors.New("parameter assessmentName cannot be empty") } @@ -237,10 +231,8 @@ func (client *GovernanceAssignmentsClient) getHandleResponse(resp *http.Response // NewListPager - Get governance assignments on all of your resources inside a scope // // Generated from API version 2022-01-01-preview -// - scope - The scope of the Governance assignments. Valid scopes are: subscription (format: 'subscriptions/{subscriptionId}'), -// or security connector (format: -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})' -// - assessmentName - The Assessment Key - A unique key for the assessment type +// - scope - The scope of the governance assignment. +// - assessmentName - The assessment key of the governance assignment. // - options - GovernanceAssignmentsClientListOptions contains the optional parameters for the GovernanceAssignmentsClient.NewListPager // method. func (client *GovernanceAssignmentsClient) NewListPager(scope string, assessmentName string, options *GovernanceAssignmentsClientListOptions) *runtime.Pager[GovernanceAssignmentsClientListResponse] { @@ -267,12 +259,12 @@ func (client *GovernanceAssignmentsClient) NewListPager(scope string, assessment } // listCreateRequest creates the List request. -func (client *GovernanceAssignmentsClient) listCreateRequest(ctx context.Context, scope string, assessmentName string, options *GovernanceAssignmentsClientListOptions) (*policy.Request, error) { +func (client *GovernanceAssignmentsClient) listCreateRequest(ctx context.Context, scope string, assessmentName string, _ *GovernanceAssignmentsClientListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/governanceAssignments" if scope == "" { return nil, errors.New("parameter scope cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if assessmentName == "" { return nil, errors.New("parameter assessmentName cannot be empty") } diff --git a/sdk/resourcemanager/security/armsecurity/governancerules_client.go b/sdk/resourcemanager/security/armsecurity/governancerules_client.go index 86a7b0aae1da..f4b767ecc6b1 100644 --- a/sdk/resourcemanager/security/armsecurity/governancerules_client.go +++ b/sdk/resourcemanager/security/armsecurity/governancerules_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,7 +24,7 @@ type GovernanceRulesClient struct { // NewGovernanceRulesClient creates a new instance of GovernanceRulesClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewGovernanceRulesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*GovernanceRulesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,10 +40,7 @@ func NewGovernanceRulesClient(credential azcore.TokenCredential, options *arm.Cl // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-01-01-preview -// - scope - The scope of the Governance rules. Valid scopes are: management group (format: 'providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: -// 'subscriptions/{subscriptionId}'), or security connector (format: -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})' +// - scope - The fully qualified Azure Resource manager identifier of the resource. // - ruleID - The governance rule key - unique key for the standard governance rule (GUID) // - governanceRule - Governance rule over a given scope // - options - GovernanceRulesClientCreateOrUpdateOptions contains the optional parameters for the GovernanceRulesClient.CreateOrUpdate @@ -72,12 +68,12 @@ func (client *GovernanceRulesClient) CreateOrUpdate(ctx context.Context, scope s } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *GovernanceRulesClient) createOrUpdateCreateRequest(ctx context.Context, scope string, ruleID string, governanceRule GovernanceRule, options *GovernanceRulesClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *GovernanceRulesClient) createOrUpdateCreateRequest(ctx context.Context, scope string, ruleID string, governanceRule GovernanceRule, _ *GovernanceRulesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}" if scope == "" { return nil, errors.New("parameter scope cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if ruleID == "" { return nil, errors.New("parameter ruleID cannot be empty") } @@ -90,6 +86,7 @@ func (client *GovernanceRulesClient) createOrUpdateCreateRequest(ctx context.Con reqQP.Set("api-version", "2022-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, governanceRule); err != nil { return nil, err } @@ -109,10 +106,7 @@ func (client *GovernanceRulesClient) createOrUpdateHandleResponse(resp *http.Res // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-01-01-preview -// - scope - The scope of the Governance rules. Valid scopes are: management group (format: 'providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: -// 'subscriptions/{subscriptionId}'), or security connector (format: -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})' +// - scope - The fully qualified Azure Resource manager identifier of the resource. // - ruleID - The governance rule key - unique key for the standard governance rule (GUID) // - options - GovernanceRulesClientBeginDeleteOptions contains the optional parameters for the GovernanceRulesClient.BeginDelete // method. @@ -123,8 +117,7 @@ func (client *GovernanceRulesClient) BeginDelete(ctx context.Context, scope stri return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GovernanceRulesClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -160,12 +153,12 @@ func (client *GovernanceRulesClient) deleteOperation(ctx context.Context, scope } // deleteCreateRequest creates the Delete request. -func (client *GovernanceRulesClient) deleteCreateRequest(ctx context.Context, scope string, ruleID string, options *GovernanceRulesClientBeginDeleteOptions) (*policy.Request, error) { +func (client *GovernanceRulesClient) deleteCreateRequest(ctx context.Context, scope string, ruleID string, _ *GovernanceRulesClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}" if scope == "" { return nil, errors.New("parameter scope cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if ruleID == "" { return nil, errors.New("parameter ruleID cannot be empty") } @@ -184,10 +177,7 @@ func (client *GovernanceRulesClient) deleteCreateRequest(ctx context.Context, sc // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-01-01-preview -// - scope - The scope of the Governance rules. Valid scopes are: management group (format: 'providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: -// 'subscriptions/{subscriptionId}'), or security connector (format: -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})' +// - scope - The fully qualified Azure Resource manager identifier of the resource. // - ruleID - The governance rule key - unique key for the standard governance rule (GUID) // - options - GovernanceRulesClientBeginExecuteOptions contains the optional parameters for the GovernanceRulesClient.BeginExecute // method. @@ -198,8 +188,7 @@ func (client *GovernanceRulesClient) BeginExecute(ctx context.Context, scope str return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[GovernanceRulesClientExecuteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -240,7 +229,7 @@ func (client *GovernanceRulesClient) executeCreateRequest(ctx context.Context, s if scope == "" { return nil, errors.New("parameter scope cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if ruleID == "" { return nil, errors.New("parameter ruleID cannot be empty") } @@ -252,8 +241,8 @@ func (client *GovernanceRulesClient) executeCreateRequest(ctx context.Context, s 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 { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.ExecuteGovernanceRuleParams); err != nil { return nil, err } @@ -266,10 +255,7 @@ func (client *GovernanceRulesClient) executeCreateRequest(ctx context.Context, s // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-01-01-preview -// - scope - The scope of the Governance rules. Valid scopes are: management group (format: 'providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: -// 'subscriptions/{subscriptionId}'), or security connector (format: -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})' +// - scope - The fully qualified Azure Resource manager identifier of the resource. // - ruleID - The governance rule key - unique key for the standard governance rule (GUID) // - options - GovernanceRulesClientGetOptions contains the optional parameters for the GovernanceRulesClient.Get method. func (client *GovernanceRulesClient) Get(ctx context.Context, scope string, ruleID string, options *GovernanceRulesClientGetOptions) (GovernanceRulesClientGetResponse, error) { @@ -295,12 +281,12 @@ func (client *GovernanceRulesClient) Get(ctx context.Context, scope string, rule } // getCreateRequest creates the Get request. -func (client *GovernanceRulesClient) getCreateRequest(ctx context.Context, scope string, ruleID string, options *GovernanceRulesClientGetOptions) (*policy.Request, error) { +func (client *GovernanceRulesClient) getCreateRequest(ctx context.Context, scope string, ruleID string, _ *GovernanceRulesClientGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}" if scope == "" { return nil, errors.New("parameter scope cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if ruleID == "" { return nil, errors.New("parameter ruleID cannot be empty") } @@ -328,10 +314,7 @@ func (client *GovernanceRulesClient) getHandleResponse(resp *http.Response) (Gov // NewListPager - Get a list of all relevant governance rules over a scope // // Generated from API version 2022-01-01-preview -// - scope - The scope of the Governance rules. Valid scopes are: management group (format: 'providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: -// 'subscriptions/{subscriptionId}'), or security connector (format: -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})' +// - scope - The fully qualified Azure Resource manager identifier of the resource. // - options - GovernanceRulesClientListOptions contains the optional parameters for the GovernanceRulesClient.NewListPager // method. func (client *GovernanceRulesClient) NewListPager(scope string, options *GovernanceRulesClientListOptions) *runtime.Pager[GovernanceRulesClientListResponse] { @@ -358,12 +341,12 @@ func (client *GovernanceRulesClient) NewListPager(scope string, options *Governa } // listCreateRequest creates the List request. -func (client *GovernanceRulesClient) listCreateRequest(ctx context.Context, scope string, options *GovernanceRulesClientListOptions) (*policy.Request, error) { +func (client *GovernanceRulesClient) listCreateRequest(ctx context.Context, scope string, _ *GovernanceRulesClientListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/governanceRules" if scope == "" { return nil, errors.New("parameter scope cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err @@ -388,12 +371,9 @@ func (client *GovernanceRulesClient) listHandleResponse(resp *http.Response) (Go // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2022-01-01-preview -// - scope - The scope of the Governance rules. Valid scopes are: management group (format: 'providers/Microsoft.Management/managementGroups/{managementGroup}'), -// subscription (format: -// 'subscriptions/{subscriptionId}'), or security connector (format: -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})' -// - ruleID - The governance rule key - unique key for the standard governance rule (GUID) -// - operationID - The governance rule long running operation unique key +// - scope - The scope of the governance rule. +// - ruleID - The governance rule key. +// - operationID - The governance rule long running operation unique key. // - options - GovernanceRulesClientOperationResultsOptions contains the optional parameters for the GovernanceRulesClient.OperationResults // method. func (client *GovernanceRulesClient) OperationResults(ctx context.Context, scope string, ruleID string, operationID string, options *GovernanceRulesClientOperationResultsOptions) (GovernanceRulesClientOperationResultsResponse, error) { @@ -419,12 +399,12 @@ func (client *GovernanceRulesClient) OperationResults(ctx context.Context, scope } // operationResultsCreateRequest creates the OperationResults request. -func (client *GovernanceRulesClient) operationResultsCreateRequest(ctx context.Context, scope string, ruleID string, operationID string, options *GovernanceRulesClientOperationResultsOptions) (*policy.Request, error) { +func (client *GovernanceRulesClient) operationResultsCreateRequest(ctx context.Context, scope string, ruleID string, operationID string, _ *GovernanceRulesClientOperationResultsOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/governanceRules/{ruleId}/operationResults/{operationId}" if scope == "" { return nil, errors.New("parameter scope cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{scope}", url.PathEscape(scope)) + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if ruleID == "" { return nil, errors.New("parameter ruleID cannot be empty") } @@ -447,10 +427,10 @@ func (client *GovernanceRulesClient) operationResultsCreateRequest(ctx context.C // operationResultsHandleResponse handles the OperationResults response. func (client *GovernanceRulesClient) operationResultsHandleResponse(resp *http.Response) (GovernanceRulesClientOperationResultsResponse, error) { result := GovernanceRulesClientOperationResultsResponse{} - if val := resp.Header.Get("location"); val != "" { + if val := resp.Header.Get("Location"); val != "" { result.Location = &val } - if err := runtime.UnmarshalAsJSON(resp, &result.OperationResultAutoGenerated); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.OperationResult); err != nil { return GovernanceRulesClientOperationResultsResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/security/armsecurity/healthreports_client.go b/sdk/resourcemanager/security/armsecurity/healthreports_client.go index 20b6dde38139..81a64c8d8c44 100644 --- a/sdk/resourcemanager/security/armsecurity/healthreports_client.go +++ b/sdk/resourcemanager/security/armsecurity/healthreports_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,7 +24,7 @@ type HealthReportsClient struct { // NewHealthReportsClient creates a new instance of HealthReportsClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewHealthReportsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*HealthReportsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,8 +40,8 @@ func NewHealthReportsClient(credential azcore.TokenCredential, options *arm.Clie // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-05-01-preview -// - resourceID - The identifier of the resource. -// - healthReportName - The health report Key - Unique key for the health report type +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. +// - healthReportName - The health report key. // - options - HealthReportsClientGetOptions contains the optional parameters for the HealthReportsClient.Get method. func (client *HealthReportsClient) Get(ctx context.Context, resourceID string, healthReportName string, options *HealthReportsClientGetOptions) (HealthReportsClientGetResponse, error) { var err error @@ -67,8 +66,11 @@ func (client *HealthReportsClient) Get(ctx context.Context, resourceID string, h } // getCreateRequest creates the Get request. -func (client *HealthReportsClient) getCreateRequest(ctx context.Context, resourceID string, healthReportName string, options *HealthReportsClientGetOptions) (*policy.Request, error) { +func (client *HealthReportsClient) getCreateRequest(ctx context.Context, resourceID string, healthReportName string, _ *HealthReportsClientGetOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/healthReports/{healthReportName}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if healthReportName == "" { return nil, errors.New("parameter healthReportName cannot be empty") @@ -95,11 +97,10 @@ func (client *HealthReportsClient) getHandleResponse(resp *http.Response) (Healt } // NewListPager - Get a list of all health reports inside a scope. Valid scopes are: subscription (format: 'subscriptions/{subscriptionId}'), -// or security connector (format: -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})' +// or security connector (format: 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName})' // // Generated from API version 2023-05-01-preview -// - scope - The scope at which the operation is performed. +// - scope - The fully qualified Azure Resource manager identifier of the resource. // - options - HealthReportsClientListOptions contains the optional parameters for the HealthReportsClient.NewListPager method. func (client *HealthReportsClient) NewListPager(scope string, options *HealthReportsClientListOptions) *runtime.Pager[HealthReportsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[HealthReportsClientListResponse]{ @@ -125,8 +126,11 @@ func (client *HealthReportsClient) NewListPager(scope string, options *HealthRep } // listCreateRequest creates the List request. -func (client *HealthReportsClient) listCreateRequest(ctx context.Context, scope string, options *HealthReportsClientListOptions) (*policy.Request, error) { +func (client *HealthReportsClient) listCreateRequest(ctx context.Context, scope string, _ *HealthReportsClientListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/healthReports" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/sdk/resourcemanager/security/armsecurity/informationprotectionpolicies_client.go b/sdk/resourcemanager/security/armsecurity/informationprotectionpolicies_client.go index 8703a32b47ef..9cac877872af 100644 --- a/sdk/resourcemanager/security/armsecurity/informationprotectionpolicies_client.go +++ b/sdk/resourcemanager/security/armsecurity/informationprotectionpolicies_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,7 +24,7 @@ type InformationProtectionPoliciesClient struct { // NewInformationProtectionPoliciesClient creates a new instance of InformationProtectionPoliciesClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewInformationProtectionPoliciesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*InformationProtectionPoliciesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,8 +40,7 @@ func NewInformationProtectionPoliciesClient(credential azcore.TokenCredential, o // 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). +// - scope - The fully qualified Azure Resource manager identifier of the resource. // - informationProtectionPolicyName - Name of the information protection policy. // - informationProtectionPolicy - Information protection policy. // - options - InformationProtectionPoliciesClientCreateOrUpdateOptions contains the optional parameters for the InformationProtectionPoliciesClient.CreateOrUpdate @@ -70,8 +68,11 @@ func (client *InformationProtectionPoliciesClient) CreateOrUpdate(ctx context.Co } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *InformationProtectionPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, scope string, informationProtectionPolicyName InformationProtectionPolicyName, informationProtectionPolicy InformationProtectionPolicy, options *InformationProtectionPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *InformationProtectionPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, scope string, informationProtectionPolicyName InformationProtectionPolicyName, informationProtectionPolicy InformationProtectionPolicy, _ *InformationProtectionPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if informationProtectionPolicyName == "" { return nil, errors.New("parameter informationProtectionPolicyName cannot be empty") @@ -85,6 +86,7 @@ func (client *InformationProtectionPoliciesClient) createOrUpdateCreateRequest(c reqQP.Set("api-version", "2017-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, informationProtectionPolicy); err != nil { return nil, err } @@ -104,8 +106,7 @@ func (client *InformationProtectionPoliciesClient) createOrUpdateHandleResponse( // 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). +// - scope - The fully qualified Azure Resource manager identifier of the resource. // - informationProtectionPolicyName - Name of the information protection policy. // - options - InformationProtectionPoliciesClientGetOptions contains the optional parameters for the InformationProtectionPoliciesClient.Get // method. @@ -132,8 +133,11 @@ func (client *InformationProtectionPoliciesClient) Get(ctx context.Context, scop } // getCreateRequest creates the Get request. -func (client *InformationProtectionPoliciesClient) getCreateRequest(ctx context.Context, scope string, informationProtectionPolicyName InformationProtectionPolicyName, options *InformationProtectionPoliciesClientGetOptions) (*policy.Request, error) { +func (client *InformationProtectionPoliciesClient) getCreateRequest(ctx context.Context, scope string, informationProtectionPolicyName InformationProtectionPolicyName, _ *InformationProtectionPoliciesClientGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if informationProtectionPolicyName == "" { return nil, errors.New("parameter informationProtectionPolicyName cannot be empty") @@ -162,8 +166,7 @@ func (client *InformationProtectionPoliciesClient) getHandleResponse(resp *http. // NewListPager - Information protection policies of a specific management group. // // 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). +// - scope - The fully qualified Azure Resource manager identifier of the resource. // - options - InformationProtectionPoliciesClientListOptions contains the optional parameters for the InformationProtectionPoliciesClient.NewListPager // method. func (client *InformationProtectionPoliciesClient) NewListPager(scope string, options *InformationProtectionPoliciesClientListOptions) *runtime.Pager[InformationProtectionPoliciesClientListResponse] { @@ -190,8 +193,11 @@ func (client *InformationProtectionPoliciesClient) NewListPager(scope string, op } // listCreateRequest creates the List request. -func (client *InformationProtectionPoliciesClient) listCreateRequest(ctx context.Context, scope string, options *InformationProtectionPoliciesClientListOptions) (*policy.Request, error) { +func (client *InformationProtectionPoliciesClient) listCreateRequest(ctx context.Context, scope string, _ *InformationProtectionPoliciesClientListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/informationProtectionPolicies" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/sdk/resourcemanager/security/armsecurity/interfaces.go b/sdk/resourcemanager/security/armsecurity/interfaces.go index 2bc3c129fce0..d4e4555a1134 100644 --- a/sdk/resourcemanager/security/armsecurity/interfaces.go +++ b/sdk/resourcemanager/security/armsecurity/interfaces.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -33,14 +32,13 @@ type AllowlistCustomAlertRuleClassification interface { GetAllowlistCustomAlertRule() *AllowlistCustomAlertRule } -// AuthenticationDetailsPropertiesClassification provides polymorphic access to related types. -// Call the interface's GetAuthenticationDetailsProperties() method to access the common type. +// AuthenticationClassification provides polymorphic access to related types. +// Call the interface's GetAuthentication() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *AuthenticationDetailsProperties, *AwAssumeRoleAuthenticationDetailsProperties, *AwsCredsAuthenticationDetailsProperties, -// - *GcpCredentialsDetailsProperties -type AuthenticationDetailsPropertiesClassification interface { - // GetAuthenticationDetailsProperties returns the AuthenticationDetailsProperties content of the underlying type. - GetAuthenticationDetailsProperties() *AuthenticationDetailsProperties +// - *AccessTokenAuthentication, *Authentication +type AuthenticationClassification interface { + // GetAuthentication returns the Authentication content of the underlying type. + GetAuthentication() *Authentication } // AutomationActionClassification provides polymorphic access to related types. @@ -64,9 +62,11 @@ type AwsOrganizationalDataClassification interface { // 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, *CspmMonitorAzureDevOpsOffering, *CspmMonitorGcpOffering, *CspmMonitorGitLabOffering, -// - *CspmMonitorGithubOffering, *DefenderCspmAwsOffering, *DefenderCspmGcpOffering, *DefenderFoDatabasesAwsOffering, *DefenderForContainersAwsOffering, -// - *DefenderForContainersGcpOffering, *DefenderForDatabasesGcpOffering, *DefenderForServersAwsOffering, *DefenderForServersGcpOffering +// - *CloudOffering, *CspmMonitorAwsOffering, *CspmMonitorAzureDevOpsOffering, *CspmMonitorDockerHubOffering, *CspmMonitorGcpOffering, +// - *CspmMonitorGitLabOffering, *CspmMonitorGithubOffering, *CspmMonitorJFrogOffering, *DefenderCspmAwsOffering, *DefenderCspmDockerHubOffering, +// - *DefenderCspmGcpOffering, *DefenderCspmJFrogOffering, *DefenderFoDatabasesAwsOffering, *DefenderForContainersAwsOffering, +// - *DefenderForContainersDockerHubOffering, *DefenderForContainersGcpOffering, *DefenderForContainersJFrogOffering, *DefenderForDatabasesGcpOffering, +// - *DefenderForServersAwsOffering, *DefenderForServersGcpOffering type CloudOfferingClassification interface { // GetCloudOffering returns the CloudOffering content of the underlying type. GetCloudOffering() *CloudOffering @@ -90,8 +90,8 @@ type CustomAlertRuleClassification interface { // 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, -// - *GitlabScopeEnvironmentData +// - *AwsEnvironmentData, *AzureDevOpsScopeEnvironmentData, *DockerHubEnvironmentData, *EnvironmentData, *GcpProjectEnvironmentData, +// - *GithubScopeEnvironmentData, *GitlabScopeEnvironmentData, *JFrogEnvironmentData type EnvironmentDataClassification interface { // GetEnvironmentData returns the EnvironmentData content of the underlying type. GetEnvironmentData() *EnvironmentData diff --git a/sdk/resourcemanager/security/armsecurity/iotsecuritysolution_client.go b/sdk/resourcemanager/security/armsecurity/iotsecuritysolution_client.go index 88e1f0e92f80..6d8a23577cfe 100644 --- a/sdk/resourcemanager/security/armsecurity/iotsecuritysolution_client.go +++ b/sdk/resourcemanager/security/armsecurity/iotsecuritysolution_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type IotSecuritySolutionClient struct { } // NewIotSecuritySolutionClient creates a new instance of IotSecuritySolutionClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewIotSecuritySolutionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IotSecuritySolutionClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -44,7 +43,7 @@ func NewIotSecuritySolutionClient(subscriptionID string, credential azcore.Token // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - solutionName - The name of the IoT Security solution. // - iotSecuritySolutionData - The security solution data // - options - IotSecuritySolutionClientCreateOrUpdateOptions contains the optional parameters for the IotSecuritySolutionClient.CreateOrUpdate @@ -72,7 +71,7 @@ func (client *IotSecuritySolutionClient) CreateOrUpdate(ctx context.Context, res } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *IotSecuritySolutionClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, iotSecuritySolutionData IoTSecuritySolutionModel, options *IotSecuritySolutionClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *IotSecuritySolutionClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, iotSecuritySolutionData IoTSecuritySolutionModel, _ *IotSecuritySolutionClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -94,6 +93,7 @@ func (client *IotSecuritySolutionClient) createOrUpdateCreateRequest(ctx context reqQP.Set("api-version", "2019-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, iotSecuritySolutionData); err != nil { return nil, err } @@ -113,7 +113,7 @@ func (client *IotSecuritySolutionClient) createOrUpdateHandleResponse(resp *http // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - solutionName - The name of the IoT Security solution. // - options - IotSecuritySolutionClientDeleteOptions contains the optional parameters for the IotSecuritySolutionClient.Delete // method. @@ -139,7 +139,7 @@ func (client *IotSecuritySolutionClient) Delete(ctx context.Context, resourceGro } // deleteCreateRequest creates the Delete request. -func (client *IotSecuritySolutionClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, options *IotSecuritySolutionClientDeleteOptions) (*policy.Request, error) { +func (client *IotSecuritySolutionClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, _ *IotSecuritySolutionClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -160,7 +160,6 @@ func (client *IotSecuritySolutionClient) deleteCreateRequest(ctx context.Context reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-08-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -168,7 +167,7 @@ func (client *IotSecuritySolutionClient) deleteCreateRequest(ctx context.Context // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - solutionName - The name of the IoT Security solution. // - options - IotSecuritySolutionClientGetOptions contains the optional parameters for the IotSecuritySolutionClient.Get method. func (client *IotSecuritySolutionClient) Get(ctx context.Context, resourceGroupName string, solutionName string, options *IotSecuritySolutionClientGetOptions) (IotSecuritySolutionClientGetResponse, error) { @@ -194,7 +193,7 @@ func (client *IotSecuritySolutionClient) Get(ctx context.Context, resourceGroupN } // getCreateRequest creates the Get request. -func (client *IotSecuritySolutionClient) getCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, options *IotSecuritySolutionClientGetOptions) (*policy.Request, error) { +func (client *IotSecuritySolutionClient) getCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, _ *IotSecuritySolutionClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -231,7 +230,7 @@ func (client *IotSecuritySolutionClient) getHandleResponse(resp *http.Response) // NewListByResourceGroupPager - Use this method to get the list IoT Security solutions organized by resource group. // // Generated from API version 2019-08-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - IotSecuritySolutionClientListByResourceGroupOptions contains the optional parameters for the IotSecuritySolutionClient.NewListByResourceGroupPager // method. func (client *IotSecuritySolutionClient) NewListByResourceGroupPager(resourceGroupName string, options *IotSecuritySolutionClientListByResourceGroupOptions) *runtime.Pager[IotSecuritySolutionClientListByResourceGroupResponse] { @@ -354,7 +353,7 @@ func (client *IotSecuritySolutionClient) listBySubscriptionHandleResponse(resp * // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - solutionName - The name of the IoT Security solution. // - updateIotSecuritySolutionData - The security solution data // - options - IotSecuritySolutionClientUpdateOptions contains the optional parameters for the IotSecuritySolutionClient.Update @@ -382,7 +381,7 @@ func (client *IotSecuritySolutionClient) Update(ctx context.Context, resourceGro } // updateCreateRequest creates the Update request. -func (client *IotSecuritySolutionClient) updateCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, updateIotSecuritySolutionData UpdateIotSecuritySolutionData, options *IotSecuritySolutionClientUpdateOptions) (*policy.Request, error) { +func (client *IotSecuritySolutionClient) updateCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, updateIotSecuritySolutionData UpdateIotSecuritySolutionData, _ *IotSecuritySolutionClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -404,6 +403,7 @@ func (client *IotSecuritySolutionClient) updateCreateRequest(ctx context.Context reqQP.Set("api-version", "2019-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, updateIotSecuritySolutionData); err != nil { return nil, err } diff --git a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionanalytics_client.go b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionanalytics_client.go index a41a440ea4bc..a6b2a039c629 100644 --- a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionanalytics_client.go +++ b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionanalytics_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type IotSecuritySolutionAnalyticsClient struct { } // NewIotSecuritySolutionAnalyticsClient creates a new instance of IotSecuritySolutionAnalyticsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewIotSecuritySolutionAnalyticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IotSecuritySolutionAnalyticsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -44,7 +43,7 @@ func NewIotSecuritySolutionAnalyticsClient(subscriptionID string, credential azc // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - solutionName - The name of the IoT Security solution. // - options - IotSecuritySolutionAnalyticsClientGetOptions contains the optional parameters for the IotSecuritySolutionAnalyticsClient.Get // method. @@ -71,7 +70,7 @@ func (client *IotSecuritySolutionAnalyticsClient) Get(ctx context.Context, resou } // getCreateRequest creates the Get request. -func (client *IotSecuritySolutionAnalyticsClient) getCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, options *IotSecuritySolutionAnalyticsClientGetOptions) (*policy.Request, error) { +func (client *IotSecuritySolutionAnalyticsClient) getCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, _ *IotSecuritySolutionAnalyticsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -109,7 +108,7 @@ func (client *IotSecuritySolutionAnalyticsClient) getHandleResponse(resp *http.R // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - solutionName - The name of the IoT Security solution. // - options - IotSecuritySolutionAnalyticsClientListOptions contains the optional parameters for the IotSecuritySolutionAnalyticsClient.List // method. @@ -136,7 +135,7 @@ func (client *IotSecuritySolutionAnalyticsClient) List(ctx context.Context, reso } // listCreateRequest creates the List request. -func (client *IotSecuritySolutionAnalyticsClient) listCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, options *IotSecuritySolutionAnalyticsClientListOptions) (*policy.Request, error) { +func (client *IotSecuritySolutionAnalyticsClient) listCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, _ *IotSecuritySolutionAnalyticsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsaggregatedalert_client.go b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsaggregatedalert_client.go index 24e703833568..b5f69e074cff 100644 --- a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsaggregatedalert_client.go +++ b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsaggregatedalert_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -18,7 +17,8 @@ import ( "strings" ) -// IotSecuritySolutionsAnalyticsAggregatedAlertClient contains the methods for the IotSecuritySolutionsAnalyticsAggregatedAlert group. +// IotSecuritySolutionsAnalyticsAggregatedAlertClient contains the methods for the IotSecuritySolutionsAnalyticsAggregatedAlert +// group. // Don't use this type directly, use NewIotSecuritySolutionsAnalyticsAggregatedAlertClient() instead. type IotSecuritySolutionsAnalyticsAggregatedAlertClient struct { internal *arm.Client @@ -26,9 +26,9 @@ type IotSecuritySolutionsAnalyticsAggregatedAlertClient struct { } // NewIotSecuritySolutionsAnalyticsAggregatedAlertClient creates a new instance of IotSecuritySolutionsAnalyticsAggregatedAlertClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewIotSecuritySolutionsAnalyticsAggregatedAlertClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IotSecuritySolutionsAnalyticsAggregatedAlertClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -45,7 +45,7 @@ func NewIotSecuritySolutionsAnalyticsAggregatedAlertClient(subscriptionID string // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - solutionName - The name of the IoT Security solution. // - aggregatedAlertName - Identifier of the aggregated alert. // - options - IotSecuritySolutionsAnalyticsAggregatedAlertClientDismissOptions contains the optional parameters for the IotSecuritySolutionsAnalyticsAggregatedAlertClient.Dismiss @@ -72,7 +72,7 @@ func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) Dismiss(ctx co } // dismissCreateRequest creates the Dismiss request. -func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) dismissCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string, options *IotSecuritySolutionsAnalyticsAggregatedAlertClientDismissOptions) (*policy.Request, error) { +func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) dismissCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string, _ *IotSecuritySolutionsAnalyticsAggregatedAlertClientDismissOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}/dismiss" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -97,7 +97,6 @@ func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) dismissCreateR reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2019-08-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -106,7 +105,7 @@ func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) dismissCreateR // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - solutionName - The name of the IoT Security solution. // - aggregatedAlertName - Identifier of the aggregated alert. // - options - IotSecuritySolutionsAnalyticsAggregatedAlertClientGetOptions contains the optional parameters for the IotSecuritySolutionsAnalyticsAggregatedAlertClient.Get @@ -134,7 +133,7 @@ func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) Get(ctx contex } // getCreateRequest creates the Get request. -func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) getCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string, options *IotSecuritySolutionsAnalyticsAggregatedAlertClientGetOptions) (*policy.Request, error) { +func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) getCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, aggregatedAlertName string, _ *IotSecuritySolutionsAnalyticsAggregatedAlertClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedAlerts/{aggregatedAlertName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -175,7 +174,7 @@ func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) getHandleRespo // NewListPager - Use this method to get the aggregated alert list of yours IoT Security solution. // // Generated from API version 2019-08-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - solutionName - The name of the IoT Security solution. // - options - IotSecuritySolutionsAnalyticsAggregatedAlertClientListOptions contains the optional parameters for the IotSecuritySolutionsAnalyticsAggregatedAlertClient.NewListPager // method. diff --git a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsrecommendation_client.go b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsrecommendation_client.go index 1b95414154f7..156d38424de2 100644 --- a/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsrecommendation_client.go +++ b/sdk/resourcemanager/security/armsecurity/iotsecuritysolutionsanalyticsrecommendation_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -18,7 +17,8 @@ import ( "strings" ) -// IotSecuritySolutionsAnalyticsRecommendationClient contains the methods for the IotSecuritySolutionsAnalyticsRecommendation group. +// IotSecuritySolutionsAnalyticsRecommendationClient contains the methods for the IotSecuritySolutionsAnalyticsRecommendation +// group. // Don't use this type directly, use NewIotSecuritySolutionsAnalyticsRecommendationClient() instead. type IotSecuritySolutionsAnalyticsRecommendationClient struct { internal *arm.Client @@ -26,9 +26,9 @@ type IotSecuritySolutionsAnalyticsRecommendationClient struct { } // NewIotSecuritySolutionsAnalyticsRecommendationClient creates a new instance of IotSecuritySolutionsAnalyticsRecommendationClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewIotSecuritySolutionsAnalyticsRecommendationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*IotSecuritySolutionsAnalyticsRecommendationClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -46,7 +46,7 @@ func NewIotSecuritySolutionsAnalyticsRecommendationClient(subscriptionID string, // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - solutionName - The name of the IoT Security solution. // - aggregatedRecommendationName - Name of the recommendation aggregated for this query. // - options - IotSecuritySolutionsAnalyticsRecommendationClientGetOptions contains the optional parameters for the IotSecuritySolutionsAnalyticsRecommendationClient.Get @@ -74,7 +74,7 @@ func (client *IotSecuritySolutionsAnalyticsRecommendationClient) Get(ctx context } // getCreateRequest creates the Get request. -func (client *IotSecuritySolutionsAnalyticsRecommendationClient) getCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, aggregatedRecommendationName string, options *IotSecuritySolutionsAnalyticsRecommendationClientGetOptions) (*policy.Request, error) { +func (client *IotSecuritySolutionsAnalyticsRecommendationClient) getCreateRequest(ctx context.Context, resourceGroupName string, solutionName string, aggregatedRecommendationName string, _ *IotSecuritySolutionsAnalyticsRecommendationClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/iotSecuritySolutions/{solutionName}/analyticsModels/default/aggregatedRecommendations/{aggregatedRecommendationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -115,7 +115,7 @@ func (client *IotSecuritySolutionsAnalyticsRecommendationClient) getHandleRespon // NewListPager - Use this method to get the list of aggregated security analytics recommendations of yours IoT Security solution. // // Generated from API version 2019-08-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - solutionName - The name of the IoT Security solution. // - options - IotSecuritySolutionsAnalyticsRecommendationClientListOptions contains the optional parameters for the IotSecuritySolutionsAnalyticsRecommendationClient.NewListPager // method. diff --git a/sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client.go b/sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client.go index 50d4d70b4788..0d7b8ab8dfc8 100644 --- a/sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client.go +++ b/sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type JitNetworkAccessPoliciesClient struct { } // NewJitNetworkAccessPoliciesClient creates a new instance of JitNetworkAccessPoliciesClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewJitNetworkAccessPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*JitNetworkAccessPoliciesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -44,7 +43,7 @@ func NewJitNetworkAccessPoliciesClient(subscriptionID string, credential azcore. // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // - jitNetworkAccessPolicyName - Name of a Just-in-Time access configuration policy. // - options - JitNetworkAccessPoliciesClientCreateOrUpdateOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.CreateOrUpdate @@ -72,7 +71,7 @@ func (client *JitNetworkAccessPoliciesClient) CreateOrUpdate(ctx context.Context } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *JitNetworkAccessPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, body JitNetworkAccessPolicy, options *JitNetworkAccessPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *JitNetworkAccessPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, body JitNetworkAccessPolicy, _ *JitNetworkAccessPoliciesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -98,6 +97,7 @@ func (client *JitNetworkAccessPoliciesClient) createOrUpdateCreateRequest(ctx co reqQP.Set("api-version", "2020-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err } @@ -117,7 +117,7 @@ func (client *JitNetworkAccessPoliciesClient) createOrUpdateHandleResponse(resp // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // - jitNetworkAccessPolicyName - Name of a Just-in-Time access configuration policy. // - options - JitNetworkAccessPoliciesClientDeleteOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.Delete @@ -144,7 +144,7 @@ func (client *JitNetworkAccessPoliciesClient) Delete(ctx context.Context, resour } // deleteCreateRequest creates the Delete request. -func (client *JitNetworkAccessPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, options *JitNetworkAccessPoliciesClientDeleteOptions) (*policy.Request, error) { +func (client *JitNetworkAccessPoliciesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, _ *JitNetworkAccessPoliciesClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -169,7 +169,6 @@ func (client *JitNetworkAccessPoliciesClient) deleteCreateRequest(ctx context.Co reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-01-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -177,7 +176,7 @@ func (client *JitNetworkAccessPoliciesClient) deleteCreateRequest(ctx context.Co // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // - jitNetworkAccessPolicyName - Name of a Just-in-Time access configuration policy. // - options - JitNetworkAccessPoliciesClientGetOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.Get @@ -205,7 +204,7 @@ func (client *JitNetworkAccessPoliciesClient) Get(ctx context.Context, resourceG } // getCreateRequest creates the Get request. -func (client *JitNetworkAccessPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, options *JitNetworkAccessPoliciesClientGetOptions) (*policy.Request, error) { +func (client *JitNetworkAccessPoliciesClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, _ *JitNetworkAccessPoliciesClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -247,7 +246,7 @@ func (client *JitNetworkAccessPoliciesClient) getHandleResponse(resp *http.Respo // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // - jitNetworkAccessPolicyName - Name of a Just-in-Time access configuration policy. // - options - JitNetworkAccessPoliciesClientInitiateOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.Initiate @@ -275,7 +274,7 @@ func (client *JitNetworkAccessPoliciesClient) Initiate(ctx context.Context, reso } // initiateCreateRequest creates the Initiate request. -func (client *JitNetworkAccessPoliciesClient) initiateCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, body JitNetworkAccessPolicyInitiateRequest, options *JitNetworkAccessPoliciesClientInitiateOptions) (*policy.Request, error) { +func (client *JitNetworkAccessPoliciesClient) initiateCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, jitNetworkAccessPolicyName string, body JitNetworkAccessPolicyInitiateRequest, _ *JitNetworkAccessPoliciesClientInitiateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies/{jitNetworkAccessPolicyName}/{jitNetworkAccessPolicyInitiateType}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -302,6 +301,7 @@ func (client *JitNetworkAccessPoliciesClient) initiateCreateRequest(ctx context. reqQP.Set("api-version", "2020-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, body); err != nil { return nil, err } @@ -346,7 +346,7 @@ func (client *JitNetworkAccessPoliciesClient) NewListPager(options *JitNetworkAc } // listCreateRequest creates the List request. -func (client *JitNetworkAccessPoliciesClient) listCreateRequest(ctx context.Context, options *JitNetworkAccessPoliciesClientListOptions) (*policy.Request, error) { +func (client *JitNetworkAccessPoliciesClient) listCreateRequest(ctx context.Context, _ *JitNetworkAccessPoliciesClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/jitNetworkAccessPolicies" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -402,7 +402,7 @@ func (client *JitNetworkAccessPoliciesClient) NewListByRegionPager(ascLocation s } // listByRegionCreateRequest creates the ListByRegion request. -func (client *JitNetworkAccessPoliciesClient) listByRegionCreateRequest(ctx context.Context, ascLocation string, options *JitNetworkAccessPoliciesClientListByRegionOptions) (*policy.Request, error) { +func (client *JitNetworkAccessPoliciesClient) listByRegionCreateRequest(ctx context.Context, ascLocation string, _ *JitNetworkAccessPoliciesClientListByRegionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -436,7 +436,7 @@ func (client *JitNetworkAccessPoliciesClient) listByRegionHandleResponse(resp *h // location // // Generated from API version 2020-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - options - JitNetworkAccessPoliciesClientListByResourceGroupOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.NewListByResourceGroupPager // method. func (client *JitNetworkAccessPoliciesClient) NewListByResourceGroupPager(resourceGroupName string, options *JitNetworkAccessPoliciesClientListByResourceGroupOptions) *runtime.Pager[JitNetworkAccessPoliciesClientListByResourceGroupResponse] { @@ -463,7 +463,7 @@ func (client *JitNetworkAccessPoliciesClient) NewListByResourceGroupPager(resour } // listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *JitNetworkAccessPoliciesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *JitNetworkAccessPoliciesClientListByResourceGroupOptions) (*policy.Request, error) { +func (client *JitNetworkAccessPoliciesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, _ *JitNetworkAccessPoliciesClientListByResourceGroupOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/jitNetworkAccessPolicies" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -497,7 +497,7 @@ func (client *JitNetworkAccessPoliciesClient) listByResourceGroupHandleResponse( // location // // Generated from API version 2020-01-01 -// - resourceGroupName - The name of the resource group within the user's subscription. The name is case insensitive. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // - options - JitNetworkAccessPoliciesClientListByResourceGroupAndRegionOptions contains the optional parameters for the JitNetworkAccessPoliciesClient.NewListByResourceGroupAndRegionPager // method. @@ -525,7 +525,7 @@ func (client *JitNetworkAccessPoliciesClient) NewListByResourceGroupAndRegionPag } // listByResourceGroupAndRegionCreateRequest creates the ListByResourceGroupAndRegion request. -func (client *JitNetworkAccessPoliciesClient) listByResourceGroupAndRegionCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, options *JitNetworkAccessPoliciesClientListByResourceGroupAndRegionOptions) (*policy.Request, error) { +func (client *JitNetworkAccessPoliciesClient) listByResourceGroupAndRegionCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, _ *JitNetworkAccessPoliciesClientListByResourceGroupAndRegionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/jitNetworkAccessPolicies" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/locations_client.go b/sdk/resourcemanager/security/armsecurity/locations_client.go index a726df2eae73..191237a28c28 100644 --- a/sdk/resourcemanager/security/armsecurity/locations_client.go +++ b/sdk/resourcemanager/security/armsecurity/locations_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type LocationsClient struct { } // NewLocationsClient creates a new instance of LocationsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*LocationsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -69,7 +68,7 @@ func (client *LocationsClient) Get(ctx context.Context, ascLocation string, opti } // getCreateRequest creates the Get request. -func (client *LocationsClient) getCreateRequest(ctx context.Context, ascLocation string, options *LocationsClientGetOptions) (*policy.Request, error) { +func (client *LocationsClient) getCreateRequest(ctx context.Context, ascLocation string, _ *LocationsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -100,8 +99,8 @@ 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. +// 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. // // Generated from API version 2015-06-01-preview // - options - LocationsClientListOptions contains the optional parameters for the LocationsClient.NewListPager method. @@ -129,7 +128,7 @@ func (client *LocationsClient) NewListPager(options *LocationsClientListOptions) } // listCreateRequest creates the List request. -func (client *LocationsClient) listCreateRequest(ctx context.Context, options *LocationsClientListOptions) (*policy.Request, error) { +func (client *LocationsClient) listCreateRequest(ctx context.Context, _ *LocationsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/mdeonboardings_client.go b/sdk/resourcemanager/security/armsecurity/mdeonboardings_client.go index 57854152b360..92d5ff53566f 100644 --- a/sdk/resourcemanager/security/armsecurity/mdeonboardings_client.go +++ b/sdk/resourcemanager/security/armsecurity/mdeonboardings_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type MdeOnboardingsClient struct { } // NewMdeOnboardingsClient creates a new instance of MdeOnboardingsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewMdeOnboardingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*MdeOnboardingsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -68,7 +67,7 @@ func (client *MdeOnboardingsClient) Get(ctx context.Context, options *MdeOnboard } // getCreateRequest creates the Get request. -func (client *MdeOnboardingsClient) getCreateRequest(ctx context.Context, options *MdeOnboardingsClientGetOptions) (*policy.Request, error) { +func (client *MdeOnboardingsClient) getCreateRequest(ctx context.Context, _ *MdeOnboardingsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings/default" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -122,7 +121,7 @@ func (client *MdeOnboardingsClient) List(ctx context.Context, options *MdeOnboar } // listCreateRequest creates the List request. -func (client *MdeOnboardingsClient) listCreateRequest(ctx context.Context, options *MdeOnboardingsClientListOptions) (*policy.Request, error) { +func (client *MdeOnboardingsClient) listCreateRequest(ctx context.Context, _ *MdeOnboardingsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/models.go b/sdk/resourcemanager/security/armsecurity/models.go index 35c843d7e5f9..30b5b9c8016e 100644 --- a/sdk/resourcemanager/security/armsecurity/models.go +++ b/sdk/resourcemanager/security/armsecurity/models.go @@ -1,53 +1,50 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity import "time" -// AADConnectivityStateAutoGenerated - Describes an Azure resource with kind -type AADConnectivityStateAutoGenerated struct { - // The connectivity state of the external AAD solution - ConnectivityState *AADConnectivityState -} - // AADExternalSecuritySolution - Represents an AAD identity protection solution which sends logs to an OMS workspace. type AADExternalSecuritySolution struct { - // REQUIRED; The kind of the external solution + // REQUIRED Kind *ExternalSecuritySolutionKind // The external security solution properties for AAD solutions Properties *AADSolutionProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; Location where the resource is stored Location *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // GetExternalSecuritySolution implements the ExternalSecuritySolutionClassification interface for type AADExternalSecuritySolution. func (a *AADExternalSecuritySolution) GetExternalSecuritySolution() *ExternalSecuritySolution { return &ExternalSecuritySolution{ - ID: a.ID, - Kind: a.Kind, - Location: a.Location, - Name: a.Name, - Type: a.Type, + ID: a.ID, + Kind: a.Kind, + Location: a.Location, + Name: a.Name, + Properties: a.Properties, + SystemData: a.SystemData, + Type: a.Type, } } // AADSolutionProperties - The external security solution properties for AAD solutions type AADSolutionProperties struct { - // OPTIONAL; Contains additional key/value pairs not defined in the schema. AdditionalProperties map[string]any // The connectivity state of the external AAD solution @@ -64,13 +61,16 @@ type APICollection struct { // Describes the properties of an API collection. Properties *APICollectionProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -117,6 +117,26 @@ type APICollectionProperties struct { SensitivityLabel *string } +// AccessTokenAuthentication - The environment authentication details +type AccessTokenAuthentication struct { + // CONSTANT; The authentication type + // Field has constant value AuthenticationTypeAccessToken, any specified value is ignored. + AuthenticationType *AuthenticationType + + // The access token that will be used while authenticating with the onboarded environment + AccessToken *string + + // The user name that will be used while authenticating with the onboarded environment + Username *string +} + +// GetAuthentication implements the AuthenticationClassification interface for type AccessTokenAuthentication. +func (a *AccessTokenAuthentication) GetAuthentication() *Authentication { + return &Authentication{ + AuthenticationType: a.AuthenticationType, + } +} + // ActionableRemediation - Configuration payload for PR Annotations. type ActionableRemediation struct { // Repository branch configuration for PR Annotations. @@ -126,12 +146,14 @@ type ActionableRemediation struct { CategoryConfigurations []*CategoryConfiguration // Update Settings. - // Enabled - Resource should inherit configurations from parent. Disabled - Resource should not inherit configurations from - // parent. + // Enabled - Resource should inherit configurations from parent. + // Disabled - Resource should not inherit configurations from parent. InheritFromParentState *InheritFromParentState - // ActionableRemediation Setting. None - the setting was never set. Enabled - ActionableRemediation is enabled. Disabled - - // ActionableRemediation is disabled. + // ActionableRemediation Setting. + // None - the setting was never set. + // Enabled - ActionableRemediation is enabled. + // Disabled - ActionableRemediation is disabled. State *ActionableRemediationState } @@ -146,7 +168,8 @@ type ActiveConnectionsNotInAllowedRange struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; The type of the custom alert rule. + // Field has constant value "ActiveConnectionsNotInAllowedRange", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -194,107 +217,6 @@ func (a *ActiveConnectionsNotInAllowedRange) GetTimeWindowCustomAlertRule() *Tim } } -type AdaptiveApplicationControlGroup struct { - // REQUIRED; Represents a machines group and set of rules to be allowed running on a machine - Properties *AdaptiveApplicationControlGroupData - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Location where the resource is stored - Location *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// AdaptiveApplicationControlGroupData - Represents a machines group and set of rules to be allowed running on a machine -type AdaptiveApplicationControlGroupData struct { - // The application control policy enforcement/protection mode of the machine group - EnforcementMode *EnforcementMode - PathRecommendations []*PathRecommendation - - // The protection mode of the collection/file types. Exe/Msi/Script are used for Windows, Executable is used for Linux. - ProtectionMode *ProtectionMode - VMRecommendations []*VMRecommendation - - // READ-ONLY; The configuration status of the machines group or machine or rule - ConfigurationStatus *ConfigurationStatus - - // READ-ONLY - Issues []*AdaptiveApplicationControlIssueSummary - - // READ-ONLY; The initial recommendation status of the machine group or machine - RecommendationStatus *RecommendationStatus - - // READ-ONLY; The source type of the machine group - SourceSystem *SourceSystem -} - -// 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 -} - -// AdaptiveApplicationControlIssueSummary - Represents a summary of the alerts of the machine group -type AdaptiveApplicationControlIssueSummary struct { - // An alert that machines within a group can have - Issue *AdaptiveApplicationControlIssue - - // The number of machines in the group that have this alert - NumberOfVMs *float32 -} - -// AdaptiveNetworkHardening - The resource whose properties describes the Adaptive Network Hardening settings for some Azure -// resource -type AdaptiveNetworkHardening struct { - // Properties of the Adaptive Network Hardening resource - Properties *AdaptiveNetworkHardeningProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -type AdaptiveNetworkHardeningEnforceRequest struct { - // REQUIRED; The Azure resource IDs of the effective network security groups that will be updated with the created security - // rules from the Adaptive Network Hardening rules - NetworkSecurityGroups []*string - - // REQUIRED; The rules to enforce - Rules []*Rule -} - -// AdaptiveNetworkHardeningProperties - Adaptive Network Hardening resource properties -type AdaptiveNetworkHardeningProperties struct { - // The Network Security Groups effective on the network interfaces of the protected resource - EffectiveNetworkSecurityGroups []*EffectiveNetworkSecurityGroups - - // The security rules which are recommended to be effective on the VM - Rules []*Rule - - // The UTC time on which the rules were calculated - RulesCalculationTime *time.Time -} - -// AdaptiveNetworkHardeningsList - Response for ListAdaptiveNetworkHardenings API service call -type AdaptiveNetworkHardeningsList struct { - // The URL to get the next set of results - NextLink *string - - // A list of Adaptive Network Hardenings resources - Value []*AdaptiveNetworkHardening -} - // AdditionalData - Details of the sub-assessment type AdditionalData struct { // REQUIRED; Sub-assessment resource type @@ -327,34 +249,58 @@ type AdvancedThreatProtectionSetting struct { // The Advanced Threat Protection settings. Properties *AdvancedThreatProtectionProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } +// AgentlessConfiguration - Details about Agentless configuration. +type AgentlessConfiguration struct { + // AutoDiscovery states. + AgentlessAutoDiscovery *AutoDiscovery + + // Agentless Enablement states. + AgentlessEnabled *AgentlessEnablement + + // Gets or sets the inventory list for inclusion or exclusion from Agentless. + // Will be ignored if agentless auto-discovery is enabled. + InventoryList []*InventoryList + + // Types for inventory list. + InventoryListType *InventoryListKind + + // Gets or sets the scanners for the connector. + Scanners []*string +} + // Alert - Security alert type Alert struct { // describes security alert properties. Properties *AlertProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // AlertEntity - Changing set of properties depending on the entity type. type AlertEntity struct { - // OPTIONAL; Contains additional key/value pairs not defined in the schema. AdditionalProperties map[string]any // READ-ONLY; Type of entity @@ -363,11 +309,11 @@ type AlertEntity struct { // AlertList - List of security alerts type AlertList struct { - // describes security alert properties. - Value []*Alert - - // READ-ONLY; The URI to fetch the next page. + // The link to the next page of items NextLink *string + + // The Alert items on this page + Value []*Alert } // AlertProperties - describes security alert properties. @@ -420,8 +366,7 @@ type AlertProperties struct { ProductComponentName *string // READ-ONLY; The name of the product which published this alert (Microsoft Sentinel, Microsoft Defender for Identity, Microsoft - // Defender for Endpoint, Microsoft Defender for Office, Microsoft Defender for Cloud - // Apps, and so on). + // Defender for Endpoint, Microsoft Defender for Office, Microsoft Defender for Cloud Apps, and so on). ProductName *string // READ-ONLY; Manual action items to take to remediate the alert. @@ -461,7 +406,6 @@ type AlertProperties struct { // 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]any // READ-ONLY; Type of the supportingEvidence @@ -470,10 +414,9 @@ type AlertPropertiesSupportingEvidence struct { // AlertSimulatorBundlesRequestProperties - Simulate alerts according to this bundles. type AlertSimulatorBundlesRequestProperties struct { - // REQUIRED; The kind of alert simulation. - Kind *Kind - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. + // CONSTANT; The kind of alert simulation. + // Field has constant value KindBundles, any specified value is ignored. + Kind *Kind AdditionalProperties map[string]any // Bundles list. @@ -497,9 +440,7 @@ type AlertSimulatorRequestBody struct { // AlertSimulatorRequestProperties - Describes properties of an alert simulation request type AlertSimulatorRequestProperties struct { // REQUIRED; The kind of alert simulation. - Kind *Kind - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. + Kind *Kind AdditionalProperties map[string]any } @@ -516,29 +457,35 @@ type AlertSyncSettingProperties struct { // AlertSyncSettings - Represents an alert sync setting type AlertSyncSettings struct { - // REQUIRED; the kind of the settings string + // CONSTANT; the kind of the settings string + // Field has constant value SettingKindAlertSyncSettings, any specified value is ignored. Kind *SettingKind // Alert sync setting data Properties *AlertSyncSettingProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // GetSetting implements the SettingClassification interface for type AlertSyncSettings. func (a *AlertSyncSettings) GetSetting() *Setting { return &Setting{ - ID: a.ID, - Kind: a.Kind, - Name: a.Name, - Type: a.Type, + ID: a.ID, + Kind: a.Kind, + Name: a.Name, + Properties: a.Properties, + SystemData: a.SystemData, + Type: a.Type, } } @@ -547,13 +494,16 @@ type AlertsSuppressionRule struct { // describes AlertsSuppressionRule properties Properties *AlertsSuppressionRuleProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -583,10 +533,10 @@ type AlertsSuppressionRuleProperties struct { // AlertsSuppressionRulesList - Suppression rules list for subscription. type AlertsSuppressionRulesList struct { - // REQUIRED + // REQUIRED; The AlertsSuppressionRule items on this page Value []*AlertsSuppressionRule - // READ-ONLY; URI to fetch the next page. + // The link to the next page of items NextLink *string } @@ -601,19 +551,22 @@ type AllowedConnectionsList struct { // AllowedConnectionsResource - The resource whose properties describes the allowed traffic between Azure resources type AllowedConnectionsResource struct { - // READ-ONLY; Resource Id - ID *string - // READ-ONLY; Location where the resource is stored Location *string - // READ-ONLY; Resource name + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource Name *string // READ-ONLY; Describes the allowed traffic between Azure resources Properties *AllowedConnectionsResourceProperties - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -634,7 +587,7 @@ type AllowlistCustomAlertRule struct { // REQUIRED; Status of the custom alert. IsEnabled *bool - // REQUIRED; The type of the custom alert rule. + // CONSTANT; Field has constant value "AllowlistCustomAlertRule", any specified value is ignored. RuleType *string // READ-ONLY; The description of the custom alert. @@ -682,7 +635,8 @@ type AmqpC2DMessagesNotInAllowedRange struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; The type of the custom alert rule. + // Field has constant value "AmqpC2DMessagesNotInAllowedRange", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -742,7 +696,8 @@ type AmqpC2DRejectedMessagesNotInAllowedRange struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; The type of the custom alert rule. + // Field has constant value "AmqpC2DRejectedMessagesNotInAllowedRange", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -801,7 +756,8 @@ type AmqpD2CMessagesNotInAllowedRange struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; The type of the custom alert rule. + // Field has constant value "AmqpD2CMessagesNotInAllowedRange", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -854,26 +810,17 @@ type Application struct { // Properties of a security application Properties *ApplicationProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type - Type *string -} - -// 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 - - // The application Condition's Property, e.g. ID, see examples - Property *string + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData - // The application Condition's Value like IDs that contain some string, see examples - Value *string + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } // ApplicationProperties - Describes properties of an application @@ -900,43 +847,73 @@ type ApplicationsList struct { Value []*Application } -// ArcAutoProvisioning - The ARC autoprovisioning configuration -type ArcAutoProvisioning struct { - // Configuration for servers Arc auto provisioning for a given environment - Configuration *ArcAutoProvisioningConfiguration +// ArcAutoProvisioningConfiguration - Configuration for servers Arc auto provisioning for a given environment +type ArcAutoProvisioningConfiguration struct { + // Optional Arc private link scope resource id to link the Arc agent + PrivateLinkScope *string - // Is arc auto provisioning enabled - Enabled *bool + // Optional HTTP proxy endpoint to use for the Arc agent + Proxy *string } -// ArcAutoProvisioningAws - The ARC autoprovisioning configuration for an AWS environment -type ArcAutoProvisioningAws struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string +// ArmPrivateEndpointConnection - The private endpoint connection resource +type ArmPrivateEndpointConnection struct { + // The private endpoint connection properties + Properties *PrivateEndpointConnectionProperties - // Configuration for servers Arc auto provisioning for a given environment - Configuration *ArcAutoProvisioningConfiguration + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string - // Is arc auto provisioning enabled - Enabled *bool + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// ArcAutoProvisioningConfiguration - Configuration for servers Arc auto provisioning for a given environment -type ArcAutoProvisioningConfiguration struct { - // Optional Arc private link scope resource id to link the Arc agent - PrivateLinkScope *string +// ArmSecurityStandard - Security Standard on a resource +type ArmSecurityStandard struct { + // Properties of a security standard + Properties *ArmSecurityStandardProperties - // Optional HTTP proxy endpoint to use for the Arc agent - Proxy *string + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string } -// ArcAutoProvisioningGcp - The ARC autoprovisioning configuration for an GCP environment -type ArcAutoProvisioningGcp struct { - // Configuration for servers Arc auto provisioning for a given environment - Configuration *ArcAutoProvisioningConfiguration +// ArmSecurityStandardProperties - Describes properties of a standard. +type ArmSecurityStandardProperties struct { + // List of assessment keys to apply to standard scope. + Assessments []*PartialAssessmentProperties - // Is arc auto provisioning enabled - Enabled *bool + // List of all standard supported clouds. + CloudProviders []*StandardSupportedCloud + + // Description of the standard + Description *string + + // Display name of the standard, equivalent to the standardId + DisplayName *string + + // The security standard metadata. + Metadata *StandardMetadata + + // The policy set definition id associated with the standard. + PolicySetDefinitionID *string + + // READ-ONLY; Standard type (Custom or Default or Compliance only currently) + StandardType *StandardType } // AscLocation - The ASC location of the subscription is in the "name" field @@ -944,13 +921,16 @@ type AscLocation struct { // An empty set of properties Properties any - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -959,7 +939,7 @@ type AscLocationList struct { // READ-ONLY; The URI to fetch the next page. NextLink *string - // READ-ONLY + // READ-ONLY; List of locations Value []*AscLocation } @@ -968,13 +948,16 @@ type Assessment struct { // Describes properties of an assessment. Properties *AssessmentProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -986,28 +969,13 @@ type AssessmentLinks struct { // AssessmentList - Page of a security assessments list type AssessmentList struct { - // READ-ONLY; The URI to fetch the next page. + // The URI to fetch the next page. NextLink *string // READ-ONLY; Collection of security assessments in this page Value []*AssessmentResponse } -// AssessmentMetadata - Security assessment metadata -type AssessmentMetadata struct { - // Describes properties of an assessment metadata. - Properties *AssessmentMetadataProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - // AssessmentMetadataPartnerData - Describes the partner that created the assessment type AssessmentMetadataPartnerData struct { // REQUIRED; Name of the company of the partner @@ -1107,19 +1075,22 @@ type AssessmentMetadataResponse struct { // Describes properties of an assessment metadata response. Properties *AssessmentMetadataPropertiesResponse - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // AssessmentMetadataResponseList - List of security assessment metadata type AssessmentMetadataResponseList struct { - // READ-ONLY; The URI to fetch the next page. + // The URI to fetch the next page. NextLink *string // READ-ONLY @@ -1152,6 +1123,9 @@ type AssessmentProperties struct { // Data regarding 3rd party partner integration PartnersData *AssessmentPartnerData + // External model of risk result + Risk *AssessmentPropertiesBaseRisk + // READ-ONLY; User friendly display name of the assessment DisplayName *string @@ -1159,25 +1133,48 @@ type AssessmentProperties struct { Links *AssessmentLinks } -// AssessmentPropertiesBase - Describes properties of an assessment. -type AssessmentPropertiesBase struct { - // REQUIRED; Details of the resource that was assessed - ResourceDetails ResourceDetailsClassification +// AssessmentPropertiesBaseRisk - External model of risk result +type AssessmentPropertiesBaseRisk struct { + // The attack paths references of the risk + AttackPathsReferences []*string - // Additional data regarding the assessment - AdditionalData map[string]*string + // Indicates if the risk is contextual or static + IsContextualRisk *bool - // Describes properties of an assessment metadata. - Metadata *AssessmentMetadataProperties + // The risk level + Level *RiskLevel + Paths []*AssessmentPropertiesBaseRiskPathsItem - // Data regarding 3rd party partner integration - PartnersData *AssessmentPartnerData + // The factors of the risk adding base factor + RiskFactors []*string +} - // READ-ONLY; User friendly display name of the assessment - DisplayName *string +type AssessmentPropertiesBaseRiskPathsItem struct { + // Connections between nodes + Edges []*AssessmentPropertiesBaseRiskPathsItemEdgeItem - // READ-ONLY; Links relevant to the assessment - Links *AssessmentLinks + // Unique identifier for the path + ID *string + Nodes []*AssessmentPropertiesBaseRiskPathsItemNodesItem +} + +type AssessmentPropertiesBaseRiskPathsItemEdgeItem struct { + // REQUIRED; Edge identifier + ID *string + + // REQUIRED; Source node identifier + SourceID *string + + // REQUIRED; Target node identifier + TargetID *string +} + +type AssessmentPropertiesBaseRiskPathsItemNodesItem struct { + // Node identifier + ID *string + + // Properties associated with the node + NodePropertiesLabel []*string } // AssessmentPropertiesResponse - Describes properties of an assessment. @@ -1197,6 +1194,9 @@ type AssessmentPropertiesResponse struct { // Data regarding 3rd party partner integration PartnersData *AssessmentPartnerData + // External model of risk result + Risk *AssessmentPropertiesBaseRisk + // READ-ONLY; User friendly display name of the assessment DisplayName *string @@ -1209,13 +1209,16 @@ type AssessmentResponse struct { // Describes properties of an assessment. Properties *AssessmentPropertiesResponse - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -1249,41 +1252,138 @@ type AssessmentStatusResponse struct { StatusChangeDate *time.Time } +// AssignedAssessmentItem - Describe the properties of a security assessment object reference (by key) +type AssignedAssessmentItem struct { + // Unique key to a security assessment object + AssessmentKey *string +} + +// AssignedComponentItem - describe the properties of a security assessment object reference (by key) +type AssignedComponentItem struct { + // unique key to a security assessment object + Key *string +} + +// AssignedStandardItem - Describe the properties of a of a standard assignments object reference +type AssignedStandardItem struct { + // Full resourceId of the Microsoft.Security/standard object + ID *string +} + +// Assignment - Security Assignment on a resource group over a given scope +type Assignment struct { + // Entity tag is used for comparing two or more entities from the same requested resource. + Etag *string + + // Kind of the resource + Kind *string + + // The geo-location where the resource lives + Location *string + + // Properties of a security assignment + Properties *AssignmentProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// AssignmentList - Page of a standard assignment list +type AssignmentList struct { + // READ-ONLY; The URI to fetch the next page + NextLink *string + + // READ-ONLY; Collection of standardAssignments in this page + Value []*Assignment +} + +// AssignmentProperties - Describes the properties of a standardAssignment +type AssignmentProperties struct { + // Additional data about the assignment + AdditionalData *AssignmentPropertiesAdditionalData + + // Component item with key as applied to this standard assignment over the given scope + AssignedComponent *AssignedComponentItem + + // Standard item with key as applied to this standard assignment over the given scope + AssignedStandard *AssignedStandardItem + + // description of the standardAssignment + Description *string + + // display name of the standardAssignment + DisplayName *string + + // expected effect of this assignment (Disable/Exempt/etc) + Effect *string + + // Expiration date of this assignment as a full ISO date + ExpiresOn *time.Time + + // The assignment metadata. Metadata is an open ended object and is typically a collection of key value pairs. + Metadata any + + // Scope to which the standardAssignment applies - can be a subscription path or a resource group under that subscription + Scope *string +} + +// AssignmentPropertiesAdditionalData - Additional data about the assignment +type AssignmentPropertiesAdditionalData struct { + // Exemption category of this assignment + ExemptionCategory *string +} + // AtaExternalSecuritySolution - Represents an ATA security solution which sends logs to an OMS workspace type AtaExternalSecuritySolution struct { - // REQUIRED; The kind of the external solution + // REQUIRED Kind *ExternalSecuritySolutionKind // The external security solution properties for ATA solutions Properties *AtaSolutionProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; Location where the resource is stored Location *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // GetExternalSecuritySolution implements the ExternalSecuritySolutionClassification interface for type AtaExternalSecuritySolution. func (a *AtaExternalSecuritySolution) GetExternalSecuritySolution() *ExternalSecuritySolution { return &ExternalSecuritySolution{ - ID: a.ID, - Kind: a.Kind, - Location: a.Location, - Name: a.Name, - Type: a.Type, + ID: a.ID, + Kind: a.Kind, + Location: a.Location, + Name: a.Name, + Properties: a.Properties, + SystemData: a.SystemData, + Type: a.Type, } } // AtaSolutionProperties - The external security solution properties for ATA solutions type AtaSolutionProperties struct { - // OPTIONAL; Contains additional key/value pairs not defined in the schema. AdditionalProperties map[string]any DeviceType *string DeviceVendor *string @@ -1293,24 +1393,24 @@ type AtaSolutionProperties struct { Workspace *ConnectedWorkspace } -// AuthenticationDetailsProperties - Settings for cloud authentication management -type AuthenticationDetailsProperties struct { - // REQUIRED; Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use - // account organization credentials. - AuthenticationType *AuthenticationType - - // READ-ONLY; State of the multi-cloud connector - AuthenticationProvisioningState *AuthenticationProvisioningState +// AttestationEvidence - Describe the properties of a assignment attestation +type AttestationEvidence struct { + // The description of the evidence + Description *string - // READ-ONLY; The permissions detected in the cloud account. - GrantedPermissions []*PermissionProperty + // The source url of the evidence + SourceURL *string } -// GetAuthenticationDetailsProperties implements the AuthenticationDetailsPropertiesClassification interface for type AuthenticationDetailsProperties. -func (a *AuthenticationDetailsProperties) GetAuthenticationDetailsProperties() *AuthenticationDetailsProperties { - return a +// Authentication - The environment authentication details +type Authentication struct { + // REQUIRED; The authentication type + AuthenticationType *AuthenticationType } +// GetAuthentication implements the AuthenticationClassification interface for type Authentication. +func (a *Authentication) GetAuthentication() *Authentication { return a } + // Authorization payload. type Authorization struct { // Gets or sets one-time OAuth code to exchange for refresh and access tokens. @@ -1323,13 +1423,16 @@ type AutoProvisioningSetting struct { // Auto provisioning setting data Properties *AutoProvisioningSettingProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -1356,22 +1459,25 @@ type Automation struct { // Kind of the resource Kind *string - // Location where the resource is stored + // The geo-location where the resource lives Location *string // Security automation data Properties *AutomationProperties - // A list of key value pairs that describe the resource. + // Resource tags. Tags map[string]*string - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -1387,7 +1493,8 @@ func (a *AutomationAction) GetAutomationAction() *AutomationAction { return a } // AutomationActionEventHub - The target Event Hub to which event data will be exported. To learn more about Microsoft Defender // for Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore type AutomationActionEventHub struct { - // REQUIRED; The type of the action that will be triggered by the Automation + // CONSTANT; The type of the action that will be triggered by the Automation + // Field has constant value ActionTypeEventHub, any specified value is ignored. ActionType *ActionType // The target Event Hub connection string (it will not be included in any response). @@ -1413,7 +1520,8 @@ func (a *AutomationActionEventHub) GetAutomationAction() *AutomationAction { // AutomationActionLogicApp - The logic app action that should be triggered. To learn more about Microsoft Defender for Cloud's // Workflow Automation capabilities, visit https://aka.ms/ASCWorkflowAutomationLearnMore type AutomationActionLogicApp struct { - // REQUIRED; The type of the action that will be triggered by the Automation + // CONSTANT; The type of the action that will be triggered by the Automation + // Field has constant value ActionTypeLogicApp, any specified value is ignored. ActionType *ActionType // The triggered Logic App Azure Resource ID. This can also reside on other subscriptions, given that you have permissions @@ -1431,13 +1539,14 @@ func (a *AutomationActionLogicApp) GetAutomationAction() *AutomationAction { } } -// AutomationActionWorkspace - The�Log�Analytics�Workspace�to�which�event data will be exported. Security alerts data will -// reside in the 'SecurityAlert' table and the assessments data will reside in the 'SecurityRecommendation' -// table (under the 'Security'/'SecurityCenterFree' solutions). Note that in order to view the data in the workspace, the -// Security Center Log Analytics free/standard solution needs to be enabled on that -// workspace. To learn more about Microsoft Defender for Cloud continuous export capabilities, visit https://aka.ms/ASCExportLearnMore +// AutomationActionWorkspace - The Log Analytics Workspace to which event data will be exported. Security alerts data will +// reside in the 'SecurityAlert' table and the assessments data will reside in the 'SecurityRecommendation' table (under the +// 'Security'/'SecurityCenterFree' solutions). Note that in order to view the data in the workspace, the Security Center Log +// Analytics free/standard solution needs to be enabled on that workspace. To learn more about Microsoft Defender for Cloud +// continuous export capabilities, visit https://aka.ms/ASCExportLearnMore type AutomationActionWorkspace struct { - // REQUIRED; The type of the action that will be triggered by the Automation + // CONSTANT; The type of the action that will be triggered by the Automation + // Field has constant value ActionTypeWorkspace, any specified value is ignored. ActionType *ActionType // The fully qualified Log Analytics Workspace Azure Resource ID. @@ -1453,10 +1562,10 @@ func (a *AutomationActionWorkspace) GetAutomationAction() *AutomationAction { // AutomationList - List of security automations response. type AutomationList struct { - // REQUIRED; The list of security automations under the given scope. + // REQUIRED; The Automation items on this page Value []*Automation - // READ-ONLY; The URI to fetch the next page. + // The link to the next page of items NextLink *string } @@ -1474,8 +1583,7 @@ type AutomationProperties struct { IsEnabled *bool // A collection of scopes on which the security automations logic is applied. Supported scopes are the subscription itself - // or a resource group under that subscription. The automation will only apply on - // defined scopes. + // or a resource group under that subscription. The automation will only apply on defined scopes. Scopes []*AutomationScope // A collection of the source event types which evaluate the security automation set of rules. @@ -1499,8 +1607,7 @@ type AutomationScope struct { } // AutomationSource - The source event types which evaluate the security automation set of rules. For example - security alerts -// and security assessments. To learn more about the supported security events data models -// schemas - please visit https://aka.ms/ASCAutomationSchemas. +// and security assessments. To learn more about the supported security events data models schemas - please visit https://aka.ms/ASCAutomationSchemas. type AutomationSource struct { // A valid event source type. EventSource *EventSource @@ -1511,8 +1618,7 @@ type AutomationSource struct { } // AutomationTriggeringRule - A rule which is evaluated upon event interception. The rule is configured by comparing a specific -// value from the event model to an expected value. This comparison is done by using one of the supported -// operators set. +// value from the event model to an expected value. This comparison is done by using one of the supported operators set. type AutomationTriggeringRule struct { // The expected value. ExpectedValue *string @@ -1545,75 +1651,10 @@ type AutomationValidationStatus struct { Message *string } -// AwAssumeRoleAuthenticationDetailsProperties - AWS cloud account connector based assume role, the role enables delegating -// access to your AWS resources. The role is composed of role Amazon Resource Name (ARN) and external ID. For more details, -// refer to Creating a Role to Delegate Permissions to an IAM User (write only) [https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_create_for-user.html] -type AwAssumeRoleAuthenticationDetailsProperties struct { - // REQUIRED; Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use - // account organization credentials. - AuthenticationType *AuthenticationType - - // REQUIRED; Assumed role ID is an identifier that you can use to create temporary security credentials. - AwsAssumeRoleArn *string - - // REQUIRED; A unique identifier that is required when you assume a role in another account. - AwsExternalID *string - - // READ-ONLY; The ID of the cloud account - AccountID *string - - // READ-ONLY; State of the multi-cloud connector - AuthenticationProvisioningState *AuthenticationProvisioningState - - // READ-ONLY; The permissions detected in the cloud account. - GrantedPermissions []*PermissionProperty -} - -// GetAuthenticationDetailsProperties implements the AuthenticationDetailsPropertiesClassification interface for type AwAssumeRoleAuthenticationDetailsProperties. -func (a *AwAssumeRoleAuthenticationDetailsProperties) GetAuthenticationDetailsProperties() *AuthenticationDetailsProperties { - return &AuthenticationDetailsProperties{ - AuthenticationProvisioningState: a.AuthenticationProvisioningState, - AuthenticationType: a.AuthenticationType, - GrantedPermissions: a.GrantedPermissions, - } -} - -// AwsCredsAuthenticationDetailsProperties - AWS cloud account connector based credentials, the credentials is composed of -// access key ID and secret key, for more details, refer to Creating an IAM User in Your AWS Account (write only) -// [https://docs.aws.amazon.com/IAM/latest/UserGuide/id_users_create.html] -type AwsCredsAuthenticationDetailsProperties struct { - // REQUIRED; Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use - // account organization credentials. - AuthenticationType *AuthenticationType - - // REQUIRED; Public key element of the AWS credential object (write only) - AwsAccessKeyID *string - - // REQUIRED; Secret key element of the AWS credential object (write only) - AwsSecretAccessKey *string - - // READ-ONLY; The ID of the cloud account - AccountID *string - - // READ-ONLY; State of the multi-cloud connector - AuthenticationProvisioningState *AuthenticationProvisioningState - - // READ-ONLY; The permissions detected in the cloud account. - GrantedPermissions []*PermissionProperty -} - -// GetAuthenticationDetailsProperties implements the AuthenticationDetailsPropertiesClassification interface for type AwsCredsAuthenticationDetailsProperties. -func (a *AwsCredsAuthenticationDetailsProperties) GetAuthenticationDetailsProperties() *AuthenticationDetailsProperties { - return &AuthenticationDetailsProperties{ - AuthenticationProvisioningState: a.AuthenticationProvisioningState, - AuthenticationType: a.AuthenticationType, - GrantedPermissions: a.GrantedPermissions, - } -} - // AwsEnvironmentData - The AWS connector environment data type AwsEnvironmentData struct { - // REQUIRED; The type of the environment data. + // CONSTANT; The type of the environment data. + // Field has constant value EnvironmentTypeAwsAccount, any specified value is ignored. EnvironmentType *EnvironmentType // The AWS account's organizational data @@ -1647,7 +1688,8 @@ func (a *AwsOrganizationalData) GetAwsOrganizationalData() *AwsOrganizationalDat // AwsOrganizationalDataMaster - The AWS organization data for the master account type AwsOrganizationalDataMaster struct { - // REQUIRED; The multi cloud account's membership type in the organization + // CONSTANT; The multi cloud account's membership type in the organization + // Field has constant value OrganizationMembershipTypeOrganization, any specified value is ignored. OrganizationMembershipType *OrganizationMembershipType // If the multi cloud account is of membership type organization, list of accounts excluded from offering @@ -1666,7 +1708,8 @@ func (a *AwsOrganizationalDataMaster) GetAwsOrganizationalData() *AwsOrganizatio // AwsOrganizationalDataMember - The AWS organization data for the member account type AwsOrganizationalDataMember struct { - // REQUIRED; The multi cloud account's membership type in the organization + // CONSTANT; The multi cloud account's membership type in the organization + // Field has constant value OrganizationMembershipTypeMember, any specified value is ignored. OrganizationMembershipType *OrganizationMembershipType // If the multi cloud account is not of membership type organization, this will be the ID of the account's parent @@ -1691,7 +1734,7 @@ type AzureDevOpsOrg struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -1700,10 +1743,10 @@ type AzureDevOpsOrg struct { // AzureDevOpsOrgListResponse - List of RP resources which supports pagination. type AzureDevOpsOrgListResponse struct { - // Gets or sets next link to scroll over the results. + // The link to the next page of items. NextLink *string - // Gets or sets list of resources. + // The AzureDevOpsOrg items on this page. Value []*AzureDevOpsOrg } @@ -1714,34 +1757,29 @@ type AzureDevOpsOrgProperties struct { // Details about resource onboarding status across all connectors. // OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level - // resources. Onboarded - this resource has already been onboarded by the - // specified connector. NotOnboarded - this resource has not been onboarded to any connector. NotApplicable - the onboarding - // state is not applicable to the current endpoint. + // resources. + // Onboarded - this resource has already been onboarded by the specified connector. + // NotOnboarded - this resource has not been onboarded to any connector. + // NotApplicable - the onboarding state is not applicable to the current endpoint. OnboardingState *OnboardingState - // The provisioning state of the resource. - // Pending - Provisioning pending. Failed - Provisioning failed. Succeeded - Successful provisioning. Canceled - Provisioning - // canceled. PendingDeletion - Deletion pending. DeletionSuccess - Deletion - // successful. DeletionFailure - Deletion failure. + // READ-ONLY; The provisioning state of the resource. + // Pending - Provisioning pending. + // Failed - Provisioning failed. + // Succeeded - Successful provisioning. + // Canceled - Provisioning canceled. + // PendingDeletion - Deletion pending. + // DeletionSuccess - Deletion successful. + // DeletionFailure - Deletion failure. ProvisioningState *DevOpsProvisioningState - // READ-ONLY; Gets or sets resource status message. + // READ-ONLY; Gets the resource status message. ProvisioningStatusMessage *string - // READ-ONLY; Gets or sets time when resource was last checked. + // READ-ONLY; Gets the time when resource was last checked. ProvisioningStatusUpdateTimeUTC *time.Time } -// AzureDevOpsOrganizationConfiguration - AzureDevOps Org Inventory Configuration. -type AzureDevOpsOrganizationConfiguration struct { - // AutoDiscovery states. - AutoDiscovery *AutoDiscovery - - // AzureDevOps Project Inventory Configuration. Dictionary of AzureDevOps project name to desired project configuration. If - // AutoDiscovery is Enabled, this field should be empty or null. - ProjectConfigs map[string]*AzureDevOpsProjectConfiguration -} - // AzureDevOpsProject - Azure DevOps Project resource. type AzureDevOpsProject struct { // Azure DevOps Project properties. @@ -1753,29 +1791,19 @@ type AzureDevOpsProject struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// AzureDevOpsProjectConfiguration - AzureDevOps Project Inventory Configuration. -type AzureDevOpsProjectConfiguration struct { - // AutoDiscovery states. - AutoDiscovery *AutoDiscovery - - // AzureDevOps Repository Inventory Configuration. Dictionary of AzureDevOps repository name to desired repository configuration. - // If AutoDiscovery is Enabled, this field should be null or empty. - RepositoryConfigs map[string]*BaseResourceConfiguration -} - // AzureDevOpsProjectListResponse - List of RP resources which supports pagination. type AzureDevOpsProjectListResponse struct { - // Gets or sets next link to scroll over the results. + // The link to the next page of items. NextLink *string - // Gets or sets list of resources. + // The AzureDevOpsProject items on this page. Value []*AzureDevOpsProject } @@ -1786,27 +1814,32 @@ type AzureDevOpsProjectProperties struct { // Details about resource onboarding status across all connectors. // OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level - // resources. Onboarded - this resource has already been onboarded by the - // specified connector. NotOnboarded - this resource has not been onboarded to any connector. NotApplicable - the onboarding - // state is not applicable to the current endpoint. + // resources. + // Onboarded - this resource has already been onboarded by the specified connector. + // NotOnboarded - this resource has not been onboarded to any connector. + // NotApplicable - the onboarding state is not applicable to the current endpoint. OnboardingState *OnboardingState // Gets or sets parent Azure DevOps Organization name. ParentOrgName *string - // The provisioning state of the resource. - // Pending - Provisioning pending. Failed - Provisioning failed. Succeeded - Successful provisioning. Canceled - Provisioning - // canceled. PendingDeletion - Deletion pending. DeletionSuccess - Deletion - // successful. DeletionFailure - Deletion failure. - ProvisioningState *DevOpsProvisioningState - // READ-ONLY; Gets or sets Azure DevOps Project id. ProjectID *string - // READ-ONLY; Gets or sets resource status message. + // READ-ONLY; The provisioning state of the resource. + // Pending - Provisioning pending. + // Failed - Provisioning failed. + // Succeeded - Successful provisioning. + // Canceled - Provisioning canceled. + // PendingDeletion - Deletion pending. + // DeletionSuccess - Deletion successful. + // DeletionFailure - Deletion failure. + ProvisioningState *DevOpsProvisioningState + + // READ-ONLY; Gets the resource status message. ProvisioningStatusMessage *string - // READ-ONLY; Gets or sets time when resource was last checked. + // READ-ONLY; Gets the time when resource was last checked. ProvisioningStatusUpdateTimeUTC *time.Time } @@ -1821,7 +1854,7 @@ type AzureDevOpsRepository struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -1830,10 +1863,10 @@ type AzureDevOpsRepository struct { // AzureDevOpsRepositoryListResponse - List of RP resources which supports pagination. type AzureDevOpsRepositoryListResponse struct { - // Gets or sets next link to scroll over the results. + // The link to the next page of items. NextLink *string - // Gets or sets list of resources. + // The AzureDevOpsRepository items on this page. Value []*AzureDevOpsRepository } @@ -1844,9 +1877,10 @@ type AzureDevOpsRepositoryProperties struct { // Details about resource onboarding status across all connectors. // OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level - // resources. Onboarded - this resource has already been onboarded by the - // specified connector. NotOnboarded - this resource has not been onboarded to any connector. NotApplicable - the onboarding - // state is not applicable to the current endpoint. + // resources. + // Onboarded - this resource has already been onboarded by the specified connector. + // NotOnboarded - this resource has not been onboarded to any connector. + // NotApplicable - the onboarding state is not applicable to the current endpoint. OnboardingState *OnboardingState // Gets or sets parent Azure DevOps Organization name. @@ -1855,16 +1889,20 @@ type AzureDevOpsRepositoryProperties struct { // Gets or sets parent Azure DevOps Project name. ParentProjectName *string - // The provisioning state of the resource. - // Pending - Provisioning pending. Failed - Provisioning failed. Succeeded - Successful provisioning. Canceled - Provisioning - // canceled. PendingDeletion - Deletion pending. DeletionSuccess - Deletion - // successful. DeletionFailure - Deletion failure. + // READ-ONLY; The provisioning state of the resource. + // Pending - Provisioning pending. + // Failed - Provisioning failed. + // Succeeded - Successful provisioning. + // Canceled - Provisioning canceled. + // PendingDeletion - Deletion pending. + // DeletionSuccess - Deletion successful. + // DeletionFailure - Deletion failure. ProvisioningState *DevOpsProvisioningState - // READ-ONLY; Gets or sets resource status message. + // READ-ONLY; Gets the resource status message. ProvisioningStatusMessage *string - // READ-ONLY; Gets or sets time when resource was last checked. + // READ-ONLY; Gets the time when resource was last checked. ProvisioningStatusUpdateTimeUTC *time.Time // READ-ONLY; Gets or sets Azure DevOps Repository id. @@ -1879,7 +1917,8 @@ type AzureDevOpsRepositoryProperties struct { // AzureDevOpsScopeEnvironmentData - The AzureDevOps scope connector's environment data type AzureDevOpsScopeEnvironmentData struct { - // REQUIRED; The type of the environment data. + // CONSTANT; The type of the environment data. + // Field has constant value EnvironmentTypeAzureDevOpsScope, any specified value is ignored. EnvironmentType *EnvironmentType } @@ -1892,7 +1931,8 @@ func (a *AzureDevOpsScopeEnvironmentData) GetEnvironmentData() *EnvironmentData // AzureResourceDetails - Details of the Azure resource that was assessed type AzureResourceDetails struct { - // REQUIRED; The platform where the assessed resource resides + // CONSTANT; The platform where the assessed resource resides + // Field has constant value SourceAzure, any specified value is ignored. Source *Source // READ-ONLY; Azure resource Id of the assessed resource @@ -1902,7 +1942,10 @@ type AzureResourceDetails struct { // GetResourceDetails implements the ResourceDetailsClassification interface for type AzureResourceDetails. func (a *AzureResourceDetails) GetResourceDetails() *ResourceDetails { return &ResourceDetails{ - Source: a.Source, + ConnectorID: a.ConnectorID, + ID: a.ID, + Source: a.Source, + Source: a.Source, } } @@ -1930,13 +1973,14 @@ type AzureResourceLink struct { // AzureServersSetting - A vulnerability assessments setting on Azure servers in the defined scope. type AzureServersSetting struct { - // REQUIRED; The kind of the server vulnerability assessments setting. + // CONSTANT; The kind of the server vulnerability assessments setting. + // Field has constant value ServerVulnerabilityAssessmentsSettingKindAzureServersSetting, any specified value is ignored. Kind *ServerVulnerabilityAssessmentsSettingKind // The vulnerability assessments setting properties on Azure servers in the defined scope. Properties *ServerVulnerabilityAssessmentsAzureSettingProperties - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; The name of the resource @@ -1956,23 +2000,12 @@ func (a *AzureServersSetting) GetServerVulnerabilityAssessmentsSetting() *Server ID: a.ID, Kind: a.Kind, Name: a.Name, + Properties: a.Properties, SystemData: a.SystemData, Type: a.Type, } } -// AzureTrackedResourceLocation - Describes an Azure resource with location -type AzureTrackedResourceLocation struct { - // Location where the resource is stored - Location *string -} - -// BaseResourceConfiguration - Base Resource Inventory configuration changes. -type BaseResourceConfiguration struct { - // Onboarding states. - DesiredOnboardingState *DesiredOnboardingState -} - // Baseline details. type Baseline struct { // Expected results. @@ -1987,10 +2020,10 @@ type BaselineAdjustedResult struct { // Baseline details. Baseline *Baseline - // Results the are not in baseline. + // Results that are not in the baseline. ResultsNotInBaseline [][]*string - // Results the are in baseline. + // Results that are in the baseline. ResultsOnlyInBaseline [][]*string // The rule result status. @@ -2006,6 +2039,24 @@ type BenchmarkReference struct { Reference *string } +// BlobsScanSummary - A summary of the scan results of the blobs that were scanned. +type BlobsScanSummary struct { + // The number of failed blob scans. + FailedBlobsCount *int64 + + // The number of malicious blobs that were detected during the scan. + MaliciousBlobsCount *int64 + + // The number of gigabytes of data that were scanned. + ScannedBlobsInGB *float64 + + // The number of blobs that were skipped. + SkippedBlobsCount *int64 + + // The total number of blobs that were scanned. + TotalBlobsScanned *int64 +} + // BuiltInInfoType - Pre-configured sensitive information type type BuiltInInfoType struct { // Id of the info type @@ -2035,8 +2086,13 @@ type CVSS struct { // CategoryConfiguration - Severity level per category configuration for PR Annotations. type CategoryConfiguration struct { - // Rule categories. Code - code scanning results. Artifact scanning results. Dependencies scanning results. IaC results. Secrets - // scanning results. Container scanning results. + // Rule categories. + // Code - code scanning results. + // Artifact scanning results. + // Dependencies scanning results. + // IaC results. + // Secrets scanning results. + // Container scanning results. Category *RuleCategory // Gets or sets minimum severity level for a given category. @@ -2045,39 +2101,43 @@ type CategoryConfiguration struct { // CefExternalSecuritySolution - Represents a security solution which sends CEF logs to an OMS workspace type CefExternalSecuritySolution struct { - // REQUIRED; The kind of the external solution + // REQUIRED Kind *ExternalSecuritySolutionKind // The external security solution properties for CEF solutions Properties *CefSolutionProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; Location where the resource is stored Location *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // GetExternalSecuritySolution implements the ExternalSecuritySolutionClassification interface for type CefExternalSecuritySolution. func (c *CefExternalSecuritySolution) GetExternalSecuritySolution() *ExternalSecuritySolution { return &ExternalSecuritySolution{ - ID: c.ID, - Kind: c.Kind, - Location: c.Location, - Name: c.Name, - Type: c.Type, + ID: c.ID, + Kind: c.Kind, + Location: c.Location, + Name: c.Name, + Properties: c.Properties, + SystemData: c.SystemData, + Type: c.Type, } } // CefSolutionProperties - The external security solution properties for CEF solutions type CefSolutionProperties struct { - // OPTIONAL; Contains additional key/value pairs not defined in the schema. AdditionalProperties map[string]any Agent *string DeviceType *string @@ -2106,28 +2166,31 @@ type Compliance struct { // Compliance data Properties *ComplianceProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // ComplianceList - List of Compliance objects response type ComplianceList struct { - // List of Compliance objects - Value []*Compliance - // READ-ONLY; The URI to fetch the next page. NextLink *string + + // READ-ONLY; List of Compliance objects + Value []*Compliance } // ComplianceProperties - The Compliance score (percentage) of a Subscription is a sum of all Resources' Compliances under -// the given Subscription. A Resource Compliance is defined as the compliant ('healthy') Policy -// Definitions out of all Policy Definitions applicable to a given resource. +// the given Subscription. A Resource Compliance is defined as the compliant ('healthy') Policy Definitions out of all Policy +// Definitions applicable to a given resource. type ComplianceProperties struct { // READ-ONLY; An array of segment, which is the actually the compliance assessment. AssessmentResult []*ComplianceSegment @@ -2145,22 +2208,25 @@ type ComplianceResult struct { // Compliance result data Properties *ComplianceResultProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // ComplianceResultList - List of compliance results response type ComplianceResultList struct { - // REQUIRED; List of compliance results + // REQUIRED; The ComplianceResult items on this page Value []*ComplianceResult - // READ-ONLY; The URI to fetch the next page. + // The link to the next page of items NextLink *string } @@ -2179,18 +2245,6 @@ type ComplianceSegment struct { SegmentType *string } -// 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 - - // The governance rule Condition's Property, e.g. Severity or AssessmentKey, see examples - Property *string - - // The governance rule Condition's Value like severity Low, High or assessments keys, see examples - Value *string -} - // ConnectableResource - Describes the allowed inbound and outbound traffic of an Azure resource type ConnectableResource struct { // READ-ONLY; The Azure resource id @@ -2230,7 +2284,7 @@ type ConnectionFromIPNotAllowed struct { // REQUIRED; Status of the custom alert. IsEnabled *bool - // REQUIRED; The type of the custom alert rule. + // CONSTANT; Field has constant value "ConnectionFromIpNotAllowed", any specified value is ignored. RuleType *string // READ-ONLY; The description of the custom alert. @@ -2285,7 +2339,7 @@ type ConnectionToIPNotAllowed struct { // REQUIRED; Status of the custom alert. IsEnabled *bool - // REQUIRED; The type of the custom alert rule. + // CONSTANT; Field has constant value "ConnectionToIpNotAllowed", any specified value is ignored. RuleType *string // READ-ONLY; The description of the custom alert. @@ -2339,25 +2393,25 @@ type Connector struct { // Kind of the resource Kind *string - // Location where the resource is stored + // The geo-location where the resource lives Location *string // Security connector data Properties *ConnectorProperties - // A list of key value pairs that describe the resource. + // Resource tags. Tags map[string]*string - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; Resource type + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -2380,45 +2434,12 @@ type ConnectorProperties struct { HierarchyIdentifierTrialEndDate *time.Time } -// ConnectorSetting - The connector setting -type ConnectorSetting struct { - // Connector setting data - Properties *ConnectorSettingProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// ConnectorSettingList - For a subscription, list of all cloud account connectors and their settings -type ConnectorSettingList struct { - // List of all the cloud account connector settings - Value []*ConnectorSetting - - // READ-ONLY; The URI to fetch the next page. - NextLink *string -} - -// ConnectorSettingProperties - Describes properties of a connector setting -type ConnectorSettingProperties struct { - // Settings for authentication management, these settings are relevant only for the cloud connector. - AuthenticationDetails AuthenticationDetailsPropertiesClassification - - // Settings for hybrid compute management. These settings are relevant only for Arc autoProvision (Hybrid Compute). - HybridComputeSettings *HybridComputeSettingsProperties -} - // ConnectorsList - List of security connectors response. type ConnectorsList struct { - // REQUIRED; The list of security connectors under the given scope. + // REQUIRED; The SecurityConnector items on this page Value []*Connector - // READ-ONLY; The URI to fetch the next page. + // The link to the next page of items NextLink *string } @@ -2427,22 +2448,25 @@ type Contact struct { // Security contact data Properties *ContactProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // ContactList - List of security contacts response type ContactList struct { - // REQUIRED; List of security contacts + // REQUIRED; The SecurityContact items on this page Value []*Contact - // READ-ONLY; The URI to fetch the next page. + // The link to the next page of items NextLink *string } @@ -2516,7 +2540,8 @@ func (c *ContainerRegistryVulnerabilityProperties) GetAdditionalData() *Addition // CspmMonitorAwsOffering - The CSPM monitoring for AWS offering type CspmMonitorAwsOffering struct { - // REQUIRED; The type of the security offering. + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeCspmMonitorAws, any specified value is ignored. OfferingType *OfferingType // The native cloud connection configuration @@ -2542,7 +2567,8 @@ type CspmMonitorAwsOfferingNativeCloudConnection struct { // CspmMonitorAzureDevOpsOffering - The CSPM monitoring for AzureDevOps offering type CspmMonitorAzureDevOpsOffering struct { - // REQUIRED; The type of the security offering. + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeCspmMonitorAzureDevOps, any specified value is ignored. OfferingType *OfferingType // READ-ONLY; The offering description. @@ -2557,9 +2583,28 @@ func (c *CspmMonitorAzureDevOpsOffering) GetCloudOffering() *CloudOffering { } } +// CspmMonitorDockerHubOffering - The CSPM (Cloud security posture management) monitoring for Docker Hub offering +type CspmMonitorDockerHubOffering struct { + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeCspmMonitorDockerHub, any specified value is ignored. + OfferingType *OfferingType + + // READ-ONLY; The offering description. + Description *string +} + +// GetCloudOffering implements the CloudOfferingClassification interface for type CspmMonitorDockerHubOffering. +func (c *CspmMonitorDockerHubOffering) GetCloudOffering() *CloudOffering { + return &CloudOffering{ + Description: c.Description, + OfferingType: c.OfferingType, + } +} + // CspmMonitorGcpOffering - The CSPM monitoring for GCP offering type CspmMonitorGcpOffering struct { - // REQUIRED; The type of the security offering. + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeCspmMonitorGcp, any specified value is ignored. OfferingType *OfferingType // The native cloud connection configuration @@ -2588,7 +2633,8 @@ type CspmMonitorGcpOfferingNativeCloudConnection struct { // CspmMonitorGitLabOffering - The CSPM (Cloud security posture management) monitoring for gitlab offering type CspmMonitorGitLabOffering struct { - // REQUIRED; The type of the security offering. + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeCspmMonitorGitLab, any specified value is ignored. OfferingType *OfferingType // READ-ONLY; The offering description. @@ -2605,7 +2651,8 @@ func (c *CspmMonitorGitLabOffering) GetCloudOffering() *CloudOffering { // CspmMonitorGithubOffering - The CSPM monitoring for github offering type CspmMonitorGithubOffering struct { - // REQUIRED; The type of the security offering. + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeCspmMonitorGithub, any specified value is ignored. OfferingType *OfferingType // READ-ONLY; The offering description. @@ -2620,6 +2667,24 @@ func (c *CspmMonitorGithubOffering) GetCloudOffering() *CloudOffering { } } +// CspmMonitorJFrogOffering - The CSPM (Cloud security posture management) monitoring for JFrog Artifactory offering +type CspmMonitorJFrogOffering struct { + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeCspmMonitorJFrog, any specified value is ignored. + OfferingType *OfferingType + + // READ-ONLY; The offering description. + Description *string +} + +// GetCloudOffering implements the CloudOfferingClassification interface for type CspmMonitorJFrogOffering. +func (c *CspmMonitorJFrogOffering) GetCloudOffering() *CloudOffering { + return &CloudOffering{ + Description: c.Description, + OfferingType: c.OfferingType, + } +} + // CustomAlertRule - A custom alert rule. type CustomAlertRule struct { // REQUIRED; Status of the custom alert. @@ -2638,139 +2703,58 @@ type CustomAlertRule struct { // GetCustomAlertRule implements the CustomAlertRuleClassification interface for type CustomAlertRule. func (c *CustomAlertRule) GetCustomAlertRule() *CustomAlertRule { return c } -// CustomAssessmentAutomation - Custom Assessment Automation -type CustomAssessmentAutomation struct { - // describes Custom Assessment Automation properties. - Properties *CustomAssessmentAutomationProperties +// CustomRecommendation - Custom Recommendation +type CustomRecommendation struct { + // describes Custom Recommendation properties. + Properties *CustomRecommendationProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; Resource type + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// CustomAssessmentAutomationProperties - describes the Custom Assessment Automation properties -type CustomAssessmentAutomationProperties struct { - // The assessment metadata key used when an assessment is generated for this assessment automation. - AssessmentKey *string - - // GZip encoded KQL query representing the assessment automation results required. - CompressedQuery *string +// CustomRecommendationProperties - describes the Custom Recommendation properties +type CustomRecommendationProperties struct { + // List of all standard supported clouds. + CloudProviders []*RecommendationSupportedClouds - // The description to relate to the assessments generated by this assessment automation. + // The description to relate to the assessments generated by this Recommendation. Description *string - // The display name of the assessments generated by this assessment automation. + // The display name of the assessments generated by this Recommendation. DisplayName *string - // The remediation description to relate to the assessments generated by this assessment automation. + // KQL query representing the Recommendation results required. + Query *string + + // The remediation description to relate to the assessments generated by this Recommendation. RemediationDescription *string - // The severity to relate to the assessments generated by this assessment automation. + // The severity to relate to the assessments generated by this Recommendation. + SecurityIssue *SecurityIssue + + // The severity to relate to the assessments generated by this Recommendation. Severity *SeverityEnum - // Relevant cloud for the custom assessment automation. - SupportedCloud *SupportedCloudEnum + // READ-ONLY; The assessment metadata key used when an assessment is generated for this Recommendation. + AssessmentKey *string } -// CustomAssessmentAutomationRequest - Custom Assessment Automation request -type CustomAssessmentAutomationRequest struct { - // describes Custom Assessment Automation request properties. - Properties *CustomAssessmentAutomationRequestProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string +// CustomRecommendationsList - A list of Custom Recommendations +type CustomRecommendationsList struct { + // READ-ONLY; Collection of Custom Recommendations + Value []*CustomRecommendation - // READ-ONLY; Resource type - Type *string -} - -// CustomAssessmentAutomationRequestProperties - describes the Custom Assessment Automation properties -type CustomAssessmentAutomationRequestProperties struct { - // Base 64 encoded KQL query representing the assessment automation results required. - CompressedQuery *string - - // The description to relate to the assessments generated by this assessment automation. - Description *string - - // The display name of the assessments generated by this assessment automation. - DisplayName *string - - // The remediation description to relate to the assessments generated by this assessment automation. - RemediationDescription *string - - // The severity to relate to the assessments generated by this assessment automation. - Severity *SeverityEnum - - // Relevant cloud for the custom assessment automation. - SupportedCloud *SupportedCloudEnum -} - -// CustomAssessmentAutomationsListResult - A list of Custom Assessment Automations -type CustomAssessmentAutomationsListResult struct { - // The link used to get the next page of operations. - NextLink *string - - // READ-ONLY; Collection of Custom Assessment Automations - Value []*CustomAssessmentAutomation -} - -// CustomEntityStoreAssignment - Custom entity store assignment -type CustomEntityStoreAssignment struct { - // describes custom entity store assignment properties. - Properties *CustomEntityStoreAssignmentProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData - - // READ-ONLY; Resource type - Type *string -} - -// CustomEntityStoreAssignmentProperties - describes the custom entity store assignment properties -type CustomEntityStoreAssignmentProperties struct { - // The link to entity store database. - EntityStoreDatabaseLink *string - - // The principal assigned with entity store. Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId] - Principal *string -} - -// CustomEntityStoreAssignmentRequest - describes the custom entity store assignment request -type CustomEntityStoreAssignmentRequest struct { - // describes properties of custom entity store assignment request - Properties *CustomEntityStoreAssignmentRequestProperties -} - -// CustomEntityStoreAssignmentRequestProperties - describes properties of custom entity store assignment request -type CustomEntityStoreAssignmentRequestProperties struct { - // The principal assigned with entity store. If not provided, will use caller principal. Format of principal is: [AAD type]=[PrincipalObjectId];[TenantId] - Principal *string -} - -// CustomEntityStoreAssignmentsListResult - A list of custom entity store assignments -type CustomEntityStoreAssignmentsListResult struct { - // The link used to get the next page of operations. - NextLink *string - - // READ-ONLY; Collection of custom entity store assignments - Value []*CustomEntityStoreAssignment + // The link used to get the next page of operations. + NextLink *string } // DataExportSettingProperties - The data export setting properties @@ -2781,35 +2765,42 @@ type DataExportSettingProperties struct { // DataExportSettings - Represents a data export setting type DataExportSettings struct { - // REQUIRED; the kind of the settings string + // CONSTANT; the kind of the settings string + // Field has constant value SettingKindDataExportSettings, any specified value is ignored. Kind *SettingKind // Data export setting data Properties *DataExportSettingProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // GetSetting implements the SettingClassification interface for type DataExportSettings. func (d *DataExportSettings) GetSetting() *Setting { return &Setting{ - ID: d.ID, - Kind: d.Kind, - Name: d.Name, - Type: d.Type, + ID: d.ID, + Kind: d.Kind, + Name: d.Name, + Properties: d.Properties, + SystemData: d.SystemData, + Type: d.Type, } } // DefenderCspmAwsOffering - The CSPM P1 for AWS offering type DefenderCspmAwsOffering struct { - // REQUIRED; The type of the security offering. + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeDefenderCspmAws, any specified value is ignored. OfferingType *OfferingType // Defenders CSPM Permissions Management offering configurations @@ -2914,9 +2905,28 @@ type DefenderCspmAwsOfferingVMScanners struct { Enabled *bool } +// DefenderCspmDockerHubOffering - The Defender for CSPM Docker Hub offering configurations +type DefenderCspmDockerHubOffering struct { + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeDefenderCspmDockerHub, any specified value is ignored. + OfferingType *OfferingType + + // READ-ONLY; The offering description. + Description *string +} + +// GetCloudOffering implements the CloudOfferingClassification interface for type DefenderCspmDockerHubOffering. +func (d *DefenderCspmDockerHubOffering) GetCloudOffering() *CloudOffering { + return &CloudOffering{ + Description: d.Description, + OfferingType: d.OfferingType, + } +} + // DefenderCspmGcpOffering - The CSPM P1 for GCP offering type DefenderCspmGcpOffering struct { - // REQUIRED; The type of the security offering. + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeDefenderCspmGcp, any specified value is ignored. OfferingType *OfferingType // GCP Defenders CSPM Permissions Management OIDC (Open ID connect) connection configurations @@ -3003,9 +3013,37 @@ type DefenderCspmGcpOfferingVMScanners struct { Enabled *bool } +// DefenderCspmJFrogOffering - The CSPM P1 for JFrog Artifactory offering +type DefenderCspmJFrogOffering struct { + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeDefenderCspmJFrog, any specified value is ignored. + OfferingType *OfferingType + + // The Microsoft Defender Container image assessment configuration + MdcContainersImageAssessment *DefenderCspmJFrogOfferingMdcContainersImageAssessment + + // READ-ONLY; The offering description. + Description *string +} + +// GetCloudOffering implements the CloudOfferingClassification interface for type DefenderCspmJFrogOffering. +func (d *DefenderCspmJFrogOffering) GetCloudOffering() *CloudOffering { + return &CloudOffering{ + Description: d.Description, + OfferingType: d.OfferingType, + } +} + +// DefenderCspmJFrogOfferingMdcContainersImageAssessment - The Microsoft Defender Container image assessment configuration +type DefenderCspmJFrogOfferingMdcContainersImageAssessment struct { + // Is Microsoft Defender container image assessment enabled + Enabled *bool +} + // DefenderFoDatabasesAwsOffering - The Defender for Databases AWS offering type DefenderFoDatabasesAwsOffering struct { - // REQUIRED; The type of the security offering. + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeDefenderForDatabasesAws, any specified value is ignored. OfferingType *OfferingType // The ARC autoprovisioning configuration @@ -3061,7 +3099,8 @@ type DefenderFoDatabasesAwsOfferingRds struct { // DefenderForContainersAwsOffering - The Defender for Containers AWS offering type DefenderForContainersAwsOffering struct { - // REQUIRED; The type of the security offering. + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeDefenderForContainersAws, any specified value is ignored. OfferingType *OfferingType // The cloudwatch to kinesis connection configuration @@ -3167,9 +3206,28 @@ type DefenderForContainersAwsOfferingVMScanners struct { Enabled *bool } +// DefenderForContainersDockerHubOffering - The Defender for containers Docker Hub offering configurations +type DefenderForContainersDockerHubOffering struct { + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeDefenderForContainersDockerHub, any specified value is ignored. + OfferingType *OfferingType + + // READ-ONLY; The offering description. + Description *string +} + +// GetCloudOffering implements the CloudOfferingClassification interface for type DefenderForContainersDockerHubOffering. +func (d *DefenderForContainersDockerHubOffering) GetCloudOffering() *CloudOffering { + return &CloudOffering{ + Description: d.Description, + OfferingType: d.OfferingType, + } +} + // DefenderForContainersGcpOffering - The containers GCP offering type DefenderForContainersGcpOffering struct { - // REQUIRED; The type of the security offering. + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeDefenderForContainersGcp, any specified value is ignored. OfferingType *OfferingType // The native cloud connection configuration @@ -3260,9 +3318,28 @@ type DefenderForContainersGcpOfferingVMScanners struct { Enabled *bool } +// DefenderForContainersJFrogOffering - The Defender for Containers for JFrog Artifactory offering +type DefenderForContainersJFrogOffering struct { + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeDefenderForContainersJFrog, any specified value is ignored. + OfferingType *OfferingType + + // READ-ONLY; The offering description. + Description *string +} + +// GetCloudOffering implements the CloudOfferingClassification interface for type DefenderForContainersJFrogOffering. +func (d *DefenderForContainersJFrogOffering) GetCloudOffering() *CloudOffering { + return &CloudOffering{ + Description: d.Description, + OfferingType: d.OfferingType, + } +} + // DefenderForDatabasesGcpOffering - The Defender for Databases GCP offering configurations type DefenderForDatabasesGcpOffering struct { - // REQUIRED; The type of the security offering. + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeDefenderForDatabasesGcp, any specified value is ignored. OfferingType *OfferingType // The ARC autoprovisioning configuration @@ -3303,7 +3380,8 @@ type DefenderForDatabasesGcpOfferingDefenderForDatabasesArcAutoProvisioning stru // DefenderForServersAwsOffering - The Defender for Servers AWS offering type DefenderForServersAwsOffering struct { - // REQUIRED; The type of the security offering. + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeDefenderForServersAws, any specified value is ignored. OfferingType *OfferingType // The ARC autoprovisioning configuration @@ -3398,7 +3476,8 @@ type DefenderForServersAwsOfferingVaAutoProvisioningConfiguration struct { // DefenderForServersGcpOffering - The Defender for Servers GCP offering configurations type DefenderForServersGcpOffering struct { - // REQUIRED; The type of the security offering. + // CONSTANT; The type of the security offering. + // Field has constant value OfferingTypeDefenderForServersGcp, any specified value is ignored. OfferingType *OfferingType // The ARC autoprovisioning configuration @@ -3493,16 +3572,28 @@ type DefenderForStorageSetting struct { // Defender for Storage resource properties. Properties *DefenderForStorageSettingProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } +// DefenderForStorageSettingList - List of Defender for Storage settings. +type DefenderForStorageSettingList struct { + // The URI to fetch the next page. + NextLink *string + + // READ-ONLY; List of Defender for Storage settings. + Value []*DefenderForStorageSetting +} + // DefenderForStorageSettingProperties - Defender for Storage resource properties. type DefenderForStorageSettingProperties struct { // Indicates whether Defender for Storage is enabled on this storage account. @@ -3526,7 +3617,7 @@ type DenylistCustomAlertRule struct { // REQUIRED; Status of the custom alert. IsEnabled *bool - // REQUIRED; The type of the custom alert rule. + // CONSTANT; Field has constant value "DenylistCustomAlertRule", any specified value is ignored. RuleType *string // READ-ONLY; The description of the custom alert. @@ -3560,6 +3651,15 @@ func (d *DenylistCustomAlertRule) GetListCustomAlertRule() *ListCustomAlertRule } } +// DevOpsCapability - Details about DevOps capability. +type DevOpsCapability struct { + // READ-ONLY; Gets the name of the DevOps capability. + Name *string + + // READ-ONLY; Gets the value of the DevOps capability. + Value *string +} + // DevOpsConfiguration - DevOps Configuration resource. type DevOpsConfiguration struct { // DevOps Configuration properties. @@ -3571,7 +3671,7 @@ type DevOpsConfiguration struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -3580,34 +3680,45 @@ type DevOpsConfiguration struct { // DevOpsConfigurationListResponse - List of RP resources which supports pagination. type DevOpsConfigurationListResponse struct { - // Gets or sets next link to scroll over the results. + // The link to the next page of items. NextLink *string - // Gets or sets list of resources. + // The DevOpsConfiguration items on this page. Value []*DevOpsConfiguration } // DevOpsConfigurationProperties - DevOps Configuration properties. type DevOpsConfigurationProperties struct { + // Details about Agentless configuration. + AgentlessConfiguration *AgentlessConfiguration + // Authorization payload. Authorization *Authorization // AutoDiscovery states. AutoDiscovery *AutoDiscovery - // The provisioning state of the resource. - // Pending - Provisioning pending. Failed - Provisioning failed. Succeeded - Successful provisioning. Canceled - Provisioning - // canceled. PendingDeletion - Deletion pending. DeletionSuccess - Deletion - // successful. DeletionFailure - Deletion failure. - ProvisioningState *DevOpsProvisioningState - - // List of top-level inventory to select when AutoDiscovery is disabled. This field is ignored when AutoDiscovery is enabled. + // List of top-level inventory to select when AutoDiscovery is disabled. + // This field is ignored when AutoDiscovery is enabled. TopLevelInventoryList []*string - // READ-ONLY; Gets or sets resource status message. + // READ-ONLY; List of capabilities assigned to the DevOps configuration during the discovery process. + Capabilities []*DevOpsCapability + + // READ-ONLY; The provisioning state of the resource. + // Pending - Provisioning pending. + // Failed - Provisioning failed. + // Succeeded - Successful provisioning. + // Canceled - Provisioning canceled. + // PendingDeletion - Deletion pending. + // DeletionSuccess - Deletion successful. + // DeletionFailure - Deletion failure. + ProvisioningState *DevOpsProvisioningState + + // READ-ONLY; Gets the resource status message. ProvisioningStatusMessage *string - // READ-ONLY; Gets or sets time when resource was last checked. + // READ-ONLY; Gets the time when resource was last checked. ProvisioningStatusUpdateTimeUTC *time.Time } @@ -3616,13 +3727,16 @@ type DeviceSecurityGroup struct { // Device Security group data Properties *DeviceSecurityGroupProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -3661,7 +3775,8 @@ type DirectMethodInvokesNotInAllowedRange struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; The type of the custom alert rule. + // Field has constant value "DirectMethodInvokesNotInAllowedRange", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -3709,20 +3824,25 @@ func (d *DirectMethodInvokesNotInAllowedRange) GetTimeWindowCustomAlertRule() *T } } +// DiscoveredSecuritySolution - Concrete proxy resource types can be created by aliasing this type using a specific property +// type. type DiscoveredSecuritySolution struct { // REQUIRED Properties *DiscoveredSecuritySolutionProperties - // READ-ONLY; Resource Id - ID *string - // READ-ONLY; Location where the resource is stored Location *string - // READ-ONLY; Resource name + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -3747,19 +3867,24 @@ type DiscoveredSecuritySolutionProperties struct { SecurityFamily *SecurityFamily } -// ETag - Entity tag is used for comparing two or more entities from the same requested resource. -type ETag struct { - // Entity tag is used for comparing two or more entities from the same requested resource. - Etag *string -} +// DockerHubEnvironmentData - The Docker Hub connector environment data +type DockerHubEnvironmentData struct { + // CONSTANT; The type of the environment data. + // Field has constant value EnvironmentTypeDockerHubOrganization, any specified value is ignored. + EnvironmentType *EnvironmentType + + // The Docker Hub organization authentication details + Authentication AuthenticationClassification -// EffectiveNetworkSecurityGroups - Describes the Network Security Groups effective on a network interface -type EffectiveNetworkSecurityGroups struct { - // The Azure resource ID of the network interface - NetworkInterface *string + // Scan interval in hours (value should be between 1-hour to 24-hours) + ScanInterval *int64 +} - // The Network Security Groups effective on the network interface - NetworkSecurityGroups []*string +// GetEnvironmentData implements the EnvironmentDataClassification interface for type DockerHubEnvironmentData. +func (d *DockerHubEnvironmentData) GetEnvironmentData() *EnvironmentData { + return &EnvironmentData{ + EnvironmentType: d.EnvironmentType, + } } // EnvironmentData - The security connector environment data. @@ -3817,38 +3942,6 @@ type ErrorDetail struct { Target *string } -// ErrorDetailAutoGenerated - The error detail. -type ErrorDetailAutoGenerated struct { - // READ-ONLY; The error additional info. - AdditionalInfo []*ErrorAdditionalInfo - - // READ-ONLY; The error code. - Code *string - - // READ-ONLY; The error details. - Details []*ErrorDetailAutoGenerated - - // READ-ONLY; The error message. - Message *string - - // READ-ONLY; The error target. - Target *string -} - -// ErrorResponse - 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 ErrorResponse struct { - // The error object. - Error *ErrorDetail -} - -// ErrorResponseAutoGenerated - 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 ErrorResponseAutoGenerated struct { - // The error object. - Error *ErrorDetailAutoGenerated -} - // ExecuteGovernanceRuleParams - Governance rule execution parameters type ExecuteGovernanceRuleParams struct { // Describe if governance rule should be override @@ -3860,44 +3953,66 @@ type Extension struct { // REQUIRED; Indicates whether the extension is enabled. IsEnabled *IsEnabled - // REQUIRED; The extension name. Supported values are: - // AgentlessDiscoveryForKubernetes - API-based discovery of information about Kubernetes cluster architecture, workload objects, - // and setup. Required for Kubernetes inventory, identity and network - // exposure detection, attack path analysis and risk hunting as part of the cloud security explorer. Available for CloudPosture - // plan. - // OnUploadMalwareScanning - Limits the GB to be scanned per month for each storage account within the subscription. Once - // this limit reached on a given storage account, Blobs won't be scanned during - // current calendar month. Available for StorageAccounts plan. - // SensitiveDataDiscovery - Sensitive data discovery identifies Blob storage container with sensitive data such as credentials, - // credit cards, and more, to help prioritize and investigate security events. - // Available for StorageAccounts and CloudPosture plans. - // ContainerRegistriesVulnerabilityAssessments - Provides vulnerability management for images stored in your container registries. - // Available for CloudPosture and Containers plans. + // REQUIRED; The extension name. Supported values are:

**AgentlessDiscoveryForKubernetes** - Provides zero footprint, + // API-based discovery of Kubernetes clusters, their configurations and deployments. The collected data is used to create + // a contextualized security graph for Kubernetes clusters, provide risk hunting capabilities, and visualize risks and threats + // to Kubernetes environments and workloads.
Available for CloudPosture plan and Containers plan.

**OnUploadMalwareScanning** + // - Limits the GB to be scanned per month for each storage account within the subscription. Once this limit reached on a + // given storage account, Blobs won't be scanned during current calendar month.
Available for StorageAccounts plan (DefenderForStorageV2 + // sub plans).

**SensitiveDataDiscovery** - Sensitive data discovery identifies Blob storage container with sensitive + // data such as credentials, credit cards, and more, to help prioritize and investigate security events.
Available for + // StorageAccounts plan (DefenderForStorageV2 sub plan) and CloudPosture plan.

**ContainerRegistriesVulnerabilityAssessments** + // - Provides vulnerability management for images stored in your container registries.
Available for CloudPosture plan + // and Containers plan.

**MdeDesignatedSubscription** - Direct onboarding is a seamless integration between Defender + // for Endpoint and Defender for Cloud that doesn't require extra software deployment on your servers. The onboarded resources + // will be presented under a designated Azure Subscription you configure
Available for VirtualMachines plan (P1 and P2 + // sub plans).

**AgentlessVmScanning** - Scans your machines for installed software, vulnerabilities, malware and secret + // scanning without relying on agents or impacting machine performance. Learn more here https://learn.microsoft.com/en-us/azure/defender-for-cloud/concept-agentless-data-collection.
Available + // for CloudPosture plan, VirtualMachines plan (P2 sub plan) and Containers plan.

**EntraPermissionsManagement** - + // Permissions Management provides Cloud Infrastructure Entitlement Management (CIEM) capabilities that helps organizations + // to manage and control user access and entitlements in their cloud infrastructure - important attack vector for cloud environments.
Permissions + // Management analyzes all permissions and active usage, and suggests recommendations to reduce permissions to enforce the + // principle of least privilege. Learn more here https://learn.microsoft.com/en-us/azure/defender-for-cloud/permissions-management.
Available + // for CloudPosture plan.

**FileIntegrityMonitoring** - File integrity monitoring (FIM), examines operating system + // files.
Windows registries, Linux system files, in real time, for changes that might indicate an attack.
Available + // for VirtualMachines plan (P2 sub plan).

**ContainerSensor** - The sensor is based on IG and provides a rich threat + // detection suite for Kubernetes clusters, nodes, and workloads, powered by Microsoft leading threat intelligence, provides + // mapping to MITRE ATT&CK framework.
Available for Containers plan.

**AIPromptEvidence** - Exposes the prompts + // passed between the user and the AI model as alert evidence. This helps classify and triage the alerts with relevant user + // context. The prompt snippets will include only segments of the user prompt or model response that were deemed suspicious + // and relevant for security classifications. The prompt evidence will be available through Defender portal as part of each + // alert.
Available for AI plan.

Name *string // Property values associated with the extension. AdditionalExtensionProperties map[string]any // READ-ONLY; Optional. A status describing the success/failure of the extension's enablement/disablement operation. - OperationStatus *OperationStatusAutoGenerated + OperationStatus *OperationStatus } // 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 { - // REQUIRED; The kind of the external solution + // The kind of the external solution Kind *ExternalSecuritySolutionKind - // READ-ONLY; Resource Id + // The resource-specific properties for this resource. + Properties any + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; Location where the resource is stored Location *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -3907,21 +4022,10 @@ func (e *ExternalSecuritySolution) GetExternalSecuritySolution() *ExternalSecuri type ExternalSecuritySolutionList struct { Value []ExternalSecuritySolutionClassification - // READ-ONLY; The URI to fetch the next page. + // READ-ONLY NextLink *string } -// ExternalSecuritySolutionProperties - The solution properties (correspond to the solution kind) -type ExternalSecuritySolutionProperties struct { - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]any - DeviceType *string - DeviceVendor *string - - // Represents an OMS workspace to which the solution is connected - Workspace *ConnectedWorkspace -} - // FailedLocalLoginsNotInAllowedRange - Number of failed local logins is not in allowed range. type FailedLocalLoginsNotInAllowedRange struct { // REQUIRED; Status of the custom alert. @@ -3933,7 +4037,8 @@ type FailedLocalLoginsNotInAllowedRange struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; The type of the custom alert rule. + // Field has constant value "FailedLocalLoginsNotInAllowedRange", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -3992,7 +4097,8 @@ type FileUploadsNotInAllowedRange struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; The type of the custom alert rule. + // Field has constant value "FileUploadsNotInAllowedRange", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -4040,60 +4146,22 @@ func (f *FileUploadsNotInAllowedRange) GetTimeWindowCustomAlertRule() *TimeWindo } } -// GcpCredentialsDetailsProperties - GCP cloud account connector based service to service credentials, the credentials are -// composed of the organization ID and a JSON API key (write only) -type GcpCredentialsDetailsProperties struct { - // REQUIRED; Auth provider x509 certificate URL field of the API key (write only) - AuthProviderX509CertURL *string - - // REQUIRED; Auth URI field of the API key (write only) - AuthURI *string - - // REQUIRED; Connect to your cloud account, for AWS use either account credentials or role-based authentication. For GCP use - // account organization credentials. - AuthenticationType *AuthenticationType - - // REQUIRED; Client email field of the API key (write only) - ClientEmail *string - - // REQUIRED; Client ID field of the API key (write only) - ClientID *string - - // REQUIRED; Client x509 certificate URL field of the API key (write only) - ClientX509CertURL *string - - // REQUIRED; The organization ID of the GCP cloud account - OrganizationID *string - - // REQUIRED; Private key field of the API key (write only) - PrivateKey *string - - // REQUIRED; Private key ID field of the API key (write only) - PrivateKeyID *string - - // REQUIRED; Project ID field of the API key (write only) - ProjectID *string - - // REQUIRED; Token URI field of the API key (write only) - TokenURI *string +// FilesScanSummary - A summary of the scan results of the files that were scanned. +type FilesScanSummary struct { + // The number of failed file scans. + FailedFilesCount *int64 - // REQUIRED; Type field of the API key (write only) - Type *string + // The number of malicious files that were detected during the scan. + MaliciousFilesCount *int64 - // READ-ONLY; State of the multi-cloud connector - AuthenticationProvisioningState *AuthenticationProvisioningState + // The number of gigabytes of data that were scanned. + ScannedFilesInGB *float64 - // READ-ONLY; The permissions detected in the cloud account. - GrantedPermissions []*PermissionProperty -} + // The number of files that were skipped. + SkippedFilesCount *int64 -// GetAuthenticationDetailsProperties implements the AuthenticationDetailsPropertiesClassification interface for type GcpCredentialsDetailsProperties. -func (g *GcpCredentialsDetailsProperties) GetAuthenticationDetailsProperties() *AuthenticationDetailsProperties { - return &AuthenticationDetailsProperties{ - AuthenticationProvisioningState: g.AuthenticationProvisioningState, - AuthenticationType: g.AuthenticationType, - GrantedPermissions: g.GrantedPermissions, - } + // The total number of files that were scanned. + TotalFilesScanned *int64 } // GcpOrganizationalData - The gcpOrganization data @@ -4107,7 +4175,8 @@ func (g *GcpOrganizationalData) GetGcpOrganizationalData() *GcpOrganizationalDat // GcpOrganizationalDataMember - The gcpOrganization data for the member account type GcpOrganizationalDataMember struct { - // REQUIRED; The multi cloud account's membership type in the organization + // CONSTANT; The multi cloud account's membership type in the organization + // Field has constant value OrganizationMembershipTypeMember, any specified value is ignored. OrganizationMembershipType *OrganizationMembershipType // The GCP management project number from organizational onboarding @@ -4126,7 +4195,8 @@ func (g *GcpOrganizationalDataMember) GetGcpOrganizationalData() *GcpOrganizatio // GcpOrganizationalDataOrganization - The gcpOrganization data for the parent account type GcpOrganizationalDataOrganization struct { - // REQUIRED; The multi cloud account's membership type in the organization + // CONSTANT; The multi cloud account's membership type in the organization + // Field has constant value OrganizationMembershipTypeOrganization, any specified value is ignored. OrganizationMembershipType *OrganizationMembershipType // If the multi cloud account is of membership type organization, list of accounts excluded from offering @@ -4166,7 +4236,8 @@ type GcpProjectDetails struct { // GcpProjectEnvironmentData - The GCP project connector environment data type GcpProjectEnvironmentData struct { - // REQUIRED; The type of the environment data. + // CONSTANT; The type of the environment data. + // Field has constant value EnvironmentTypeGcpProject, any specified value is ignored. EnvironmentType *EnvironmentType // The Gcp project's organizational data @@ -4196,13 +4267,16 @@ type GetSensitivitySettingsResponse struct { // The sensitivity settings properties Properties *GetSensitivitySettingsResponseProperties - // READ-ONLY; The ID of the sensitivity settings + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; The name of the sensitivity settings + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; The type of the sensitivity settings + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -4249,29 +4323,19 @@ type GitHubOwner struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// GitHubOwnerConfiguration - GitHub Owner Inventory Configuration. -type GitHubOwnerConfiguration struct { - // AutoDiscovery states. - AutoDiscovery *AutoDiscovery - - // GitHub Repository Inventory Configuration. Dictionary of GitHub repository name to desired repository configuration. If - // AutoDiscovery is Enabled, this field should be null or empty. - RepositoryConfigs map[string]*BaseResourceConfiguration -} - // GitHubOwnerListResponse - List of RP resources which supports pagination. type GitHubOwnerListResponse struct { - // Gets or sets next link to scroll over the results. + // The link to the next page of items. NextLink *string - // Gets or sets list of resources. + // The GitHubOwner items on this page. Value []*GitHubOwner } @@ -4279,27 +4343,32 @@ type GitHubOwnerListResponse struct { type GitHubOwnerProperties struct { // Details about resource onboarding status across all connectors. // OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level - // resources. Onboarded - this resource has already been onboarded by the - // specified connector. NotOnboarded - this resource has not been onboarded to any connector. NotApplicable - the onboarding - // state is not applicable to the current endpoint. + // resources. + // Onboarded - this resource has already been onboarded by the specified connector. + // NotOnboarded - this resource has not been onboarded to any connector. + // NotApplicable - the onboarding state is not applicable to the current endpoint. OnboardingState *OnboardingState - // The provisioning state of the resource. - // Pending - Provisioning pending. Failed - Provisioning failed. Succeeded - Successful provisioning. Canceled - Provisioning - // canceled. PendingDeletion - Deletion pending. DeletionSuccess - Deletion - // successful. DeletionFailure - Deletion failure. - ProvisioningState *DevOpsProvisioningState - // READ-ONLY; Gets or sets internal GitHub id. GitHubInternalID *string // READ-ONLY; Gets or sets GitHub Owner url. OwnerURL *string - // READ-ONLY; Gets or sets resource status message. + // READ-ONLY; The provisioning state of the resource. + // Pending - Provisioning pending. + // Failed - Provisioning failed. + // Succeeded - Successful provisioning. + // Canceled - Provisioning canceled. + // PendingDeletion - Deletion pending. + // DeletionSuccess - Deletion successful. + // DeletionFailure - Deletion failure. + ProvisioningState *DevOpsProvisioningState + + // READ-ONLY; Gets the resource status message. ProvisioningStatusMessage *string - // READ-ONLY; Gets or sets time when resource was last checked. + // READ-ONLY; Gets the time when resource was last checked. ProvisioningStatusUpdateTimeUTC *time.Time } @@ -4314,7 +4383,7 @@ type GitHubRepository struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -4323,10 +4392,10 @@ type GitHubRepository struct { // GitHubRepositoryListResponse - List of RP resources which supports pagination. type GitHubRepositoryListResponse struct { - // Gets or sets next link to scroll over the results. + // The link to the next page of items. NextLink *string - // Gets or sets list of resources. + // The GitHubRepository items on this page. Value []*GitHubRepository } @@ -4334,34 +4403,43 @@ type GitHubRepositoryListResponse struct { type GitHubRepositoryProperties struct { // Details about resource onboarding status across all connectors. // OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level - // resources. Onboarded - this resource has already been onboarded by the - // specified connector. NotOnboarded - this resource has not been onboarded to any connector. NotApplicable - the onboarding - // state is not applicable to the current endpoint. + // resources. + // Onboarded - this resource has already been onboarded by the specified connector. + // NotOnboarded - this resource has not been onboarded to any connector. + // NotApplicable - the onboarding state is not applicable to the current endpoint. OnboardingState *OnboardingState // Gets or sets parent GitHub Owner name. ParentOwnerName *string - // The provisioning state of the resource. - // Pending - Provisioning pending. Failed - Provisioning failed. Succeeded - Successful provisioning. Canceled - Provisioning - // canceled. PendingDeletion - Deletion pending. DeletionSuccess - Deletion - // successful. DeletionFailure - Deletion failure. + // READ-ONLY; The provisioning state of the resource. + // Pending - Provisioning pending. + // Failed - Provisioning failed. + // Succeeded - Successful provisioning. + // Canceled - Provisioning canceled. + // PendingDeletion - Deletion pending. + // DeletionSuccess - Deletion successful. + // DeletionFailure - Deletion failure. ProvisioningState *DevOpsProvisioningState - // READ-ONLY; Gets or sets resource status message. + // READ-ONLY; Gets the resource status message. ProvisioningStatusMessage *string - // READ-ONLY; Gets or sets time when resource was last checked. + // READ-ONLY; Gets the time when resource was last checked. ProvisioningStatusUpdateTimeUTC *time.Time - // READ-ONLY; Gets or sets GitHub Full Name. Repository name, prefixed with Owner name. Eg: "my-org/new-repo-1". + // READ-ONLY; Gets or sets GitHub Full Name. + // Repository name, prefixed with Owner name. + // Eg: "my-org/new-repo-1". RepoFullName *string // READ-ONLY; Gets or sets GitHub Repository id. - // This is a numeric id defined by Github. Eg: "123456". + // This is a numeric id defined by Github. + // Eg: "123456". RepoID *string - // READ-ONLY; Gets or sets GitHub Repository name. Eg: "new-repo-1". + // READ-ONLY; Gets or sets GitHub Repository name. + // Eg: "new-repo-1". RepoName *string // READ-ONLY; Gets or sets GitHub Repository url. @@ -4379,29 +4457,19 @@ type GitLabGroup struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// GitLabGroupConfiguration - GitLab Group Inventory Configuration. -type GitLabGroupConfiguration struct { - // AutoDiscovery states. - AutoDiscovery *AutoDiscovery - - // GitLab Project Inventory Configuration. Dictionary of GitLab fully-qualified project name to desired project configuration. - // If AutoDiscovery is Enabled, this field should be null or empty. - ProjectConfigs map[string]*BaseResourceConfiguration -} - // GitLabGroupListResponse - List of RP resources which supports pagination. type GitLabGroupListResponse struct { - // Gets or sets next link to scroll over the results. + // The link to the next page of items. NextLink *string - // Gets or sets list of resources. + // The GitLabGroup items on this page. Value []*GitLabGroup } @@ -4409,17 +4477,12 @@ type GitLabGroupListResponse struct { type GitLabGroupProperties struct { // Details about resource onboarding status across all connectors. // OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level - // resources. Onboarded - this resource has already been onboarded by the - // specified connector. NotOnboarded - this resource has not been onboarded to any connector. NotApplicable - the onboarding - // state is not applicable to the current endpoint. + // resources. + // Onboarded - this resource has already been onboarded by the specified connector. + // NotOnboarded - this resource has not been onboarded to any connector. + // NotApplicable - the onboarding state is not applicable to the current endpoint. OnboardingState *OnboardingState - // The provisioning state of the resource. - // Pending - Provisioning pending. Failed - Provisioning failed. Succeeded - Successful provisioning. Canceled - Provisioning - // canceled. PendingDeletion - Deletion pending. DeletionSuccess - Deletion - // successful. DeletionFailure - Deletion failure. - ProvisioningState *DevOpsProvisioningState - // READ-ONLY; Gets or sets the human readable fully-qualified name of the Group object. // This contains the entire namespace hierarchy as seen on GitLab UI where namespaces are separated by the '/' character. FullyQualifiedFriendlyName *string @@ -4428,10 +4491,20 @@ type GitLabGroupProperties struct { // This contains the entire namespace hierarchy where namespaces are separated by the '$' character. FullyQualifiedName *string - // READ-ONLY; Gets or sets resource status message. + // READ-ONLY; The provisioning state of the resource. + // Pending - Provisioning pending. + // Failed - Provisioning failed. + // Succeeded - Successful provisioning. + // Canceled - Provisioning canceled. + // PendingDeletion - Deletion pending. + // DeletionSuccess - Deletion successful. + // DeletionFailure - Deletion failure. + ProvisioningState *DevOpsProvisioningState + + // READ-ONLY; Gets the resource status message. ProvisioningStatusMessage *string - // READ-ONLY; Gets or sets time when resource was last checked. + // READ-ONLY; Gets the time when resource was last checked. ProvisioningStatusUpdateTimeUTC *time.Time // READ-ONLY; Gets or sets the url of the GitLab Group. @@ -4449,7 +4522,7 @@ type GitLabProject struct { // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" @@ -4458,10 +4531,10 @@ type GitLabProject struct { // GitLabProjectListResponse - List of RP resources which supports pagination. type GitLabProjectListResponse struct { - // Gets or sets next link to scroll over the results. + // The link to the next page of items. NextLink *string - // Gets or sets list of resources. + // The GitLabProject items on this page. Value []*GitLabProject } @@ -4469,17 +4542,12 @@ type GitLabProjectListResponse struct { type GitLabProjectProperties struct { // Details about resource onboarding status across all connectors. // OnboardedByOtherConnector - this resource has already been onboarded to another connector. This is only applicable to top-level - // resources. Onboarded - this resource has already been onboarded by the - // specified connector. NotOnboarded - this resource has not been onboarded to any connector. NotApplicable - the onboarding - // state is not applicable to the current endpoint. + // resources. + // Onboarded - this resource has already been onboarded by the specified connector. + // NotOnboarded - this resource has not been onboarded to any connector. + // NotApplicable - the onboarding state is not applicable to the current endpoint. OnboardingState *OnboardingState - // The provisioning state of the resource. - // Pending - Provisioning pending. Failed - Provisioning failed. Succeeded - Successful provisioning. Canceled - Provisioning - // canceled. PendingDeletion - Deletion pending. DeletionSuccess - Deletion - // successful. DeletionFailure - Deletion failure. - ProvisioningState *DevOpsProvisioningState - // READ-ONLY; Gets or sets the human readable fully-qualified name of the Project object. // This contains the entire namespace hierarchy as seen on GitLab UI where entities are separated by the '/' character. FullyQualifiedFriendlyName *string @@ -4492,10 +4560,20 @@ type GitLabProjectProperties struct { // This contains the entire hierarchy where namespaces are separated by the '$' character. FullyQualifiedParentGroupName *string - // READ-ONLY; Gets or sets resource status message. + // READ-ONLY; The provisioning state of the resource. + // Pending - Provisioning pending. + // Failed - Provisioning failed. + // Succeeded - Successful provisioning. + // Canceled - Provisioning canceled. + // PendingDeletion - Deletion pending. + // DeletionSuccess - Deletion successful. + // DeletionFailure - Deletion failure. + ProvisioningState *DevOpsProvisioningState + + // READ-ONLY; Gets the resource status message. ProvisioningStatusMessage *string - // READ-ONLY; Gets or sets time when resource was last checked. + // READ-ONLY; Gets the time when resource was last checked. ProvisioningStatusUpdateTimeUTC *time.Time // READ-ONLY; Gets or sets the url of the GitLab Project. @@ -4504,7 +4582,8 @@ type GitLabProjectProperties struct { // GithubScopeEnvironmentData - The github scope connector's environment data type GithubScopeEnvironmentData struct { - // REQUIRED; The type of the environment data. + // CONSTANT; The type of the environment data. + // Field has constant value EnvironmentTypeGithubScope, any specified value is ignored. EnvironmentType *EnvironmentType } @@ -4517,7 +4596,8 @@ func (g *GithubScopeEnvironmentData) GetEnvironmentData() *EnvironmentData { // GitlabScopeEnvironmentData - The GitLab scope connector's environment data type GitlabScopeEnvironmentData struct { - // REQUIRED; The type of the environment data. + // CONSTANT; The type of the environment data. + // Field has constant value EnvironmentTypeGitlabScope, any specified value is ignored. EnvironmentType *EnvironmentType } @@ -4533,13 +4613,16 @@ type GovernanceAssignment struct { // The properties of a governance assignment Properties *GovernanceAssignmentProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -4578,7 +4661,7 @@ type GovernanceAssignmentProperties struct { // GovernanceAssignmentsList - Page of a governance assignments list type GovernanceAssignmentsList struct { - // READ-ONLY; The URI to fetch the next page + // The URI to fetch the next page NextLink *string // READ-ONLY; Collection of governance assignments in this page @@ -4599,13 +4682,16 @@ type GovernanceRule struct { // Properties of a governance rule Properties *GovernanceRuleProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -4620,7 +4706,7 @@ type GovernanceRuleEmailNotification struct { // GovernanceRuleList - Page of a governance rules list type GovernanceRuleList struct { - // READ-ONLY; The URI to fetch the next page + // The URI to fetch the next page NextLink *string // READ-ONLY; Collection of governance rules in this page @@ -4712,7 +4798,8 @@ type HTTPC2DMessagesNotInAllowedRange struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; The type of the custom alert rule. + // Field has constant value "HttpC2DMessagesNotInAllowedRange", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -4772,7 +4859,8 @@ type HTTPC2DRejectedMessagesNotInAllowedRange struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; The type of the custom alert rule. + // Field has constant value "HttpC2DRejectedMessagesNotInAllowedRange", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -4831,7 +4919,8 @@ type HTTPD2CMessagesNotInAllowedRange struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; The type of the custom alert rule. + // Field has constant value "HttpD2CMessagesNotInAllowedRange", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -4896,13 +4985,16 @@ type HealthReport struct { // Properties of a health report Properties *HealthReportProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -4924,10 +5016,10 @@ type HealthReportProperties struct { Issues []*Issue // The resource details of the health report - ResourceDetails *ResourceDetailsAutoGenerated + ResourceDetails *ResourceDetails // The status of the health report - Status *StatusAutoGenerated + Status *Status // READ-ONLY; Additional data for the given health report, this field can include more details on the resource and the health // scenario. @@ -4936,44 +5028,22 @@ type HealthReportProperties struct { // HealthReportsList - Page of health reports list type HealthReportsList struct { - // READ-ONLY; The URI to fetch the next page + // The link to the next page of items. NextLink *string - // READ-ONLY; Collection of health reports in this page + // READ-ONLY; The HealthReport items on this page. Value []*HealthReport } -// HybridComputeSettingsProperties - Settings for hybrid compute management -type HybridComputeSettingsProperties struct { - // REQUIRED; Whether or not to automatically install Azure Arc (hybrid compute) agents on machines - AutoProvision *AutoProvision - - // For a non-Azure machine that is not connected directly to the internet, specify a proxy server that the non-Azure machine - // can use. - ProxyServer *ProxyServerProperties - - // The location where the metadata of machines will be stored - Region *string - - // The name of the resource group where Arc (Hybrid Compute) connectors are connected. - ResourceGroupName *string - - // An object to access resources that are secured by an Azure AD tenant. - ServicePrincipal *ServicePrincipalProperties - - // READ-ONLY; State of the service principal and its secret - HybridComputeProvisioningState *HybridComputeProvisioningState -} - // Identity for the resource. type Identity struct { - // The identity type. + // FLAG; CONSTANT; The identity type. Type *string - // READ-ONLY; The principal ID of resource identity. + // READ-ONLY; The principal ID of resource identity. The value must be an UUID. PrincipalID *string - // READ-ONLY; The tenant ID of resource. + // READ-ONLY; The tenant ID of resource. The value must be an UUID. TenantID *string } @@ -5009,19 +5079,22 @@ type InformationProtectionPolicy struct { // Information protection policy data Properties *InformationProtectionPolicyProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // InformationProtectionPolicyList - Information protection policies response. type InformationProtectionPolicyList struct { - // List of information protection policies. + // List of information protection policies Value []*InformationProtectionPolicy // READ-ONLY; The URI to fetch the next page. @@ -5067,6 +5140,15 @@ type InformationType struct { RecommendedLabelID *string } +// InventoryList - Model for inventory to be included or excluded from Agentless. +type InventoryList struct { + // Types for inventory kind. + InventoryKind *InventoryKind + + // Gets or sets the value for inventory type. + Value *string +} + // IoTSecurityAggregatedAlert - Security Solution Aggregated Alert information type IoTSecurityAggregatedAlert struct { // IoT Security solution aggregated alert details. @@ -5075,22 +5157,25 @@ type IoTSecurityAggregatedAlert struct { // Resource tags Tags map[string]*string - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // IoTSecurityAggregatedAlertList - List of IoT Security solution aggregated alert data. type IoTSecurityAggregatedAlertList struct { - // REQUIRED; List of aggregated alerts data. + // REQUIRED; The IoTSecurityAggregatedAlert items on this page Value []*IoTSecurityAggregatedAlert - // READ-ONLY; When there is too much alert data for one page, use this URI to fetch the next page. + // The link to the next page of items NextLink *string } @@ -5155,22 +5240,25 @@ type IoTSecurityAggregatedRecommendation struct { // Resource tags Tags map[string]*string - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // IoTSecurityAggregatedRecommendationList - List of IoT Security solution aggregated recommendations. type IoTSecurityAggregatedRecommendationList struct { - // REQUIRED; List of aggregated recommendations data. + // REQUIRED; The IoTSecurityAggregatedRecommendation items on this page Value []*IoTSecurityAggregatedRecommendation - // READ-ONLY; When there is too much alert data for one page, use this URI to fetch the next page. + // The link to the next page of items NextLink *string } @@ -5246,22 +5334,25 @@ type IoTSecuritySolutionAnalyticsModel struct { // Security Solution Aggregated Alert data Properties *IoTSecuritySolutionAnalyticsModelProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // IoTSecuritySolutionAnalyticsModelList - List of Security analytics of your IoT Security solution type IoTSecuritySolutionAnalyticsModelList struct { - // REQUIRED; List of Security analytics of your IoT Security solution + // REQUIRED; The IoTSecuritySolutionAnalyticsModel items on this page Value []*IoTSecuritySolutionAnalyticsModel - // READ-ONLY; When there is too much alert data for one page, use this URI to fetch the next page. + // The link to the next page of items NextLink *string } @@ -5296,25 +5387,25 @@ type IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem struct { // IoTSecuritySolutionModel - IoT Security solution configuration and resource information. type IoTSecuritySolutionModel struct { - // The resource location. + // The geo-location where the resource lives Location *string // Security Solution data Properties *IoTSecuritySolutionProperties - // Resource tags + // Resource tags. Tags map[string]*string - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. SystemData *SystemData - // READ-ONLY; Resource type + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -5356,10 +5447,10 @@ type IoTSecuritySolutionProperties struct { // IoTSecuritySolutionsList - List of IoT Security solutions. type IoTSecuritySolutionsList struct { - // REQUIRED; List of IoT Security solutions + // REQUIRED; The IoTSecuritySolutionModel items on this page Value []*IoTSecuritySolutionModel - // READ-ONLY; The URI to fetch the next page. + // The link to the next page of items NextLink *string } @@ -5400,30 +5491,57 @@ type Issue struct { SecurityValues []*string } +// IssueCreationRequest - The issue creation request model +type IssueCreationRequest struct { + // The security assessment resource id that the issue will be opened based on. + SecurityAssessmentResourceID *string +} + +// JFrogEnvironmentData - The JFrog Artifactory connector environment data +type JFrogEnvironmentData struct { + // CONSTANT; The type of the environment data. + // Field has constant value EnvironmentTypeJFrogArtifactory, any specified value is ignored. + EnvironmentType *EnvironmentType + + // Scan interval in hours (value should be between 1-hour to 24-hours) + ScanInterval *int32 +} + +// GetEnvironmentData implements the EnvironmentDataClassification interface for type JFrogEnvironmentData. +func (j *JFrogEnvironmentData) GetEnvironmentData() *EnvironmentData { + return &EnvironmentData{ + EnvironmentType: j.EnvironmentType, + } +} + type JitNetworkAccessPoliciesList struct { Value []*JitNetworkAccessPolicy - // READ-ONLY; The URI to fetch the next page. + // READ-ONLY NextLink *string } +// JitNetworkAccessPolicy - Concrete proxy resource types can be created by aliasing this type using a specific property type. type JitNetworkAccessPolicy struct { // REQUIRED Properties *JitNetworkAccessPolicyProperties + // READ-ONLY; Location where the resource is stored + Location *string + // Kind of the resource Kind *string - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Location where the resource is stored - Location *string - - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -5450,7 +5568,7 @@ type JitNetworkAccessPolicyInitiateVirtualMachine struct { // REQUIRED; Resource ID of the virtual machine that is linked to this policy ID *string - // REQUIRED; The ports to open for the resource with the id + // REQUIRED; The ports to open for the resource with the `id` Ports []*JitNetworkAccessPolicyInitiatePort } @@ -5514,9 +5632,9 @@ type JitNetworkAccessRequestPort struct { Number *int32 // REQUIRED; The status of the port - Status *Status + Status *StatusEnum - // REQUIRED; A description of why the status has its value + // REQUIRED; A description of why the `status` has its value StatusReason *StatusReason // Mutually exclusive with the "allowedSourceAddressPrefixes" parameter. Should be an IP address or CIDR, for example "192.168.0.3" @@ -5526,7 +5644,7 @@ type JitNetworkAccessRequestPort struct { // Mutually exclusive with the "allowedSourceAddressPrefix" parameter. AllowedSourceAddressPrefixes []*string - // The port which is mapped to this port's number in the Azure Firewall, if applicable + // The port which is mapped to this port's `number` in the Azure Firewall, if applicable MappedPort *int32 } @@ -5538,12 +5656,6 @@ type JitNetworkAccessRequestVirtualMachine struct { Ports []*JitNetworkAccessRequestPort } -// KindAutoGenerated - Describes an Azure resource with kind -type KindAutoGenerated struct { - // Kind of the resource - Kind *string -} - // Label - Microsoft information protection sensitivity label type Label struct { // The ID of the label @@ -5561,7 +5673,7 @@ type ListCustomAlertRule struct { // REQUIRED; Status of the custom alert. IsEnabled *bool - // REQUIRED; The type of the custom alert rule. + // CONSTANT; Field has constant value "ListCustomAlertRule", any specified value is ignored. RuleType *string // READ-ONLY; The description of the custom alert. @@ -5595,7 +5707,7 @@ type LocalUserNotAllowed struct { // REQUIRED; Status of the custom alert. IsEnabled *bool - // REQUIRED; The type of the custom alert rule. + // CONSTANT; Field has constant value "LocalUserNotAllowed", any specified value is ignored. RuleType *string // READ-ONLY; The description of the custom alert. @@ -5641,12 +5753,6 @@ func (l *LocalUserNotAllowed) GetListCustomAlertRule() *ListCustomAlertRule { } } -// Location - Describes an Azure resource with location -type Location struct { - // READ-ONLY; Location where the resource is stored - Location *string -} - // LogAnalyticsIdentifier - Represents a Log Analytics workspace scope identifier. type LogAnalyticsIdentifier struct { // REQUIRED; There can be multiple identifiers of different type per alert, this field specify the identifier type. @@ -5672,8 +5778,39 @@ func (l *LogAnalyticsIdentifier) GetResourceIdentifier() *ResourceIdentifier { } } +// MalwareScan - Describes the state of a malware scan operation. +type MalwareScan struct { + Properties *MalwareScanProperties +} + +type MalwareScanProperties struct { + // The time at which the scan has ended. Only available for a scan which has terminated. + ScanEndTime *string + + // The identifier of the scan. + ScanID *string + + // The time at which the scan had been initiated. + ScanStartTime *string + + // A status code of the scan operation. + ScanStatus *string + + // A description of the status of the scan. + ScanStatusMessage *string + + // A summary of the scan results. + ScanSummary *ScanSummary +} + // MalwareScanningProperties - Properties of Malware Scanning. type MalwareScanningProperties struct { + // Optional. Specifies the automated response action to take when malware is detected. + AutomatedResponse *AutomatedResponseType + + // Optional. Write scan result on BlobIndexTags by default. + BlobScanResultsOptions *BlobScanResultsOptions + // Properties of On Upload malware scanning. OnUpload *OnUploadProperties @@ -5689,13 +5826,16 @@ type MdeOnboardingData struct { // Properties of the MDE configuration or data parameter needed to onboard the machine to MDE Properties *MdeOnboardingDataProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -5727,7 +5867,8 @@ type MqttC2DMessagesNotInAllowedRange struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; The type of the custom alert rule. + // Field has constant value "MqttC2DMessagesNotInAllowedRange", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -5787,7 +5928,8 @@ type MqttC2DRejectedMessagesNotInAllowedRange struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; The type of the custom alert rule. + // Field has constant value "MqttC2DRejectedMessagesNotInAllowedRange", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -5846,7 +5988,8 @@ type MqttD2CMessagesNotInAllowedRange struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; The type of the custom alert rule. + // Field has constant value "MqttD2CMessagesNotInAllowedRange", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -5905,7 +6048,8 @@ func (n *NotificationsSource) GetNotificationsSource() *NotificationsSource { re // NotificationsSourceAlert - Alert notification source type NotificationsSourceAlert struct { - // REQUIRED; The source type that will trigger the notification + // CONSTANT; The source type that will trigger the notification + // Field has constant value SourceTypeAlert, any specified value is ignored. SourceType *SourceType // Defines the minimal alert severity which will be sent as email notifications @@ -5921,7 +6065,8 @@ func (n *NotificationsSourceAlert) GetNotificationsSource() *NotificationsSource // NotificationsSourceAttackPath - Attack path notification source type NotificationsSourceAttackPath struct { - // REQUIRED; The source type that will trigger the notification + // CONSTANT; The source type that will trigger the notification + // Field has constant value SourceTypeAttackPath, any specified value is ignored. SourceType *SourceType // Defines the minimal attach path risk level which will be sent as email notifications @@ -5940,7 +6085,7 @@ type OnPremiseResourceDetails struct { // REQUIRED; The name of the machine MachineName *string - // REQUIRED; The platform where the assessed resource resides + // CONSTANT; Field has constant value SourceOnPremiseResourceDetails, any specified value is ignored. Source *Source // REQUIRED; The oms agent Id installed on the machine @@ -5959,7 +6104,10 @@ func (o *OnPremiseResourceDetails) GetOnPremiseResourceDetails() *OnPremiseResou // GetResourceDetails implements the ResourceDetailsClassification interface for type OnPremiseResourceDetails. func (o *OnPremiseResourceDetails) GetResourceDetails() *ResourceDetails { return &ResourceDetails{ - Source: o.Source, + ConnectorID: o.ConnectorID, + ID: o.ID, + Source: o.Source, + Source: o.Source, } } @@ -5974,7 +6122,8 @@ type OnPremiseSQLResourceDetails struct { // REQUIRED; The Sql server name installed on the machine ServerName *string - // REQUIRED; The platform where the assessed resource resides + // CONSTANT; The platform where the assessed resource resides + // Field has constant value SourceOnPremiseSQL, any specified value is ignored. Source *Source // REQUIRED; The oms agent Id installed on the machine @@ -6001,59 +6150,100 @@ func (o *OnPremiseSQLResourceDetails) GetOnPremiseResourceDetails() *OnPremiseRe // GetResourceDetails implements the ResourceDetailsClassification interface for type OnPremiseSQLResourceDetails. func (o *OnPremiseSQLResourceDetails) GetResourceDetails() *ResourceDetails { return &ResourceDetails{ - Source: o.Source, + ConnectorID: o.ConnectorID, + ID: o.ID, + Source: o.Source, + Source: o.Source, } } +// OnUploadFilters - Optional. Determine which blobs get scanned by On Upload malware scanning. An Or operation is performed +// between each filter type. +type OnUploadFilters struct { + // Optional. Specifies the maximum size in bytes for blobs to be scanned. This parameter accepts a single positive integer + // value. Blobs larger than this value will be excluded from scanning. + ExcludeBlobsLargerThan any + + // Optional. A list of prefixes to exclude from on-upload malware scanning. + // Format: `container-name/blob-name` (start with the container name; do not include the storage account name). + // Exclude entire containers: Use prefix of container names you want to exclude without a trailing `/`. + // Exclude a single container: Add a trailing slash `/` after the container name to avoid excluding other containers with + // similar prefixes. + ExcludeBlobsWithPrefix []*string + + // Optional. A list of suffixes to exclude from on-upload malware scanning. Suffixes match only the end of blob names, and + // should be used for file extensions or blob name endings only. + ExcludeBlobsWithSuffix []*string +} + // OnUploadProperties - Properties of On Upload malware scanning. type OnUploadProperties struct { - // Defines the max GB to be scanned per Month. Set to -1 if no capping is needed. + // Defines the max GB to be scanned per Month. Set to -1 if no capping is needed. If not specified, the default value is -1. CapGBPerMonth *int32 + // Optional. Determine which blobs get scanned by On Upload malware scanning. An Or operation is performed between each filter + // type. + Filters *OnUploadFilters + // Indicates whether On Upload malware scanning should be enabled. IsEnabled *bool } -// Operation - Possible operation in the REST API of Microsoft.Security +// Operation - REST API Operation +// +// Details of a REST API operation, returned from the Resource Provider Operations API type Operation struct { - // Security operation display + // Localized display information for this particular operation. Display *OperationDisplay - // READ-ONLY; Name of the operation + // READ-ONLY; Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + ActionType *ActionType + + // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure + // Resource Manager/control-plane operations. + IsDataAction *bool + + // READ-ONLY; The name of the operation, as per Resource-Based Access Control (RBAC). Examples: "Microsoft.Compute/virtualMachines/write", + // "Microsoft.Compute/virtualMachines/capture/action" Name *string - // READ-ONLY; Where the operation is originated - Origin *string + // READ-ONLY; The intended executor of the operation; as in Resource Based Access Control (RBAC) and audit logs UX. Default + // value is "user,system" + Origin *Origin } -// OperationDisplay - Security operation display +// OperationDisplay - Localized display information for an operation. type OperationDisplay struct { - // READ-ONLY; The description of the operation. + // READ-ONLY; The short, localized friendly description of the operation; suitable for tool tips and detailed views. Description *string - // READ-ONLY; The display name of the security operation. + // READ-ONLY; The concise, localized friendly name for the operation; suitable for dropdowns. E.g. "Create or Update Virtual + // Machine", "Restart Virtual Machine". Operation *string - // READ-ONLY; The resource provider for the operation. + // READ-ONLY; The localized friendly form of the resource provider name, e.g. "Microsoft Monitoring Insights" or "Microsoft + // Compute". Provider *string - // READ-ONLY; The display name of the resource the operation applies to. + // READ-ONLY; The localized friendly name of the resource type related to this operation. E.g. "Virtual Machines" or "Job + // Schedule Collections". Resource *string } -// OperationList - List of possible operations for Microsoft.Security resource provider -type OperationList struct { - // List of Security operations +// OperationListResult - A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to +// get the next set of results. +type OperationListResult struct { + // REQUIRED; The Operation items on this page Value []*Operation - // READ-ONLY; The URI to fetch the next page. + // The link to the next page of items NextLink *string } -// OperationResultAutoGenerated - Long run operation status of governance rule over a given scope -type OperationResultAutoGenerated struct { +// OperationResult - Long run operation status of governance rule over a given scope +type OperationResult struct { // READ-ONLY; The status of the long run operation result of governance rule - Status *OperationResult + Status *OperationResultStatus } // OperationStatus - A status describing the success/failure of the enablement/disablement operation. @@ -6065,15 +6255,6 @@ type OperationStatus struct { Message *string } -// OperationStatusAutoGenerated - A status describing the success/failure of the extension's enablement/disablement operation. -type OperationStatusAutoGenerated struct { - // The operation status code. - Code *Code - - // Additional information regarding the success/failure of the operation. - Message *string -} - // OperationStatusResult - The current status of an async operation. type OperationStatusResult struct { // REQUIRED; Operation status. @@ -6083,7 +6264,7 @@ type OperationStatusResult struct { EndTime *time.Time // If present, details of the operation error. - Error *ErrorDetailAutoGenerated + Error *ErrorDetail // Fully qualified ID for the async operation. ID *string @@ -6095,10 +6276,13 @@ type OperationStatusResult struct { Operations []*OperationStatusResult // Percent of the operation that is complete. - PercentComplete *float32 + PercentComplete *float64 // The start time of the operation. StartTime *time.Time + + // READ-ONLY; Fully qualified ID of the resource against which the original async operation was started. + ResourceID *string } // OperatorList - List of SecurityOperator response. @@ -6112,40 +6296,23 @@ type OperatorResource struct { // Identity for the resource. Identity *Identity - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// PathRecommendation - Represents a path that is recommended to be allowed and its properties -type PathRecommendation struct { - // The recommendation action of the machine or rule - Action *RecommendationAction - - // Whether the application is commonly run on the machine - Common *bool - - // The configuration status of the machines group or machine or rule - ConfigurationStatus *ConfigurationStatus - - // The type of the file (for Linux files - Executable is used) - FileType *FileType - - // The full path of the file, or an identifier of the application - Path *string - - // Represents the publisher information of a process/rule - PublisherInfo *PublisherInfo - - // The type of IoT Security recommendation. - Type *RecommendationType - UserSids []*string - Usernames []*UserRecommendation +// PartialAssessmentProperties - Describes properties of an assessment as related to the standard +type PartialAssessmentProperties struct { + // The assessment key + AssessmentKey *string } // Pricing - Microsoft Defender for Cloud is provided in two pricing tiers: free and standard. The standard tier offers advanced @@ -6154,13 +6321,16 @@ type Pricing struct { // Pricing data Properties *PricingProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -6173,39 +6343,37 @@ type PricingList struct { // PricingProperties - Pricing properties for the relevant scope type PricingProperties struct { // REQUIRED; Indicates whether the Defender plan is enabled on the selected scope. Microsoft Defender for Cloud is provided - // in two pricing tiers: free and standard. The standard tier offers advanced security - // capabilities, while the free tier offers basic security features. + // in two pricing tiers: free and standard. The standard tier offers advanced security capabilities, while the free tier offers + // basic security features. PricingTier *PricingTier // If set to "False", it allows the descendants of this scope to override the pricing configuration set on this scope (allows - // setting inherited="False"). If set to "True", it prevents overrides and - // forces this pricing configuration on all the descendants of this scope. This field is only available for subscription-level - // pricing. + // setting inherited="False"). If set to "True", it prevents overrides and forces this pricing configuration on all the descendants + // of this scope. This field is only available for subscription-level pricing. Enforce *Enforce // Optional. List of extensions offered under a plan. Extensions []*Extension // The sub-plan selected for a Standard pricing configuration, when more than one sub-plan is available. Each sub-plan enables - // a set of security features. When not specified, full plan is applied. For - // VirtualMachines plan, available sub plans are 'P1' & 'P2', where for resource level only 'P1' sub plan is supported. + // a set of security features. When not specified, full plan is applied. For VirtualMachines plan, available sub plans are + // 'P1' & 'P2', where for resource level only 'P1' sub plan is supported. SubPlan *string - // READ-ONLY; Optional. True if the plan is deprecated. If there are replacing plans they will appear in replacedBy property + // READ-ONLY; Optional. True if the plan is deprecated. If there are replacing plans they will appear in `replacedBy` property Deprecated *bool - // READ-ONLY; Optional. If pricingTier is Standard then this property holds the date of the last time the pricingTier was - // set to Standard, when available (e.g 2023-03-01T12:42:42.1921106Z). + // READ-ONLY; Optional. If `pricingTier` is `Standard` then this property holds the date of the last time the `pricingTier` + // was set to `Standard`, when available (e.g 2023-03-01T12:42:42.1921106Z). EnablementTime *time.Time // READ-ONLY; The duration left for the subscriptions free trial period - in ISO 8601 format (e.g. P3Y6M4DT12H30M5S). FreeTrialRemainingTime *string // READ-ONLY; "inherited" = "True" indicates that the current scope inherits its pricing configuration from its parent. The - // ID of the parent scope that provides the inherited configuration is displayed in the - // "inheritedFrom" field. On the other hand, "inherited" = "False" indicates that the current scope has its own pricing configuration - // explicitly set, and does not inherit from its parent. This field is - // read only and available only for resource-level pricing. + // ID of the parent scope that provides the inherited configuration is displayed in the "inheritedFrom" field. On the other + // hand, "inherited" = "False" indicates that the current scope has its own pricing configuration explicitly set, and does + // not inherit from its parent. This field is read only and available only for resource-level pricing. Inherited *Inherited // READ-ONLY; The id of the scope inherited from. "Null" if not inherited. This field is only available for resource-level @@ -6216,13 +6384,174 @@ type PricingProperties struct { ReplacedBy []*string // READ-ONLY; This field is available for subscription-level only, and reflects the coverage status of the resources under - // the subscription. Please note: The "pricingTier" field reflects the plan status of the - // subscription. However, since the plan status can also be defined at the resource level, there might be misalignment between - // the subscription's plan status and the resource status. This field helps - // indicate the coverage status of the resources. + // the subscription. Please note: The "pricingTier" field reflects the plan status of the subscription. However, since the + // plan status can also be defined at the resource level, there might be misalignment between the subscription's plan status + // and the resource status. This field helps indicate the coverage status of the resources. ResourcesCoverageStatus *ResourcesCoverageStatus } +// PrivateEndpoint - The private endpoint resource. +type PrivateEndpoint struct { + // READ-ONLY; The resource identifier of the private endpoint + ID *string +} + +// PrivateEndpointConnection - The private endpoint connection resource. +type PrivateEndpointConnection struct { + // Resource properties. + Properties *PrivateEndpointConnectionProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateEndpointConnectionListResult - The response of a PrivateEndpointConnection list operation. +type PrivateEndpointConnectionListResult struct { + // REQUIRED; The PrivateEndpointConnection items on this page + Value []*PrivateEndpointConnection + + // The link to the next page of items + NextLink *string +} + +// PrivateEndpointConnectionProperties - Properties of the private endpoint connection. +type PrivateEndpointConnectionProperties struct { + // REQUIRED; A collection of information about the state of the connection between service consumer and provider. + PrivateLinkServiceConnectionState *PrivateLinkServiceConnectionState + + // The private endpoint resource. + PrivateEndpoint *PrivateEndpoint + + // READ-ONLY; The group ids for the private endpoint resource. + GroupIDs []*string + + // READ-ONLY; The provisioning state of the private endpoint connection resource. + ProvisioningState *PrivateEndpointConnectionProvisioningState +} + +// PrivateLinkGroupResource - A private link group resource that describes a grouping for the private link. +type PrivateLinkGroupResource struct { + // Resource properties. + Properties *PrivateLinkResourceProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateLinkGroupResourceListResult - The response of a PrivateLinkGroupResource list operation. +type PrivateLinkGroupResourceListResult struct { + // REQUIRED; The PrivateLinkGroupResource items on this page + Value []*PrivateLinkGroupResource + + // The link to the next page of items + NextLink *string +} + +// PrivateLinkProperties - Properties of a private link resource. These properties control the behavior and configuration +// of private endpoint connectivity to Defender services. +type PrivateLinkProperties struct { + // This determines if traffic is allowed over public network. By default it is disabled. + PublicNetworkAccess *PublicNetworkAccess + + // READ-ONLY; List of private endpoint connections associated with this private link. Each connection represents a private + // endpoint from a customer's virtual network. + PrivateEndpointConnections []*PrivateEndpointConnection + + // READ-ONLY; List of private link resources available for connection. For Defender services, this typically includes the + // 'containers' group with 'api' and regional data endpoints. + PrivateLinkResources []*PrivateLinkGroupResource + + // READ-ONLY; The current provisioning state of the private link resource. Indicates whether the resource is being created, + // updated, deleted, or has completed successfully. + ProvisioningState *ProvisioningState +} + +// PrivateLinkResource - A private link resource that enables secure, private connectivity to Microsoft Defender for Cloud +// services. This resource manages the lifecycle of private endpoint connections and provides the necessary infrastructure +// for private connectivity. +type PrivateLinkResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // REQUIRED; Properties specific to the private link resource + Properties *PrivateLinkProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// PrivateLinkResourceProperties - Properties of a private link resource. +type PrivateLinkResourceProperties struct { + // The private link resource private link DNS zone name. + RequiredZoneNames []*string + + // READ-ONLY; The private link resource group id. + GroupID *string + + // READ-ONLY; The private link resource required member names. + RequiredMembers []*string +} + +// PrivateLinkServiceConnectionState - A collection of information about the state of the connection between service consumer +// and provider. +type PrivateLinkServiceConnectionState struct { + // A message indicating if changes on the service provider require any updates on the consumer. + ActionsRequired *string + + // The reason for approval/rejection of the connection. + Description *string + + // Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + Status *PrivateEndpointServiceConnectionStatus +} + +// PrivateLinkUpdate - Request payload for updating a private link resource. Used in PATCH operations to update specific mutable +// properties without affecting the entire resource configuration. +type PrivateLinkUpdate struct { + // Resource tags + Tags map[string]*string +} + +// PrivateLinksList - Paginated list of private link resources. Contains an array of private links and optional pagination +// information. +type PrivateLinksList struct { + // READ-ONLY; The PrivateLinkResource items on this page + Value []*PrivateLinkResource + + // The link to the next page of items + NextLink *string +} + // ProcessNotAllowed - Execution of a process that isn't allowed. Allow list consists of process names to allow. type ProcessNotAllowed struct { // REQUIRED; The values to allow. The format of the values depends on the rule type. @@ -6231,7 +6560,7 @@ type ProcessNotAllowed struct { // REQUIRED; Status of the custom alert. IsEnabled *bool - // REQUIRED; The type of the custom alert rule. + // CONSTANT; Field has constant value "ProcessNotAllowed", any specified value is ignored. RuleType *string // READ-ONLY; The description of the custom alert. @@ -6277,77 +6606,22 @@ func (p *ProcessNotAllowed) GetListCustomAlertRule() *ListCustomAlertRule { } } -// ProtectionMode - The protection mode of the collection/file types. Exe/Msi/Script are used for Windows, Executable is used -// for Linux. -type ProtectionMode struct { - // The application control policy enforcement/protection mode of the machine group - Exe *EnforcementMode - - // The application control policy enforcement/protection mode of the machine group - Executable *EnforcementMode +// QueryCheck - The rule query details. +type QueryCheck struct { + // Column names of expected result. + ColumnNames []*string - // The application control policy enforcement/protection mode of the machine group - Msi *EnforcementMode + // Expected result. + ExpectedResult [][]*string - // The application control policy enforcement/protection mode of the machine group - Script *EnforcementMode + // The rule query. + Query *string } -// ProxyResource - The resource model definition for a Azure Resource Manager proxy resource. It will not have tags and a -// location -type ProxyResource struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} - -// ProxyServerProperties - For a non-Azure machine that is not connected directly to the internet, specify a proxy server -// that the non-Azure machine can use. -type ProxyServerProperties struct { - // Proxy server IP - IP *string - - // Proxy server port - Port *string -} - -// PublisherInfo - Represents the publisher information of a process/rule -type PublisherInfo struct { - // The "OriginalName" field taken from the file's version resource - BinaryName *string - - // The product name taken from the file's version resource - ProductName *string - - // The Subject field of the x.509 certificate used to sign the code, using the following fields - O = Organization, L = Locality, - // S = State or Province, and C = Country - PublisherName *string - - // The binary file version taken from the file's version resource - Version *string -} - -// QueryCheck - The rule query details. -type QueryCheck struct { - // Column names of expected result. - ColumnNames []*string - - // Expected result. - ExpectedResult [][]*string - - // The rule query. - Query *string -} - -// QueuePurgesNotInAllowedRange - Number of device queue purges is not in allowed range. -type QueuePurgesNotInAllowedRange struct { - // REQUIRED; Status of the custom alert. - IsEnabled *bool +// QueuePurgesNotInAllowedRange - Number of device queue purges is not in allowed range. +type QueuePurgesNotInAllowedRange struct { + // REQUIRED; Status of the custom alert. + IsEnabled *bool // REQUIRED; The maximum threshold. MaxThreshold *int32 @@ -6355,7 +6629,8 @@ type QueuePurgesNotInAllowedRange struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; The type of the custom alert rule. + // Field has constant value "QueuePurgesNotInAllowedRange", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -6420,22 +6695,25 @@ type RegulatoryComplianceAssessment struct { // Regulatory compliance assessment data Properties *RegulatoryComplianceAssessmentProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // RegulatoryComplianceAssessmentList - List of regulatory compliance assessment response type RegulatoryComplianceAssessmentList struct { - // REQUIRED + // REQUIRED; The RegulatoryComplianceAssessment items on this page Value []*RegulatoryComplianceAssessment - // READ-ONLY; The URI to fetch the next page. + // The link to the next page of items NextLink *string } @@ -6471,22 +6749,25 @@ type RegulatoryComplianceControl struct { // Regulatory compliance control data Properties *RegulatoryComplianceControlProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // RegulatoryComplianceControlList - List of regulatory compliance controls response type RegulatoryComplianceControlList struct { - // REQUIRED; List of regulatory compliance controls + // REQUIRED; The RegulatoryComplianceControl items on this page Value []*RegulatoryComplianceControl - // READ-ONLY; The URI to fetch the next page. + // The link to the next page of items NextLink *string } @@ -6513,22 +6794,25 @@ type RegulatoryComplianceStandard struct { // Regulatory compliance standard data Properties *RegulatoryComplianceStandardProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // RegulatoryComplianceStandardList - List of regulatory compliance standards response type RegulatoryComplianceStandardList struct { - // REQUIRED + // REQUIRED; The RegulatoryComplianceStandard items on this page Value []*RegulatoryComplianceStandard - // READ-ONLY; The URI to fetch the next page. + // The link to the next page of items NextLink *string } @@ -6574,63 +6858,33 @@ type RemediationEta struct { Justification *string } -// Resource - Describes an Azure resource. -type Resource struct { - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// ResourceAutoGenerated - Common fields that are returned in the response for all Azure Resource Manager resources -type ResourceAutoGenerated struct { - // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} - ID *string +// ResourceDetails - The resource details of the health report +type ResourceDetails struct { + // REQUIRED; REQUIRED; The platform where the assessed resource resides + Source *Source - // READ-ONLY; The name of the resource - Name *string + // The status of the health report + Source *Source - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string -} + // READ-ONLY; READ-ONLY; The id of the connector + ConnectorID *string -// ResourceAutoGenerated2 - Common fields that are returned in the response for all Azure Resource Manager resources -type ResourceAutoGenerated2 struct { - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // READ-ONLY; READ-ONLY; The azure id of the resource ID *string - - // READ-ONLY; The name of the resource - Name *string - - // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. - SystemData *SystemData - - // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" - Type *string } -// ResourceDetails - Details of the resource that was assessed +// ResourceDetails - The resource details of the health report type ResourceDetails struct { - // REQUIRED; The platform where the assessed resource resides + // REQUIRED; REQUIRED; The platform where the assessed resource resides Source *Source -} -// GetResourceDetails implements the ResourceDetailsClassification interface for type ResourceDetails. -func (r *ResourceDetails) GetResourceDetails() *ResourceDetails { return r } - -// ResourceDetailsAutoGenerated - The resource details of the health report -type ResourceDetailsAutoGenerated struct { // The status of the health report Source *Source - // READ-ONLY; The id of the connector + // READ-ONLY; READ-ONLY; The id of the connector ConnectorID *string - // READ-ONLY; The azure id of the resource + // READ-ONLY; READ-ONLY; The azure id of the resource ID *string } @@ -6644,37 +6898,21 @@ type ResourceIdentifier struct { // GetResourceIdentifier implements the ResourceIdentifierClassification interface for type ResourceIdentifier. func (r *ResourceIdentifier) GetResourceIdentifier() *ResourceIdentifier { return r } -// Rule - Describes remote addresses that is recommended to communicate with the Azure resource on some (Protocol, Port, Direction). -// All other remote addresses are recommended to be blocked -type Rule struct { - // The rule's destination port - DestinationPort *int32 - - // The rule's direction - Direction *Direction - - // The remote IP addresses that should be able to communicate with the Azure resource on the rule's destination port and protocol - IPAddresses []*string - - // The name of the rule - Name *string - - // The rule's transport protocols - Protocols []*TransportProtocol -} - // RuleResults - Rule results. type RuleResults struct { // Rule results properties. Properties *RuleResultsProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -6683,18 +6921,24 @@ type RuleResultsInput struct { // Take results from latest scan. LatestScan *bool - // Expected results to be inserted into the baseline. Leave this field empty it LatestScan == true. + // Expected results to be inserted into the baseline. + // Leave this field empty if latestScan == true. Results [][]*string } // RuleResultsProperties - Rule results properties. type RuleResultsProperties struct { + // Take results from latest scan. + LatestScan *bool + // Expected results in the baseline. Results [][]*string } // RulesResults - A list of rules results. type RulesResults struct { + NextLink *string + // List of rule results. Value []*RuleResults } @@ -6704,7 +6948,8 @@ type RulesResultsInput struct { // Take results from latest scan. LatestScan *bool - // Expected results to be inserted into the baseline. Leave this field empty it LatestScan == true. + // Expected results to be inserted into the baseline. + // Leave this field empty if latestScan == true. Results map[string][][]*string } @@ -6727,23 +6972,64 @@ func (s *SQLServerVulnerabilityProperties) GetAdditionalData() *AdditionalData { } } -// Scan - A vulnerability assessment scan record. -type Scan struct { - // A vulnerability assessment scan record properties. - Properties *ScanProperties +// SQLVulnerabilityAssessmentScanOperationResult - Represents the result of a SQL Vulnerability Assessment scan operation, +// wrapped in the ARM resource envelope. +type SQLVulnerabilityAssessmentScanOperationResult struct { + // Represents the properties of a SQL Vulnerability Assessment scan operation result. + Properties *SQLVulnerabilityAssessmentScanOperationResultProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } -// ScanProperties - A vulnerability assessment scan record properties. -type ScanProperties struct { +// SQLVulnerabilityAssessmentScanOperationResultProperties - Represents the properties of a SQL Vulnerability Assessment scan +// operation result. +type SQLVulnerabilityAssessmentScanOperationResultProperties struct { + // Gets or sets the operation id. + OperationID *string + + // The scan operation status. + ScanStatus *ScanOperationStatus +} + +// SQLVulnerabilityAssessmentSettings - SQL Vulnerability Assessment settings resource. +type SQLVulnerabilityAssessmentSettings struct { + // SQL Vulnerability Assessment settings properties. + Properties *SQLVulnerabilityAssessmentSettingsProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// SQLVulnerabilityAssessmentSettingsProperties - SQL Vulnerability Assessment settings properties. +type SQLVulnerabilityAssessmentSettingsProperties struct { + // Represents the state of a SQL Vulnerability Assessment. + State *SQLVulnerabilityAssessmentState + + // READ-ONLY; The creation time of the SQL Vulnerability Assessment settings. + CreationTime *time.Time +} + +// ScanPropertiesV2 - A vulnerability assessment scan record properties. +type ScanPropertiesV2 struct { // The database name. Database *string @@ -6795,13 +7081,16 @@ type ScanResult struct { // A vulnerability assessment scan result properties for a single rule. Properties *ScanResultProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -6810,7 +7099,7 @@ type ScanResultProperties struct { // The rule result adjusted with baseline. BaselineAdjustedResult *BaselineAdjustedResult - // Indicated whether the results specified here are trimmed. + // Indicates whether the results specified here are trimmed. IsTrimmed *bool // The results of the query that was run. @@ -6831,19 +7120,52 @@ type ScanResultProperties struct { // ScanResults - A list of vulnerability assessment scan results. type ScanResults struct { + NextLink *string + // List of vulnerability assessment scan results. Value []*ScanResult } -// Scans - A list of vulnerability assessment scan records. -type Scans struct { +// ScanSummary - A summary of the scan results. +type ScanSummary struct { + // A summary of the scan results of the blobs that were scanned. + Blobs *BlobsScanSummary + + // The estimated cost of the scan. Only available for a scan which has terminated. + EstimatedScanCostUSD *float64 + + // A summary of the scan results of the files that were scanned. + Files *FilesScanSummary +} + +// ScanV2 - A vulnerability assessment scan record. +type ScanV2 struct { + // A vulnerability assessment scan record properties. + Properties *ScanPropertiesV2 + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// ScansV2 - A list of vulnerability assessment scan records. +type ScansV2 struct { + NextLink *string + // List of vulnerability assessment scan records. - Value []*Scan + Value []*ScanV2 } // ScopeElement - A more specific scope used to identify the alerts to suppress. type ScopeElement struct { - // OPTIONAL; Contains additional key/value pairs not defined in the schema. AdditionalProperties map[string]any // The alert entity type to suppress by. @@ -6867,13 +7189,16 @@ type SecureScoreControlDefinitionItem struct { // Security Control Definition Properties. Properties *SecureScoreControlDefinitionItemProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -6897,10 +7222,10 @@ type SecureScoreControlDefinitionItemProperties struct { // SecureScoreControlDefinitionList - List of security controls definition type SecureScoreControlDefinitionList struct { - // READ-ONLY; The URI to fetch the next page. + // The URL to get the next page of results. NextLink *string - // READ-ONLY; Collection of security controls definition in this page + // READ-ONLY; Collection of security control definitions. Value []*SecureScoreControlDefinitionItem } @@ -6915,43 +7240,36 @@ type SecureScoreControlDetails struct { // Calculation result data in control level Properties *SecureScoreControlScoreDetails - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // SecureScoreControlList - List of security controls type SecureScoreControlList struct { - // READ-ONLY; The URI to fetch the next page. + // The URI to fetch the next page. NextLink *string // READ-ONLY; Collection of security controls in this page Value []*SecureScoreControlDetails } -// SecureScoreControlScore - Calculation result data -type SecureScoreControlScore struct { - // READ-ONLY; Actual score for the control = (achieved points / total points) * max score. if total points is zeroed, the - // return number is 0.00 - Current *float64 - - // READ-ONLY; Maximum control score (0..10) - Max *int32 - - // READ-ONLY; Ratio of the current score divided by the maximum. Rounded to 4 digits after the decimal point - Percentage *float64 -} - // SecureScoreControlScoreDetails - Calculation result data in control level type SecureScoreControlScoreDetails struct { // Information about the security control. Definition *SecureScoreControlDefinitionItem + // Actual score object for the control + Score *ScoreDetails + // READ-ONLY; User friendly display name of the control DisplayName *string @@ -6961,9 +7279,6 @@ type SecureScoreControlScoreDetails struct { // READ-ONLY; Number of not applicable resources in the control NotApplicableResourceCount *int32 - // READ-ONLY; Actual score object for the control - Score *ScoreDetails - // READ-ONLY; Number of unhealthy resources in the control UnhealthyResourceCount *int32 @@ -6974,22 +7289,25 @@ type SecureScoreControlScoreDetails struct { // SecureScoreItem - Secure score item data model type SecureScoreItem struct { - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string // READ-ONLY; Secure score item Properties *SecureScoreItemProperties - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // SecureScoreItemProperties - Describes properties of a calculated secure score. type SecureScoreItemProperties struct { - // READ-ONLY; The initiative’s name + // READ-ONLY; The initiative's name DisplayName *string // READ-ONLY; score object @@ -7001,7 +7319,7 @@ type SecureScoreItemProperties struct { // SecureScoresList - List of secure scores type SecureScoresList struct { - // READ-ONLY; The URI to fetch the next page. + // The URI to fetch the next page. NextLink *string // READ-ONLY; Collection of secure scores in this page @@ -7040,13 +7358,16 @@ type ServerVulnerabilityAssessment struct { // describes ServerVulnerabilityAssessment properties. Properties *ServerVulnerabilityAssessmentProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -7073,7 +7394,10 @@ type ServerVulnerabilityAssessmentsSetting struct { // REQUIRED; The kind of the server vulnerability assessments setting. Kind *ServerVulnerabilityAssessmentsSettingKind - // READ-ONLY; Fully qualified resource ID for the resource. E.g. "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}" + // The resource-specific properties for this resource. + Properties *ServerVulnerabilityAssessmentsSettingProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; The name of the resource @@ -7092,12 +7416,15 @@ func (s *ServerVulnerabilityAssessmentsSetting) GetServerVulnerabilityAssessment return s } +type ServerVulnerabilityAssessmentsSettingProperties struct { +} + // ServerVulnerabilityAssessmentsSettingsList - A page of a server vulnerability assessments settings list type ServerVulnerabilityAssessmentsSettingsList struct { - // READ-ONLY; The URI to fetch the next page + // The link to the next page of items. NextLink *string - // READ-ONLY; A collection of server vulnerability assessments settings in this page + // READ-ONLY; The ServerVulnerabilityAssessmentsSetting items on this page. Value []ServerVulnerabilityAssessmentsSettingClassification } @@ -7135,116 +7462,66 @@ func (s *ServerVulnerabilityProperties) GetAdditionalData() *AdditionalData { } } -// ServicePrincipalProperties - Details of the service principal. -type ServicePrincipalProperties struct { - // Application ID of service principal. - ApplicationID *string - - // A secret string that the application uses to prove its identity, also can be referred to as application password (write - // only). - Secret *string -} - // Setting - The kind of the security setting type Setting struct { // REQUIRED; the kind of the settings string Kind *SettingKind - // READ-ONLY; Resource Id + // The resource-specific properties for this resource. + Properties *SettingProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // GetSetting implements the SettingClassification interface for type Setting. func (s *Setting) GetSetting() *Setting { return s } +type SettingProperties struct { +} + // SettingsList - Subscription settings list. type SettingsList struct { - // The settings list. - Value []SettingClassification - - // READ-ONLY; The URI to fetch the next page. + // The URI to fetch the next page. NextLink *string -} - -// Software - Represents a software data -type Software struct { - // REQUIRED; Properties of the Software Inventory resource - Properties *SoftwareProperties - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - -// SoftwareProperties - Software Inventory resource properties -type SoftwareProperties struct { - // Unique identifier for the virtual machine in the service. - DeviceID *string - - // The end of support date in case the product is upcoming end of support. - EndOfSupportDate *string - // End of support status. - EndOfSupportStatus *EndOfSupportStatus - - // First time that the software was seen in the device. - FirstSeenAt *string - - // Number of weaknesses. - NumberOfKnownVulnerabilities *int32 - - // Platform of the operating system running on the device. - OSPlatform *string - - // Name of the software product. - SoftwareName *string - - // Name of the software vendor. - Vendor *string - - // Version number of the software product. - Version *string -} - -// SoftwaresList - Represents the software inventory of the virtual machine. -type SoftwaresList struct { - Value []*Software - - // READ-ONLY; The URI to fetch the next page. - NextLink *string + // The settings list. + Value []SettingClassification } +// Solution - Concrete proxy resource types can be created by aliasing this type using a specific property type. type Solution struct { Properties *SolutionProperties - // READ-ONLY; Resource Id - ID *string - // READ-ONLY; Location where the resource is stored Location *string - // READ-ONLY; Resource name + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } type SolutionList struct { Value []*Solution - // READ-ONLY; The URI to fetch the next page. + // READ-ONLY NextLink *string } @@ -7266,16 +7543,19 @@ type SolutionsReferenceData struct { // REQUIRED Properties *SolutionsReferenceDataProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string // READ-ONLY; Location where the resource is stored Location *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -7306,8 +7586,207 @@ type SolutionsReferenceDataProperties struct { Template *string } -// StatusAutoGenerated - The status of the health report -type StatusAutoGenerated struct { +// Standard - Security Standard on a resource +type Standard struct { + // Entity tag is used for comparing two or more entities from the same requested resource. + Etag *string + + // Kind of the resource + Kind *string + + // The geo-location where the resource lives + Location *string + + // Properties of a security standard + Properties *StandardProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// StandardAssignment - Security Assignment on a resource group over a given scope +type StandardAssignment struct { + // Properties of a standard assignments assignment + Properties *StandardAssignmentProperties + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// StandardAssignmentMetadata - The standard assignment metadata +type StandardAssignmentMetadata struct { + // READ-ONLY; Standard assignment Created by object id (GUID) + CreatedBy *string + + // READ-ONLY; Standard assignment creation date + CreatedOn *time.Time + + // READ-ONLY; Standard assignment last updated by object id (GUID) + LastUpdatedBy *string + + // READ-ONLY; Standard assignment last update date + LastUpdatedOn *time.Time +} + +// StandardAssignmentProperties - Describes the properties of a standardAssignment +type StandardAssignmentProperties struct { + // Standard item with key as applied to this standard assignment over the given scope + AssignedStandard *AssignedStandardItem + + // Additional data about assignment that has Attest effect + AttestationData *StandardAssignmentPropertiesAttestationData + + // Description of the standardAssignment + Description *string + + // Display name of the standardAssignment + DisplayName *string + + // Expected effect of this assignment (Audit/Exempt/Attest) + Effect *Effect + + // Excluded scopes, filter out the descendants of the scope (on management scopes) + ExcludedScopes []*string + + // Additional data about assignment that has Exempt effect + ExemptionData *StandardAssignmentPropertiesExemptionData + + // Expiration date of this assignment as a full ISO date + ExpiresOn *time.Time + + // The standard assignment metadata. + Metadata *StandardAssignmentMetadata +} + +// StandardAssignmentPropertiesAttestationData - Additional data about assignment that has Attest effect +type StandardAssignmentPropertiesAttestationData struct { + // Component item with key as applied to this standard assignment over the given scope + AssignedAssessment *AssignedAssessmentItem + + // Attest category of this assignment + ComplianceState *AttestationComplianceState + + // Array of links to attestation evidence + Evidence []*AttestationEvidence + + // READ-ONLY; Attestation compliance date + ComplianceDate *time.Time +} + +// StandardAssignmentPropertiesExemptionData - Additional data about assignment that has Exempt effect +type StandardAssignmentPropertiesExemptionData struct { + // Component item with key as applied to this standard assignment over the given scope + AssignedAssessment *AssignedAssessmentItem + + // Exemption category of this assignment + ExemptionCategory *ExemptionCategory +} + +// StandardAssignmentsList - Page of a standard assignment list +type StandardAssignmentsList struct { + // READ-ONLY; Collection of standardAssignments in this page + Value []*StandardAssignment + + // READ-ONLY; The URI to fetch the next page + NextLink *string +} + +// StandardComponentProperties - Describes properties of an component as related to the standard +type StandardComponentProperties struct { + // Component Key matching componentMetadata + Key *string +} + +// StandardList - Page of a Standard list +type StandardList struct { + // READ-ONLY; READ-ONLY; Collection of standards in this page + Value []*ArmSecurityStandard + + // READ-ONLY; READ-ONLY; The URI to fetch the next page + NextLink *string + + // READ-ONLY; READ-ONLY; The URI to fetch the next page + NextLink *string + + // READ-ONLY; READ-ONLY; Collection of standards in this page + Value []*Standard +} + +// StandardList - Page of a Standard list +type StandardList struct { + // READ-ONLY; READ-ONLY; Collection of standards in this page + Value []*ArmSecurityStandard + + // READ-ONLY; READ-ONLY; The URI to fetch the next page + NextLink *string + + // READ-ONLY; READ-ONLY; The URI to fetch the next page + NextLink *string + + // READ-ONLY; READ-ONLY; Collection of standards in this page + Value []*Standard +} + +// StandardMetadata - The standard metadata +type StandardMetadata struct { + // READ-ONLY; Standard Created by object id (GUID) + CreatedBy *string + + // READ-ONLY; Standard creation date + CreatedOn *time.Time + + // READ-ONLY; Standard last updated by object id (GUID) + LastUpdatedBy *string + + // READ-ONLY; Standard last update date + LastUpdatedOn *time.Time +} + +// StandardProperties - Describes properties of a standard. +type StandardProperties struct { + // category of the standard provided + Category *string + + // List of component objects containing component unique keys (such as assessment keys) to apply to standard scope. Currently + // only supports assessment keys. + Components []*StandardComponentProperties + + // description of the standard + Description *string + + // display name of the standard, equivalent to the standardId + DisplayName *string + + // List of all standard supported clouds. + SupportedClouds []*StandardSupportedClouds + + // READ-ONLY; standard type (Custom or BuiltIn only currently) + StandardType *string +} + +// Status - The status of the health report +type Status struct { // The status of the health report Code *StatusName @@ -7329,13 +7808,16 @@ type SubAssessment struct { // Describes properties of an sub-assessment. Properties *SubAssessmentProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -7344,7 +7826,7 @@ type SubAssessmentList struct { // READ-ONLY; The URI to fetch the next page. NextLink *string - // READ-ONLY + // READ-ONLY; List of security sub-assessments Value []*SubAssessment } @@ -7422,23 +7904,11 @@ type SystemData struct { LastModifiedByType *CreatedByType } -// Tags - A list of key value pairs that describe the resource. -type Tags struct { - // A list of key value pairs that describe the resource. - Tags map[string]*string -} - -// TagsResource - A container holding only the Tags for a resource, allowing the user to update the tags. -type TagsResource struct { - // Resource tags - Tags map[string]*string -} - // TargetBranchConfiguration - Repository branch configuration for PR Annotations. type TargetBranchConfiguration struct { // Configuration of PR Annotations on default branch. - // Enabled - PR Annotations are enabled on the resource's default branch. Disabled - PR Annotations are disabled on the resource's - // default branch. + // Enabled - PR Annotations are enabled on the resource's default branch. + // Disabled - PR Annotations are disabled on the resource's default branch. AnnotateDefaultBranch *AnnotateDefaultBranchState // Gets or sets branches that should have annotations. @@ -7450,13 +7920,16 @@ type Task struct { // Describes properties of a task. Properties *TaskProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -7465,13 +7938,12 @@ type TaskList struct { // READ-ONLY; The URI to fetch the next page. NextLink *string - // READ-ONLY + // READ-ONLY; The SecurityTask items on this page Value []*Task } // TaskParameters - Changing set of properties, depending on the task type that is derived from the name field type TaskParameters struct { - // OPTIONAL; Contains additional key/value pairs not defined in the schema. AdditionalProperties map[string]any // READ-ONLY; Name of the task type @@ -7508,7 +7980,7 @@ type ThresholdCustomAlertRule struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; Field has constant value "ThresholdCustomAlertRule", any specified value is ignored. RuleType *string // READ-ONLY; The description of the custom alert. @@ -7543,7 +8015,7 @@ type TimeWindowCustomAlertRule struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; Field has constant value "TimeWindowCustomAlertRule", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -7584,27 +8056,31 @@ func (t *TimeWindowCustomAlertRule) GetTimeWindowCustomAlertRule() *TimeWindowCu } type TopologyList struct { - // READ-ONLY; The URI to fetch the next page. + // READ-ONLY NextLink *string // READ-ONLY Value []*TopologyResource } +// TopologyResource - Concrete proxy resource types can be created by aliasing this type using a specific property type. type TopologyResource struct { - // READ-ONLY; Resource Id - ID *string - // READ-ONLY; Location where the resource is stored Location *string - // READ-ONLY; Resource name + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource Name *string // READ-ONLY Properties *TopologyResourceProperties - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } @@ -7652,30 +8128,6 @@ type TopologySingleResourceParent struct { ResourceID *string } -// TrackedResource - Describes an Azure tracked resource. -type TrackedResource struct { - // Entity tag is used for comparing two or more entities from the same requested resource. - Etag *string - - // Kind of the resource - Kind *string - - // Location where the resource is stored - Location *string - - // A list of key value pairs that describe the resource. - Tags map[string]*string - - // READ-ONLY; Resource Id - ID *string - - // READ-ONLY; Resource name - Name *string - - // READ-ONLY; Resource type - Type *string -} - // TwinUpdatesNotInAllowedRange - Number of twin updates is not in allowed range. type TwinUpdatesNotInAllowedRange struct { // REQUIRED; Status of the custom alert. @@ -7687,7 +8139,8 @@ type TwinUpdatesNotInAllowedRange struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; The type of the custom alert rule. + // Field has constant value "TwinUpdatesNotInAllowedRange", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -7746,7 +8199,8 @@ type UnauthorizedOperationsNotInAllowedRange struct { // REQUIRED; The minimum threshold. MinThreshold *int32 - // REQUIRED; The type of the custom alert rule. + // CONSTANT; The type of the custom alert rule. + // Field has constant value "UnauthorizedOperationsNotInAllowedRange", any specified value is ignored. RuleType *string // REQUIRED; The time window size in iso8601 format. @@ -7834,51 +8288,6 @@ type UserDefinedResourcesProperties struct { QuerySubscriptions []*string } -// UserRecommendation - Represents a user that is recommended to be allowed for a certain rule -type UserRecommendation struct { - // The recommendation action of the machine or rule - RecommendationAction *RecommendationAction - - // Represents a user that is recommended to be allowed for a certain rule - Username *string -} - -// VMRecommendation - Represents a machine that is part of a machine group -type VMRecommendation struct { - // The configuration status of the machines group or machine or rule - ConfigurationStatus *ConfigurationStatus - - // The machine supportability of Enforce feature - EnforcementSupport *EnforcementSupport - - // The recommendation action of the machine or rule - RecommendationAction *RecommendationAction - - // The full resource id of the machine - ResourceID *string -} - -// VMScannersAws - A VM scanning configuration for a security offering of a Aws environment -type VMScannersAws struct { - // The cloud role ARN in AWS for this feature - CloudRoleArn *string - - // Configuration for VM scanning - Configuration *VMScannersBaseConfiguration - - // Is VM scanning enabled - Enabled *bool -} - -// VMScannersBase - A VM scanning configuration for a security offering of a given environment -type VMScannersBase struct { - // Configuration for VM scanning - Configuration *VMScannersBaseConfiguration - - // Is VM scanning enabled - Enabled *bool -} - // VMScannersBaseConfiguration - Configuration for VM scanning type VMScannersBaseConfiguration struct { // Tags that indicates that a resource should not be scanned @@ -7888,15 +8297,6 @@ type VMScannersBaseConfiguration struct { ScanningMode *ScanningMode } -// VMScannersGcp - A VM scanning configuration for a security offering of a GCP environment -type VMScannersGcp struct { - // Configuration for VM scanning - Configuration *VMScannersBaseConfiguration - - // Is VM scanning enabled - Enabled *bool -} - // VaRule - vulnerability assessment rule metadata details. type VaRule struct { // The benchmark references. @@ -7941,22 +8341,25 @@ type WorkspaceSetting struct { // Workspace setting data Properties *WorkspaceSettingProperties - // READ-ONLY; Resource Id + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string - // READ-ONLY; Resource name + // READ-ONLY; The name of the resource Name *string - // READ-ONLY; Resource type + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string } // WorkspaceSettingList - List of workspace settings response type WorkspaceSettingList struct { - // REQUIRED; List of workspace settings + // REQUIRED; The WorkspaceSetting items on this page Value []*WorkspaceSetting - // READ-ONLY; The URI to fetch the next page. + // The link to the next page of items NextLink *string } diff --git a/sdk/resourcemanager/security/armsecurity/models_serde.go b/sdk/resourcemanager/security/armsecurity/models_serde.go index ccd493321a85..8b89c7746204 100644 --- a/sdk/resourcemanager/security/armsecurity/models_serde.go +++ b/sdk/resourcemanager/security/armsecurity/models_serde.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -10,37 +9,11 @@ import ( "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" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime/datetime" "reflect" + "time" ) -// MarshalJSON implements the json.Marshaller interface for type AADConnectivityStateAutoGenerated. -func (a AADConnectivityStateAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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]any) @@ -49,6 +22,7 @@ func (a AADExternalSecuritySolution) MarshalJSON() ([]byte, error) { populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } @@ -77,6 +51,9 @@ func (a *AADExternalSecuritySolution) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) @@ -148,6 +125,7 @@ func (a APICollection) MarshalJSON() ([]byte, error) { populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } @@ -170,6 +148,9 @@ func (a *APICollection) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) @@ -275,6 +256,41 @@ func (a *APICollectionProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type AccessTokenAuthentication. +func (a AccessTokenAuthentication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "accessToken", a.AccessToken) + objectMap["authenticationType"] = AuthenticationTypeAccessToken + populate(objectMap, "username", a.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AccessTokenAuthentication. +func (a *AccessTokenAuthentication) UnmarshalJSON(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 "accessToken": + err = unpopulate(val, "AccessToken", &a.AccessToken) + delete(rawMsg, key) + case "authenticationType": + err = unpopulate(val, "AuthenticationType", &a.AuthenticationType) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &a.Username) + 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 ActionableRemediation. func (a ActionableRemediation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -365,19 +381,15 @@ func (a *ActiveConnectionsNotInAllowedRange) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AdaptiveApplicationControlGroup. -func (a AdaptiveApplicationControlGroup) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AdditionalData. +func (a AdditionalData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - 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) + populate(objectMap, "assessedResourceType", a.AssessedResourceType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveApplicationControlGroup. -func (a *AdaptiveApplicationControlGroup) UnmarshalJSON(data []byte) error { +// 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) @@ -385,20 +397,8 @@ func (a *AdaptiveApplicationControlGroup) UnmarshalJSON(data []byte) error { 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) + case "assessedResourceType": + err = unpopulate(val, "AssessedResourceType", &a.AssessedResourceType) delete(rawMsg, key) } if err != nil { @@ -408,22 +408,17 @@ func (a *AdaptiveApplicationControlGroup) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AdaptiveApplicationControlGroupData. -func (a AdaptiveApplicationControlGroupData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AdditionalWorkspacesProperties. +func (a AdditionalWorkspacesProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - 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) + 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 AdaptiveApplicationControlGroupData. -func (a *AdaptiveApplicationControlGroupData) UnmarshalJSON(data []byte) error { +// 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) @@ -431,56 +426,14 @@ func (a *AdaptiveApplicationControlGroupData) UnmarshalJSON(data []byte) error { 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) + case "dataTypes": + err = unpopulate(val, "DataTypes", &a.DataTypes) delete(rawMsg, key) - case "vmRecommendations": - err = unpopulate(val, "VMRecommendations", &a.VMRecommendations) + 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 AdaptiveApplicationControlGroups. -func (a AdaptiveApplicationControlGroups) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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) + case "workspace": + err = unpopulate(val, "Workspace", &a.Workspace) delete(rawMsg, key) } if err != nil { @@ -490,16 +443,15 @@ func (a *AdaptiveApplicationControlGroups) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AdaptiveApplicationControlIssueSummary. -func (a AdaptiveApplicationControlIssueSummary) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AdvancedThreatProtectionProperties. +func (a AdvancedThreatProtectionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "issue", a.Issue) - populate(objectMap, "numberOfVms", a.NumberOfVMs) + populate(objectMap, "isEnabled", a.IsEnabled) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveApplicationControlIssueSummary. -func (a *AdaptiveApplicationControlIssueSummary) UnmarshalJSON(data []byte) error { +// 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) @@ -507,11 +459,8 @@ func (a *AdaptiveApplicationControlIssueSummary) UnmarshalJSON(data []byte) erro 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) + case "isEnabled": + err = unpopulate(val, "IsEnabled", &a.IsEnabled) delete(rawMsg, key) } if err != nil { @@ -521,18 +470,19 @@ func (a *AdaptiveApplicationControlIssueSummary) UnmarshalJSON(data []byte) erro return nil } -// MarshalJSON implements the json.Marshaller interface for type AdaptiveNetworkHardening. -func (a AdaptiveNetworkHardening) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AdvancedThreatProtectionSetting. +func (a AdvancedThreatProtectionSetting) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveNetworkHardening. -func (a *AdaptiveNetworkHardening) UnmarshalJSON(data []byte) error { +// 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) @@ -549,6 +499,9 @@ func (a *AdaptiveNetworkHardening) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) @@ -560,16 +513,19 @@ func (a *AdaptiveNetworkHardening) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AdaptiveNetworkHardeningEnforceRequest. -func (a AdaptiveNetworkHardeningEnforceRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AgentlessConfiguration. +func (a AgentlessConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "networkSecurityGroups", a.NetworkSecurityGroups) - populate(objectMap, "rules", a.Rules) + populate(objectMap, "agentlessAutoDiscovery", a.AgentlessAutoDiscovery) + populate(objectMap, "agentlessEnabled", a.AgentlessEnabled) + populate(objectMap, "inventoryList", a.InventoryList) + populate(objectMap, "inventoryListType", a.InventoryListType) + populate(objectMap, "scanners", a.Scanners) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveNetworkHardeningEnforceRequest. -func (a *AdaptiveNetworkHardeningEnforceRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AgentlessConfiguration. +func (a *AgentlessConfiguration) UnmarshalJSON(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) @@ -577,11 +533,20 @@ func (a *AdaptiveNetworkHardeningEnforceRequest) UnmarshalJSON(data []byte) erro for key, val := range rawMsg { var err error switch key { - case "networkSecurityGroups": - err = unpopulate(val, "NetworkSecurityGroups", &a.NetworkSecurityGroups) + case "agentlessAutoDiscovery": + err = unpopulate(val, "AgentlessAutoDiscovery", &a.AgentlessAutoDiscovery) delete(rawMsg, key) - case "rules": - err = unpopulate(val, "Rules", &a.Rules) + case "agentlessEnabled": + err = unpopulate(val, "AgentlessEnabled", &a.AgentlessEnabled) + delete(rawMsg, key) + case "inventoryList": + err = unpopulate(val, "InventoryList", &a.InventoryList) + delete(rawMsg, key) + case "inventoryListType": + err = unpopulate(val, "InventoryListType", &a.InventoryListType) + delete(rawMsg, key) + case "scanners": + err = unpopulate(val, "Scanners", &a.Scanners) delete(rawMsg, key) } if err != nil { @@ -591,17 +556,19 @@ func (a *AdaptiveNetworkHardeningEnforceRequest) UnmarshalJSON(data []byte) erro return nil } -// MarshalJSON implements the json.Marshaller interface for type AdaptiveNetworkHardeningProperties. -func (a AdaptiveNetworkHardeningProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Alert. +func (a Alert) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "effectiveNetworkSecurityGroups", a.EffectiveNetworkSecurityGroups) - populate(objectMap, "rules", a.Rules) - populateDateTimeRFC3339(objectMap, "rulesCalculationTime", a.RulesCalculationTime) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AdaptiveNetworkHardeningProperties. -func (a *AdaptiveNetworkHardeningProperties) UnmarshalJSON(data []byte) error { +// 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) @@ -609,14 +576,20 @@ func (a *AdaptiveNetworkHardeningProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "effectiveNetworkSecurityGroups": - err = unpopulate(val, "EffectiveNetworkSecurityGroups", &a.EffectiveNetworkSecurityGroups) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "rules": - err = unpopulate(val, "Rules", &a.Rules) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) - case "rulesCalculationTime": - err = unpopulateDateTimeRFC3339(val, "RulesCalculationTime", &a.RulesCalculationTime) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { @@ -626,16 +599,20 @@ func (a *AdaptiveNetworkHardeningProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AdaptiveNetworkHardeningsList. -func (a AdaptiveNetworkHardeningsList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AlertEntity. +func (a AlertEntity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", a.NextLink) - populate(objectMap, "value", a.Value) + 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 AdaptiveNetworkHardeningsList. -func (a *AdaptiveNetworkHardeningsList) UnmarshalJSON(data []byte) error { +// 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) @@ -643,11 +620,18 @@ func (a *AdaptiveNetworkHardeningsList) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "nextLink": - err = unpopulate(val, "NextLink", &a.NextLink) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &a.Value) + default: + if a.AdditionalProperties == nil { + a.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + a.AdditionalProperties[key] = aux + } delete(rawMsg, key) } if err != nil { @@ -657,15 +641,16 @@ func (a *AdaptiveNetworkHardeningsList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AdditionalData. -func (a AdditionalData) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AlertList. +func (a AlertList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["assessedResourceType"] = a.AssessedResourceType + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AdditionalData. -func (a *AdditionalData) UnmarshalJSON(data []byte) error { +// 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) @@ -673,8 +658,11 @@ func (a *AdditionalData) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "assessedResourceType": - err = unpopulate(val, "AssessedResourceType", &a.AssessedResourceType) + 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 { @@ -684,17 +672,41 @@ func (a *AdditionalData) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AdditionalWorkspacesProperties. -func (a AdditionalWorkspacesProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AlertProperties. +func (a AlertProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "dataTypes", a.DataTypes) - populate(objectMap, "type", a.Type) - populate(objectMap, "workspace", a.Workspace) + 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) + populateTime[datetime.RFC3339](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) + populateTime[datetime.RFC3339](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) + populateTime[datetime.RFC3339](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) + populateTime[datetime.RFC3339](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 AdditionalWorkspacesProperties. -func (a *AdditionalWorkspacesProperties) UnmarshalJSON(data []byte) error { +// 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) @@ -702,248 +714,11 @@ func (a *AdditionalWorkspacesProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "dataTypes": - err = unpopulate(val, "DataTypes", &a.DataTypes) + case "alertDisplayName": + err = unpopulate(val, "AlertDisplayName", &a.AlertDisplayName) 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]any) - 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]any) - 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]any) - 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]any) - 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]any{} - } - if val != nil { - var aux any - 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]any) - 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]any) - 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) - populateDateTimeRFC3339(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) - populateDateTimeRFC3339(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) - populateDateTimeRFC3339(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) - populateDateTimeRFC3339(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) + case "alertType": + err = unpopulate(val, "AlertType", &a.AlertType) delete(rawMsg, key) case "alertUri": err = unpopulate(val, "AlertURI", &a.AlertURI) @@ -958,7 +733,7 @@ func (a *AlertProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Description", &a.Description) delete(rawMsg, key) case "endTimeUtc": - err = unpopulateDateTimeRFC3339(val, "EndTimeUTC", &a.EndTimeUTC) + err = unpopulateTime[datetime.RFC3339](val, "EndTimeUTC", &a.EndTimeUTC) delete(rawMsg, key) case "entities": err = unpopulate(val, "Entities", &a.Entities) @@ -976,7 +751,7 @@ func (a *AlertProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "IsIncident", &a.IsIncident) delete(rawMsg, key) case "processingEndTimeUtc": - err = unpopulateDateTimeRFC3339(val, "ProcessingEndTimeUTC", &a.ProcessingEndTimeUTC) + err = unpopulateTime[datetime.RFC3339](val, "ProcessingEndTimeUTC", &a.ProcessingEndTimeUTC) delete(rawMsg, key) case "productComponentName": err = unpopulate(val, "ProductComponentName", &a.ProductComponentName) @@ -994,7 +769,7 @@ func (a *AlertProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Severity", &a.Severity) delete(rawMsg, key) case "startTimeUtc": - err = unpopulateDateTimeRFC3339(val, "StartTimeUTC", &a.StartTimeUTC) + err = unpopulateTime[datetime.RFC3339](val, "StartTimeUTC", &a.StartTimeUTC) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &a.Status) @@ -1012,7 +787,7 @@ func (a *AlertProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Techniques", &a.Techniques) delete(rawMsg, key) case "timeGeneratedUtc": - err = unpopulateDateTimeRFC3339(val, "TimeGeneratedUTC", &a.TimeGeneratedUTC) + err = unpopulateTime[datetime.RFC3339](val, "TimeGeneratedUTC", &a.TimeGeneratedUTC) delete(rawMsg, key) case "vendorName": err = unpopulate(val, "VendorName", &a.VendorName) @@ -1146,7 +921,7 @@ func (a *AlertSimulatorRequestBody) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AlertSimulatorRequestProperties. func (a AlertSimulatorRequestProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["kind"] = a.Kind + populate(objectMap, "kind", a.Kind) if a.AdditionalProperties != nil { for key, val := range a.AdditionalProperties { objectMap[key] = val @@ -1219,6 +994,7 @@ func (a AlertSyncSettings) MarshalJSON() ([]byte, error) { objectMap["kind"] = SettingKindAlertSyncSettings populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } @@ -1244,6 +1020,9 @@ func (a *AlertSyncSettings) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) @@ -1261,6 +1040,7 @@ func (a AlertsSuppressionRule) MarshalJSON() ([]byte, error) { populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } @@ -1283,6 +1063,9 @@ func (a *AlertsSuppressionRule) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) @@ -1299,8 +1082,8 @@ func (a AlertsSuppressionRuleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "alertType", a.AlertType) populate(objectMap, "comment", a.Comment) - populateDateTimeRFC3339(objectMap, "expirationDateUtc", a.ExpirationDateUTC) - populateDateTimeRFC3339(objectMap, "lastModifiedUtc", a.LastModifiedUTC) + populateTime[datetime.RFC3339](objectMap, "expirationDateUtc", a.ExpirationDateUTC) + populateTime[datetime.RFC3339](objectMap, "lastModifiedUtc", a.LastModifiedUTC) populate(objectMap, "reason", a.Reason) populate(objectMap, "state", a.State) populate(objectMap, "suppressionAlertsScope", a.SuppressionAlertsScope) @@ -1323,10 +1106,10 @@ func (a *AlertsSuppressionRuleProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Comment", &a.Comment) delete(rawMsg, key) case "expirationDateUtc": - err = unpopulateDateTimeRFC3339(val, "ExpirationDateUTC", &a.ExpirationDateUTC) + err = unpopulateTime[datetime.RFC3339](val, "ExpirationDateUTC", &a.ExpirationDateUTC) delete(rawMsg, key) case "lastModifiedUtc": - err = unpopulateDateTimeRFC3339(val, "LastModifiedUTC", &a.LastModifiedUTC) + err = unpopulateTime[datetime.RFC3339](val, "LastModifiedUTC", &a.LastModifiedUTC) delete(rawMsg, key) case "reason": err = unpopulate(val, "Reason", &a.Reason) @@ -1414,6 +1197,7 @@ func (a AllowedConnectionsResource) MarshalJSON() ([]byte, error) { populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } @@ -1439,6 +1223,9 @@ func (a *AllowedConnectionsResource) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) @@ -1453,7 +1240,7 @@ func (a *AllowedConnectionsResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AllowedConnectionsResourceProperties. func (a AllowedConnectionsResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "calculatedDateTime", a.CalculatedDateTime) + populateTime[datetime.RFC3339](objectMap, "calculatedDateTime", a.CalculatedDateTime) populate(objectMap, "connectableResources", a.ConnectableResources) return json.Marshal(objectMap) } @@ -1468,7 +1255,7 @@ func (a *AllowedConnectionsResourceProperties) UnmarshalJSON(data []byte) error var err error switch key { case "calculatedDateTime": - err = unpopulateDateTimeRFC3339(val, "CalculatedDateTime", &a.CalculatedDateTime) + err = unpopulateTime[datetime.RFC3339](val, "CalculatedDateTime", &a.CalculatedDateTime) delete(rawMsg, key) case "connectableResources": err = unpopulate(val, "ConnectableResources", &a.ConnectableResources) @@ -1687,6 +1474,7 @@ func (a Application) MarshalJSON() ([]byte, error) { populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } @@ -1709,6 +1497,9 @@ func (a *Application) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) @@ -1720,43 +1511,8 @@ func (a *Application) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ApplicationCondition. -func (a ApplicationCondition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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) { +// MarshalJSON implements the json.Marshaller interface for type ApplicationProperties. +func (a ApplicationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "conditionSets", a.ConditionSets) populate(objectMap, "description", a.Description) @@ -1825,16 +1581,16 @@ func (a *ApplicationsList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ArcAutoProvisioning. -func (a ArcAutoProvisioning) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArcAutoProvisioningConfiguration. +func (a ArcAutoProvisioningConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "configuration", a.Configuration) - populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "privateLinkScope", a.PrivateLinkScope) + populate(objectMap, "proxy", a.Proxy) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcAutoProvisioning. -func (a *ArcAutoProvisioning) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArcAutoProvisioningConfiguration. +func (a *ArcAutoProvisioningConfiguration) UnmarshalJSON(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) @@ -1842,11 +1598,11 @@ func (a *ArcAutoProvisioning) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "configuration": - err = unpopulate(val, "Configuration", &a.Configuration) + case "privateLinkScope": + err = unpopulate(val, "PrivateLinkScope", &a.PrivateLinkScope) delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) + case "proxy": + err = unpopulate(val, "Proxy", &a.Proxy) delete(rawMsg, key) } if err != nil { @@ -1856,17 +1612,19 @@ func (a *ArcAutoProvisioning) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ArcAutoProvisioningAws. -func (a ArcAutoProvisioningAws) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArmPrivateEndpointConnection. +func (a ArmPrivateEndpointConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "cloudRoleArn", a.CloudRoleArn) - populate(objectMap, "configuration", a.Configuration) - populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcAutoProvisioningAws. -func (a *ArcAutoProvisioningAws) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArmPrivateEndpointConnection. +func (a *ArmPrivateEndpointConnection) UnmarshalJSON(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) @@ -1874,14 +1632,20 @@ func (a *ArcAutoProvisioningAws) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &a.CloudRoleArn) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "configuration": - err = unpopulate(val, "Configuration", &a.Configuration) + case "name": + err = unpopulate(val, "Name", &a.Name) delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { @@ -1891,16 +1655,19 @@ func (a *ArcAutoProvisioningAws) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ArcAutoProvisioningConfiguration. -func (a ArcAutoProvisioningConfiguration) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArmSecurityStandard. +func (a ArmSecurityStandard) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "privateLinkScope", a.PrivateLinkScope) - populate(objectMap, "proxy", a.Proxy) + populate(objectMap, "id", a.ID) + populate(objectMap, "name", a.Name) + populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) + populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcAutoProvisioningConfiguration. -func (a *ArcAutoProvisioningConfiguration) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArmSecurityStandard. +func (a *ArmSecurityStandard) UnmarshalJSON(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) @@ -1908,11 +1675,20 @@ func (a *ArcAutoProvisioningConfiguration) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "privateLinkScope": - err = unpopulate(val, "PrivateLinkScope", &a.PrivateLinkScope) + case "id": + err = unpopulate(val, "ID", &a.ID) delete(rawMsg, key) - case "proxy": - err = unpopulate(val, "Proxy", &a.Proxy) + case "name": + err = unpopulate(val, "Name", &a.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &a.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) } if err != nil { @@ -1922,16 +1698,21 @@ func (a *ArcAutoProvisioningConfiguration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ArcAutoProvisioningGcp. -func (a ArcAutoProvisioningGcp) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ArmSecurityStandardProperties. +func (a ArmSecurityStandardProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "configuration", a.Configuration) - populate(objectMap, "enabled", a.Enabled) + populate(objectMap, "assessments", a.Assessments) + populate(objectMap, "cloudProviders", a.CloudProviders) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "metadata", a.Metadata) + populate(objectMap, "policySetDefinitionId", a.PolicySetDefinitionID) + populate(objectMap, "standardType", a.StandardType) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ArcAutoProvisioningGcp. -func (a *ArcAutoProvisioningGcp) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ArmSecurityStandardProperties. +func (a *ArmSecurityStandardProperties) UnmarshalJSON(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) @@ -1939,11 +1720,26 @@ func (a *ArcAutoProvisioningGcp) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "configuration": - err = unpopulate(val, "Configuration", &a.Configuration) + case "assessments": + err = unpopulate(val, "Assessments", &a.Assessments) delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &a.Enabled) + case "cloudProviders": + err = unpopulate(val, "CloudProviders", &a.CloudProviders) + 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 "metadata": + err = unpopulate(val, "Metadata", &a.Metadata) + delete(rawMsg, key) + case "policySetDefinitionId": + err = unpopulate(val, "PolicySetDefinitionID", &a.PolicySetDefinitionID) + delete(rawMsg, key) + case "standardType": + err = unpopulate(val, "StandardType", &a.StandardType) delete(rawMsg, key) } if err != nil { @@ -1959,6 +1755,7 @@ func (a AscLocation) MarshalJSON() ([]byte, error) { populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populateAny(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } @@ -1981,6 +1778,9 @@ func (a *AscLocation) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) @@ -2029,6 +1829,7 @@ func (a Assessment) MarshalJSON() ([]byte, error) { populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } @@ -2051,6 +1852,9 @@ func (a *Assessment) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) @@ -2120,45 +1924,6 @@ func (a *AssessmentList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessmentMetadata. -func (a AssessmentMetadata) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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]any) @@ -2389,6 +2154,7 @@ func (a AssessmentMetadataResponse) MarshalJSON() ([]byte, error) { populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } @@ -2411,6 +2177,9 @@ func (a *AssessmentMetadataResponse) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) @@ -2493,6 +2262,7 @@ func (a AssessmentProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "metadata", a.Metadata) populate(objectMap, "partnersData", a.PartnersData) populate(objectMap, "resourceDetails", a.ResourceDetails) + populate(objectMap, "risk", a.Risk) populate(objectMap, "status", a.Status) return json.Marshal(objectMap) } @@ -2524,6 +2294,9 @@ func (a *AssessmentProperties) UnmarshalJSON(data []byte) error { case "resourceDetails": a.ResourceDetails, err = unmarshalResourceDetailsClassification(val) delete(rawMsg, key) + case "risk": + err = unpopulate(val, "Risk", &a.Risk) + delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &a.Status) delete(rawMsg, key) @@ -2535,20 +2308,19 @@ func (a *AssessmentProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AssessmentPropertiesBase. -func (a AssessmentPropertiesBase) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AssessmentPropertiesBaseRisk. +func (a AssessmentPropertiesBaseRisk) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - 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, "attackPathsReferences", a.AttackPathsReferences) + populate(objectMap, "isContextualRisk", a.IsContextualRisk) + populate(objectMap, "level", a.Level) + populate(objectMap, "paths", a.Paths) + populate(objectMap, "riskFactors", a.RiskFactors) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentPropertiesBase. -func (a *AssessmentPropertiesBase) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentPropertiesBaseRisk. +func (a *AssessmentPropertiesBaseRisk) UnmarshalJSON(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) @@ -2556,23 +2328,121 @@ func (a *AssessmentPropertiesBase) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "additionalData": - err = unpopulate(val, "AdditionalData", &a.AdditionalData) + case "attackPathsReferences": + err = unpopulate(val, "AttackPathsReferences", &a.AttackPathsReferences) delete(rawMsg, key) - case "displayName": - err = unpopulate(val, "DisplayName", &a.DisplayName) + case "isContextualRisk": + err = unpopulate(val, "IsContextualRisk", &a.IsContextualRisk) delete(rawMsg, key) - case "links": - err = unpopulate(val, "Links", &a.Links) + case "level": + err = unpopulate(val, "Level", &a.Level) delete(rawMsg, key) - case "metadata": - err = unpopulate(val, "Metadata", &a.Metadata) + case "paths": + err = unpopulate(val, "Paths", &a.Paths) delete(rawMsg, key) - case "partnersData": - err = unpopulate(val, "PartnersData", &a.PartnersData) + case "riskFactors": + err = unpopulate(val, "RiskFactors", &a.RiskFactors) delete(rawMsg, key) - case "resourceDetails": - a.ResourceDetails, err = unmarshalResourceDetailsClassification(val) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", a, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type AssessmentPropertiesBaseRiskPathsItem. +func (a AssessmentPropertiesBaseRiskPathsItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "edges", a.Edges) + populate(objectMap, "id", a.ID) + populate(objectMap, "nodes", a.Nodes) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentPropertiesBaseRiskPathsItem. +func (a *AssessmentPropertiesBaseRiskPathsItem) UnmarshalJSON(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 "edges": + err = unpopulate(val, "Edges", &a.Edges) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &a.ID) + delete(rawMsg, key) + case "nodes": + err = unpopulate(val, "Nodes", &a.Nodes) + 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 AssessmentPropertiesBaseRiskPathsItemEdgeItem. +func (a AssessmentPropertiesBaseRiskPathsItemEdgeItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "sourceId", a.SourceID) + populate(objectMap, "targetId", a.TargetID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentPropertiesBaseRiskPathsItemEdgeItem. +func (a *AssessmentPropertiesBaseRiskPathsItemEdgeItem) UnmarshalJSON(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 "sourceId": + err = unpopulate(val, "SourceID", &a.SourceID) + delete(rawMsg, key) + case "targetId": + err = unpopulate(val, "TargetID", &a.TargetID) + 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 AssessmentPropertiesBaseRiskPathsItemNodesItem. +func (a AssessmentPropertiesBaseRiskPathsItemNodesItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + populate(objectMap, "nodePropertiesLabel", a.NodePropertiesLabel) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssessmentPropertiesBaseRiskPathsItemNodesItem. +func (a *AssessmentPropertiesBaseRiskPathsItemNodesItem) UnmarshalJSON(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 "nodePropertiesLabel": + err = unpopulate(val, "NodePropertiesLabel", &a.NodePropertiesLabel) delete(rawMsg, key) } if err != nil { @@ -2591,6 +2461,7 @@ func (a AssessmentPropertiesResponse) MarshalJSON() ([]byte, error) { populate(objectMap, "metadata", a.Metadata) populate(objectMap, "partnersData", a.PartnersData) populate(objectMap, "resourceDetails", a.ResourceDetails) + populate(objectMap, "risk", a.Risk) populate(objectMap, "status", a.Status) return json.Marshal(objectMap) } @@ -2622,6 +2493,9 @@ func (a *AssessmentPropertiesResponse) UnmarshalJSON(data []byte) error { case "resourceDetails": a.ResourceDetails, err = unmarshalResourceDetailsClassification(val) delete(rawMsg, key) + case "risk": + err = unpopulate(val, "Risk", &a.Risk) + delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &a.Status) delete(rawMsg, key) @@ -2639,6 +2513,7 @@ func (a AssessmentResponse) MarshalJSON() ([]byte, error) { populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } @@ -2661,6 +2536,9 @@ func (a *AssessmentResponse) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) @@ -2713,8 +2591,8 @@ func (a AssessmentStatusResponse) MarshalJSON() ([]byte, error) { populate(objectMap, "cause", a.Cause) populate(objectMap, "code", a.Code) populate(objectMap, "description", a.Description) - populateDateTimeRFC3339(objectMap, "firstEvaluationDate", a.FirstEvaluationDate) - populateDateTimeRFC3339(objectMap, "statusChangeDate", a.StatusChangeDate) + populateTime[datetime.RFC3339](objectMap, "firstEvaluationDate", a.FirstEvaluationDate) + populateTime[datetime.RFC3339](objectMap, "statusChangeDate", a.StatusChangeDate) return json.Marshal(objectMap) } @@ -2737,10 +2615,10 @@ func (a *AssessmentStatusResponse) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Description", &a.Description) delete(rawMsg, key) case "firstEvaluationDate": - err = unpopulateDateTimeRFC3339(val, "FirstEvaluationDate", &a.FirstEvaluationDate) + err = unpopulateTime[datetime.RFC3339](val, "FirstEvaluationDate", &a.FirstEvaluationDate) delete(rawMsg, key) case "statusChangeDate": - err = unpopulateDateTimeRFC3339(val, "StatusChangeDate", &a.StatusChangeDate) + err = unpopulateTime[datetime.RFC3339](val, "StatusChangeDate", &a.StatusChangeDate) delete(rawMsg, key) } if err != nil { @@ -2750,14 +2628,272 @@ func (a *AssessmentStatusResponse) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AtaExternalSecuritySolution. -func (a AtaExternalSecuritySolution) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AssignedAssessmentItem. +func (a AssignedAssessmentItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", a.ID) - objectMap["kind"] = ExternalSecuritySolutionKindATA - populate(objectMap, "location", a.Location) + populate(objectMap, "assessmentKey", a.AssessmentKey) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignedAssessmentItem. +func (a *AssignedAssessmentItem) UnmarshalJSON(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 "assessmentKey": + err = unpopulate(val, "AssessmentKey", &a.AssessmentKey) + 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 AssignedComponentItem. +func (a AssignedComponentItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", a.Key) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignedComponentItem. +func (a *AssignedComponentItem) UnmarshalJSON(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 "key": + err = unpopulate(val, "Key", &a.Key) + 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 AssignedStandardItem. +func (a AssignedStandardItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", a.ID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignedStandardItem. +func (a *AssignedStandardItem) UnmarshalJSON(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 Assignment. +func (a Assignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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, "systemData", a.SystemData) + populate(objectMap, "tags", a.Tags) + populate(objectMap, "type", a.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Assignment. +func (a *Assignment) UnmarshalJSON(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 "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + 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 AssignmentList. +func (a AssignmentList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentList. +func (a *AssignmentList) UnmarshalJSON(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 AssignmentProperties. +func (a AssignmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "additionalData", a.AdditionalData) + populate(objectMap, "assignedComponent", a.AssignedComponent) + populate(objectMap, "assignedStandard", a.AssignedStandard) + populate(objectMap, "description", a.Description) + populate(objectMap, "displayName", a.DisplayName) + populate(objectMap, "effect", a.Effect) + populateTime[datetime.RFC3339](objectMap, "expiresOn", a.ExpiresOn) + populateAny(objectMap, "metadata", a.Metadata) + populate(objectMap, "scope", a.Scope) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentProperties. +func (a *AssignmentProperties) UnmarshalJSON(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 "assignedComponent": + err = unpopulate(val, "AssignedComponent", &a.AssignedComponent) + delete(rawMsg, key) + case "assignedStandard": + err = unpopulate(val, "AssignedStandard", &a.AssignedStandard) + 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 "effect": + err = unpopulate(val, "Effect", &a.Effect) + delete(rawMsg, key) + case "expiresOn": + err = unpopulateTime[datetime.RFC3339](val, "ExpiresOn", &a.ExpiresOn) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &a.Metadata) + delete(rawMsg, key) + case "scope": + err = unpopulate(val, "Scope", &a.Scope) + 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 AssignmentPropertiesAdditionalData. +func (a AssignmentPropertiesAdditionalData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "exemptionCategory", a.ExemptionCategory) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AssignmentPropertiesAdditionalData. +func (a *AssignmentPropertiesAdditionalData) UnmarshalJSON(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 "exemptionCategory": + err = unpopulate(val, "ExemptionCategory", &a.ExemptionCategory) + 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]any) + populate(objectMap, "id", a.ID) + objectMap["kind"] = ExternalSecuritySolutionKindATA + populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } @@ -2786,6 +2922,9 @@ func (a *AtaExternalSecuritySolution) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) @@ -2851,17 +2990,16 @@ func (a *AtaSolutionProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AuthenticationDetailsProperties. -func (a AuthenticationDetailsProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AttestationEvidence. +func (a AttestationEvidence) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "authenticationProvisioningState", a.AuthenticationProvisioningState) - objectMap["authenticationType"] = a.AuthenticationType - populate(objectMap, "grantedPermissions", a.GrantedPermissions) + populate(objectMap, "description", a.Description) + populate(objectMap, "sourceUrl", a.SourceURL) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type AuthenticationDetailsProperties. -func (a *AuthenticationDetailsProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type AttestationEvidence. +func (a *AttestationEvidence) UnmarshalJSON(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) @@ -2869,15 +3007,39 @@ func (a *AuthenticationDetailsProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "authenticationProvisioningState": - err = unpopulate(val, "AuthenticationProvisioningState", &a.AuthenticationProvisioningState) + case "description": + err = unpopulate(val, "Description", &a.Description) delete(rawMsg, key) + case "sourceUrl": + err = unpopulate(val, "SourceURL", &a.SourceURL) + 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 Authentication. +func (a Authentication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authenticationType", a.AuthenticationType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Authentication. +func (a *Authentication) UnmarshalJSON(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 "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) @@ -2919,6 +3081,7 @@ func (a AutoProvisioningSetting) MarshalJSON() ([]byte, error) { populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } @@ -2941,6 +3104,9 @@ func (a *AutoProvisioningSetting) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &a.Type) delete(rawMsg, key) @@ -3019,6 +3185,7 @@ func (a Automation) MarshalJSON() ([]byte, error) { populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) populate(objectMap, "properties", a.Properties) + populate(objectMap, "systemData", a.SystemData) populate(objectMap, "tags", a.Tags) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) @@ -3051,6 +3218,9 @@ func (a *Automation) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &a.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &a.SystemData) + delete(rawMsg, key) case "tags": err = unpopulate(val, "Tags", &a.Tags) delete(rawMsg, key) @@ -3068,7 +3238,7 @@ func (a *Automation) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AutomationAction. func (a AutomationAction) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["actionType"] = a.ActionType + populate(objectMap, "actionType", a.ActionType) return json.Marshal(objectMap) } @@ -3465,113 +3635,19 @@ func (a *AutomationValidationStatus) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AwAssumeRoleAuthenticationDetailsProperties. -func (a AwAssumeRoleAuthenticationDetailsProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type AwsEnvironmentData. +func (a AwsEnvironmentData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - 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) + populate(objectMap, "accountName", a.AccountName) + objectMap["environmentType"] = EnvironmentTypeAwsAccount + populate(objectMap, "organizationalData", a.OrganizationalData) + populate(objectMap, "regions", a.Regions) + populate(objectMap, "scanInterval", a.ScanInterval) 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]any) - 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 AwsEnvironmentData. -func (a AwsEnvironmentData) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "accountName", a.AccountName) - objectMap["environmentType"] = EnvironmentTypeAwsAccount - populate(objectMap, "organizationalData", a.OrganizationalData) - populate(objectMap, "regions", a.Regions) - populate(objectMap, "scanInterval", a.ScanInterval) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AwsEnvironmentData. -func (a *AwsEnvironmentData) UnmarshalJSON(data []byte) error { +// 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) @@ -3605,7 +3681,7 @@ func (a *AwsEnvironmentData) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type AwsOrganizationalData. func (a AwsOrganizationalData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["organizationMembershipType"] = a.OrganizationMembershipType + populate(objectMap, "organizationMembershipType", a.OrganizationMembershipType) return json.Marshal(objectMap) } @@ -3776,7 +3852,7 @@ func (a AzureDevOpsOrgProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "onboardingState", a.OnboardingState) populate(objectMap, "provisioningState", a.ProvisioningState) populate(objectMap, "provisioningStatusMessage", a.ProvisioningStatusMessage) - populateDateTimeRFC3339(objectMap, "provisioningStatusUpdateTimeUtc", a.ProvisioningStatusUpdateTimeUTC) + populateTime[datetime.RFC3339](objectMap, "provisioningStatusUpdateTimeUtc", a.ProvisioningStatusUpdateTimeUTC) return json.Marshal(objectMap) } @@ -3802,38 +3878,7 @@ func (a *AzureDevOpsOrgProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "ProvisioningStatusMessage", &a.ProvisioningStatusMessage) delete(rawMsg, key) case "provisioningStatusUpdateTimeUtc": - err = unpopulateDateTimeRFC3339(val, "ProvisioningStatusUpdateTimeUTC", &a.ProvisioningStatusUpdateTimeUTC) - 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 AzureDevOpsOrganizationConfiguration. -func (a AzureDevOpsOrganizationConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "autoDiscovery", a.AutoDiscovery) - populate(objectMap, "projectConfigs", a.ProjectConfigs) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDevOpsOrganizationConfiguration. -func (a *AzureDevOpsOrganizationConfiguration) UnmarshalJSON(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 "autoDiscovery": - err = unpopulate(val, "AutoDiscovery", &a.AutoDiscovery) - delete(rawMsg, key) - case "projectConfigs": - err = unpopulate(val, "ProjectConfigs", &a.ProjectConfigs) + err = unpopulateTime[datetime.RFC3339](val, "ProvisioningStatusUpdateTimeUTC", &a.ProvisioningStatusUpdateTimeUTC) delete(rawMsg, key) } if err != nil { @@ -3886,37 +3931,6 @@ func (a *AzureDevOpsProject) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureDevOpsProjectConfiguration. -func (a AzureDevOpsProjectConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "autoDiscovery", a.AutoDiscovery) - populate(objectMap, "repositoryConfigs", a.RepositoryConfigs) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type AzureDevOpsProjectConfiguration. -func (a *AzureDevOpsProjectConfiguration) UnmarshalJSON(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 "autoDiscovery": - err = unpopulate(val, "AutoDiscovery", &a.AutoDiscovery) - delete(rawMsg, key) - case "repositoryConfigs": - err = unpopulate(val, "RepositoryConfigs", &a.RepositoryConfigs) - 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 AzureDevOpsProjectListResponse. func (a AzureDevOpsProjectListResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -3957,7 +3971,7 @@ func (a AzureDevOpsProjectProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "projectId", a.ProjectID) populate(objectMap, "provisioningState", a.ProvisioningState) populate(objectMap, "provisioningStatusMessage", a.ProvisioningStatusMessage) - populateDateTimeRFC3339(objectMap, "provisioningStatusUpdateTimeUtc", a.ProvisioningStatusUpdateTimeUTC) + populateTime[datetime.RFC3339](objectMap, "provisioningStatusUpdateTimeUtc", a.ProvisioningStatusUpdateTimeUTC) return json.Marshal(objectMap) } @@ -3989,7 +4003,7 @@ func (a *AzureDevOpsProjectProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "ProvisioningStatusMessage", &a.ProvisioningStatusMessage) delete(rawMsg, key) case "provisioningStatusUpdateTimeUtc": - err = unpopulateDateTimeRFC3339(val, "ProvisioningStatusUpdateTimeUTC", &a.ProvisioningStatusUpdateTimeUTC) + err = unpopulateTime[datetime.RFC3339](val, "ProvisioningStatusUpdateTimeUTC", &a.ProvisioningStatusUpdateTimeUTC) delete(rawMsg, key) } if err != nil { @@ -4082,7 +4096,7 @@ func (a AzureDevOpsRepositoryProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "parentProjectName", a.ParentProjectName) populate(objectMap, "provisioningState", a.ProvisioningState) populate(objectMap, "provisioningStatusMessage", a.ProvisioningStatusMessage) - populateDateTimeRFC3339(objectMap, "provisioningStatusUpdateTimeUtc", a.ProvisioningStatusUpdateTimeUTC) + populateTime[datetime.RFC3339](objectMap, "provisioningStatusUpdateTimeUtc", a.ProvisioningStatusUpdateTimeUTC) populate(objectMap, "repoId", a.RepoID) populate(objectMap, "repoUrl", a.RepoURL) populate(objectMap, "visibility", a.Visibility) @@ -4117,7 +4131,7 @@ func (a *AzureDevOpsRepositoryProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "ProvisioningStatusMessage", &a.ProvisioningStatusMessage) delete(rawMsg, key) case "provisioningStatusUpdateTimeUtc": - err = unpopulateDateTimeRFC3339(val, "ProvisioningStatusUpdateTimeUTC", &a.ProvisioningStatusUpdateTimeUTC) + err = unpopulateTime[datetime.RFC3339](val, "ProvisioningStatusUpdateTimeUTC", &a.ProvisioningStatusUpdateTimeUTC) delete(rawMsg, key) case "repoId": err = unpopulate(val, "RepoID", &a.RepoID) @@ -4299,65 +4313,11 @@ func (a *AzureServersSetting) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type AzureTrackedResourceLocation. -func (a AzureTrackedResourceLocation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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 BaseResourceConfiguration. -func (b BaseResourceConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "desiredOnboardingState", b.DesiredOnboardingState) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type BaseResourceConfiguration. -func (b *BaseResourceConfiguration) UnmarshalJSON(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 "desiredOnboardingState": - err = unpopulate(val, "DesiredOnboardingState", &b.DesiredOnboardingState) - 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 Baseline. func (b Baseline) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "expectedResults", b.ExpectedResults) - populateDateTimeRFC3339(objectMap, "updatedTime", b.UpdatedTime) + populateTime[datetime.RFC3339](objectMap, "updatedTime", b.UpdatedTime) return json.Marshal(objectMap) } @@ -4374,7 +4334,7 @@ func (b *Baseline) UnmarshalJSON(data []byte) error { err = unpopulate(val, "ExpectedResults", &b.ExpectedResults) delete(rawMsg, key) case "updatedTime": - err = unpopulateDateTimeRFC3339(val, "UpdatedTime", &b.UpdatedTime) + err = unpopulateTime[datetime.RFC3339](val, "UpdatedTime", &b.UpdatedTime) delete(rawMsg, key) } if err != nil { @@ -4454,6 +4414,49 @@ func (b *BenchmarkReference) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type BlobsScanSummary. +func (b BlobsScanSummary) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "failedBlobsCount", b.FailedBlobsCount) + populate(objectMap, "maliciousBlobsCount", b.MaliciousBlobsCount) + populate(objectMap, "scannedBlobsInGB", b.ScannedBlobsInGB) + populate(objectMap, "skippedBlobsCount", b.SkippedBlobsCount) + populate(objectMap, "totalBlobsScanned", b.TotalBlobsScanned) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BlobsScanSummary. +func (b *BlobsScanSummary) UnmarshalJSON(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 "failedBlobsCount": + err = unpopulate(val, "FailedBlobsCount", &b.FailedBlobsCount) + delete(rawMsg, key) + case "maliciousBlobsCount": + err = unpopulate(val, "MaliciousBlobsCount", &b.MaliciousBlobsCount) + delete(rawMsg, key) + case "scannedBlobsInGB": + err = unpopulate(val, "ScannedBlobsInGB", &b.ScannedBlobsInGB) + delete(rawMsg, key) + case "skippedBlobsCount": + err = unpopulate(val, "SkippedBlobsCount", &b.SkippedBlobsCount) + delete(rawMsg, key) + case "totalBlobsScanned": + err = unpopulate(val, "TotalBlobsScanned", &b.TotalBlobsScanned) + 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 BuiltInInfoType. func (b BuiltInInfoType) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -4586,6 +4589,7 @@ func (c CefExternalSecuritySolution) MarshalJSON() ([]byte, error) { populate(objectMap, "location", c.Location) populate(objectMap, "name", c.Name) populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) populate(objectMap, "type", c.Type) return json.Marshal(objectMap) } @@ -4614,6 +4618,9 @@ func (c *CefExternalSecuritySolution) UnmarshalJSON(data []byte) error { 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) @@ -4691,7 +4698,7 @@ func (c *CefSolutionProperties) UnmarshalJSON(data []byte) error { func (c CloudOffering) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "description", c.Description) - objectMap["offeringType"] = c.OfferingType + populate(objectMap, "offeringType", c.OfferingType) return json.Marshal(objectMap) } @@ -4724,6 +4731,7 @@ func (c Compliance) MarshalJSON() ([]byte, error) { 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) } @@ -4746,6 +4754,9 @@ func (c *Compliance) UnmarshalJSON(data []byte) error { 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) @@ -4792,7 +4803,7 @@ func (c *ComplianceList) UnmarshalJSON(data []byte) error { func (c ComplianceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "assessmentResult", c.AssessmentResult) - populateDateTimeRFC3339(objectMap, "assessmentTimestampUtcDate", c.AssessmentTimestampUTCDate) + populateTime[datetime.RFC3339](objectMap, "assessmentTimestampUtcDate", c.AssessmentTimestampUTCDate) populate(objectMap, "resourceCount", c.ResourceCount) return json.Marshal(objectMap) } @@ -4810,7 +4821,7 @@ func (c *ComplianceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "AssessmentResult", &c.AssessmentResult) delete(rawMsg, key) case "assessmentTimestampUtcDate": - err = unpopulateDateTimeRFC3339(val, "AssessmentTimestampUTCDate", &c.AssessmentTimestampUTCDate) + err = unpopulateTime[datetime.RFC3339](val, "AssessmentTimestampUTCDate", &c.AssessmentTimestampUTCDate) delete(rawMsg, key) case "resourceCount": err = unpopulate(val, "ResourceCount", &c.ResourceCount) @@ -4829,6 +4840,7 @@ func (c ComplianceResult) MarshalJSON() ([]byte, error) { 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) } @@ -4851,6 +4863,9 @@ func (c *ComplianceResult) UnmarshalJSON(data []byte) error { 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) @@ -4951,41 +4966,6 @@ func (c *ComplianceSegment) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Condition. -func (c Condition) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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]any) @@ -5242,7 +5222,7 @@ func (c ConnectorProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "environmentData", c.EnvironmentData) populate(objectMap, "environmentName", c.EnvironmentName) populate(objectMap, "hierarchyIdentifier", c.HierarchyIdentifier) - populateDateTimeRFC3339(objectMap, "hierarchyIdentifierTrialEndDate", c.HierarchyIdentifierTrialEndDate) + populateTime[datetime.RFC3339](objectMap, "hierarchyIdentifierTrialEndDate", c.HierarchyIdentifierTrialEndDate) populate(objectMap, "offerings", c.Offerings) return json.Marshal(objectMap) } @@ -5266,7 +5246,7 @@ func (c *ConnectorProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "HierarchyIdentifier", &c.HierarchyIdentifier) delete(rawMsg, key) case "hierarchyIdentifierTrialEndDate": - err = unpopulateDateTimeRFC3339(val, "HierarchyIdentifierTrialEndDate", &c.HierarchyIdentifierTrialEndDate) + err = unpopulateTime[datetime.RFC3339](val, "HierarchyIdentifierTrialEndDate", &c.HierarchyIdentifierTrialEndDate) delete(rawMsg, key) case "offerings": c.Offerings, err = unmarshalCloudOfferingClassificationArray(val) @@ -5279,18 +5259,50 @@ func (c *ConnectorProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectorSetting. -func (c ConnectorSetting) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ConnectorsList. +func (c ConnectorsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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]any) 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 ConnectorSetting. -func (c *ConnectorSetting) UnmarshalJSON(data []byte) error { +// 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) @@ -5307,6 +5319,9 @@ func (c *ConnectorSetting) UnmarshalJSON(data []byte) error { 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) @@ -5318,148 +5333,16 @@ func (c *ConnectorSetting) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ConnectorSettingList. -func (c ConnectorSettingList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ContactList. +func (c ContactList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) 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]any) - 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]any) - 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]any) - 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]any) - 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 { +// 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) @@ -5563,7 +5446,7 @@ func (c ContainerRegistryVulnerabilityProperties) MarshalJSON() ([]byte, error) populate(objectMap, "cvss", c.Cvss) populate(objectMap, "imageDigest", c.ImageDigest) populate(objectMap, "patchable", c.Patchable) - populateDateTimeRFC3339(objectMap, "publishedTime", c.PublishedTime) + populateTime[datetime.RFC3339](objectMap, "publishedTime", c.PublishedTime) populate(objectMap, "repositoryName", c.RepositoryName) populate(objectMap, "type", c.Type) populate(objectMap, "vendorReferences", c.VendorReferences) @@ -5595,7 +5478,7 @@ func (c *ContainerRegistryVulnerabilityProperties) UnmarshalJSON(data []byte) er err = unpopulate(val, "Patchable", &c.Patchable) delete(rawMsg, key) case "publishedTime": - err = unpopulateDateTimeRFC3339(val, "PublishedTime", &c.PublishedTime) + err = unpopulateTime[datetime.RFC3339](val, "PublishedTime", &c.PublishedTime) delete(rawMsg, key) case "repositoryName": err = unpopulate(val, "RepositoryName", &c.RepositoryName) @@ -5707,6 +5590,37 @@ func (c *CspmMonitorAzureDevOpsOffering) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CspmMonitorDockerHubOffering. +func (c CspmMonitorDockerHubOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", c.Description) + objectMap["offeringType"] = OfferingTypeCspmMonitorDockerHub + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorDockerHubOffering. +func (c *CspmMonitorDockerHubOffering) UnmarshalJSON(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]any) @@ -5835,13 +5749,44 @@ func (c *CspmMonitorGithubOffering) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CspmMonitorJFrogOffering. +func (c CspmMonitorJFrogOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", c.Description) + objectMap["offeringType"] = OfferingTypeCspmMonitorJFrog + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorJFrogOffering. +func (c *CspmMonitorJFrogOffering) UnmarshalJSON(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]any) populate(objectMap, "description", c.Description) populate(objectMap, "displayName", c.DisplayName) populate(objectMap, "isEnabled", c.IsEnabled) - objectMap["ruleType"] = c.RuleType + populate(objectMap, "ruleType", c.RuleType) return json.Marshal(objectMap) } @@ -5874,8 +5819,8 @@ func (c *CustomAlertRule) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomation. -func (c CustomAssessmentAutomation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CustomRecommendation. +func (c CustomRecommendation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", c.ID) populate(objectMap, "name", c.Name) @@ -5885,8 +5830,8 @@ func (c CustomAssessmentAutomation) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomAssessmentAutomation. -func (c *CustomAssessmentAutomation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomRecommendation. +func (c *CustomRecommendation) UnmarshalJSON(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) @@ -5917,27 +5862,22 @@ func (c *CustomAssessmentAutomation) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomationProperties. -func (c CustomAssessmentAutomationProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CustomRecommendationProperties. +func (c CustomRecommendationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "assessmentKey", c.AssessmentKey) - populate(objectMap, "compressedQuery", c.CompressedQuery) + populate(objectMap, "cloudProviders", c.CloudProviders) populate(objectMap, "description", c.Description) populate(objectMap, "displayName", c.DisplayName) + populate(objectMap, "query", c.Query) populate(objectMap, "remediationDescription", c.RemediationDescription) - if c.Severity == nil { - c.Severity = to.Ptr(SeverityEnumLow) - } + populate(objectMap, "securityIssue", c.SecurityIssue) 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 { +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomRecommendationProperties. +func (c *CustomRecommendationProperties) UnmarshalJSON(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) @@ -5948,8 +5888,8 @@ func (c *CustomAssessmentAutomationProperties) UnmarshalJSON(data []byte) error case "assessmentKey": err = unpopulate(val, "AssessmentKey", &c.AssessmentKey) delete(rawMsg, key) - case "compressedQuery": - err = unpopulate(val, "CompressedQuery", &c.CompressedQuery) + case "cloudProviders": + err = unpopulate(val, "CloudProviders", &c.CloudProviders) delete(rawMsg, key) case "description": err = unpopulate(val, "Description", &c.Description) @@ -5957,15 +5897,18 @@ func (c *CustomAssessmentAutomationProperties) UnmarshalJSON(data []byte) error case "displayName": err = unpopulate(val, "DisplayName", &c.DisplayName) delete(rawMsg, key) + case "query": + err = unpopulate(val, "Query", &c.Query) + delete(rawMsg, key) case "remediationDescription": err = unpopulate(val, "RemediationDescription", &c.RemediationDescription) delete(rawMsg, key) + case "securityIssue": + err = unpopulate(val, "SecurityIssue", &c.SecurityIssue) + 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) @@ -5974,18 +5917,16 @@ func (c *CustomAssessmentAutomationProperties) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomationRequest. -func (c CustomAssessmentAutomationRequest) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CustomRecommendationsList. +func (c CustomRecommendationsList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", c.ID) - populate(objectMap, "name", c.Name) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "type", c.Type) + populate(objectMap, "nextLink", c.NextLink) + populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomAssessmentAutomationRequest. -func (c *CustomAssessmentAutomationRequest) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomRecommendationsList. +func (c *CustomRecommendationsList) UnmarshalJSON(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) @@ -5993,17 +5934,11 @@ func (c *CustomAssessmentAutomationRequest) UnmarshalJSON(data []byte) error { 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) + case "nextLink": + err = unpopulate(val, "NextLink", &c.NextLink) delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &c.Type) + case "value": + err = unpopulate(val, "Value", &c.Value) delete(rawMsg, key) } if err != nil { @@ -6013,301 +5948,59 @@ func (c *CustomAssessmentAutomationRequest) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomationRequestProperties. -func (c CustomAssessmentAutomationRequestProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataExportSettingProperties. +func (d DataExportSettingProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - 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) + populate(objectMap, "enabled", d.Enabled) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomAssessmentAutomationRequestProperties. -func (c *CustomAssessmentAutomationRequestProperties) UnmarshalJSON(data []byte) error { +// 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", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, 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) + case "enabled": + err = unpopulate(val, "Enabled", &d.Enabled) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", c, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil } -// MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomationsListResult. -func (c CustomAssessmentAutomationsListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DataExportSettings. +func (d DataExportSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "nextLink", c.NextLink) - populate(objectMap, "value", c.Value) + populate(objectMap, "id", d.ID) + objectMap["kind"] = SettingKindDataExportSettings + populate(objectMap, "name", d.Name) + populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) + populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type CustomAssessmentAutomationsListResult. -func (c *CustomAssessmentAutomationsListResult) UnmarshalJSON(data []byte) error { +// 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", c, err) + 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", &c.NextLink) + case "id": + err = unpopulate(val, "ID", &d.ID) 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]any) - 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]any) - 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]any) - 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]any) - 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]any) - 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]any) - 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]any) - 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) + case "kind": + err = unpopulate(val, "Kind", &d.Kind) delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &d.Name) @@ -6315,6 +6008,9 @@ func (d *DataExportSettings) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) @@ -6629,6 +6325,37 @@ func (d *DefenderCspmAwsOfferingVMScanners) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DefenderCspmDockerHubOffering. +func (d DefenderCspmDockerHubOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", d.Description) + objectMap["offeringType"] = OfferingTypeDefenderCspmDockerHub + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderCspmDockerHubOffering. +func (d *DefenderCspmDockerHubOffering) UnmarshalJSON(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 "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 DefenderCspmGcpOffering. func (d DefenderCspmGcpOffering) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -6851,19 +6578,17 @@ func (d *DefenderCspmGcpOfferingVMScanners) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DefenderFoDatabasesAwsOffering. -func (d DefenderFoDatabasesAwsOffering) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DefenderCspmJFrogOffering. +func (d DefenderCspmJFrogOffering) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "arcAutoProvisioning", d.ArcAutoProvisioning) - populate(objectMap, "databasesDspm", d.DatabasesDspm) populate(objectMap, "description", d.Description) - objectMap["offeringType"] = OfferingTypeDefenderForDatabasesAws - populate(objectMap, "rds", d.Rds) + populate(objectMap, "mdcContainersImageAssessment", d.MdcContainersImageAssessment) + objectMap["offeringType"] = OfferingTypeDefenderCspmJFrog return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderFoDatabasesAwsOffering. -func (d *DefenderFoDatabasesAwsOffering) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderCspmJFrogOffering. +func (d *DefenderCspmJFrogOffering) UnmarshalJSON(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) @@ -6871,21 +6596,15 @@ func (d *DefenderFoDatabasesAwsOffering) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "arcAutoProvisioning": - err = unpopulate(val, "ArcAutoProvisioning", &d.ArcAutoProvisioning) - delete(rawMsg, key) - case "databasesDspm": - err = unpopulate(val, "DatabasesDspm", &d.DatabasesDspm) - delete(rawMsg, key) case "description": err = unpopulate(val, "Description", &d.Description) delete(rawMsg, key) + case "mdcContainersImageAssessment": + err = unpopulate(val, "MdcContainersImageAssessment", &d.MdcContainersImageAssessment) + delete(rawMsg, key) case "offeringType": err = unpopulate(val, "OfferingType", &d.OfferingType) delete(rawMsg, key) - case "rds": - err = unpopulate(val, "Rds", &d.Rds) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", d, err) @@ -6894,17 +6613,15 @@ func (d *DefenderFoDatabasesAwsOffering) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type DefenderFoDatabasesAwsOfferingArcAutoProvisioning. -func (d DefenderFoDatabasesAwsOfferingArcAutoProvisioning) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DefenderCspmJFrogOfferingMdcContainersImageAssessment. +func (d DefenderCspmJFrogOfferingMdcContainersImageAssessment) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "cloudRoleArn", d.CloudRoleArn) - populate(objectMap, "configuration", d.Configuration) populate(objectMap, "enabled", d.Enabled) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderFoDatabasesAwsOfferingArcAutoProvisioning. -func (d *DefenderFoDatabasesAwsOfferingArcAutoProvisioning) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderCspmJFrogOfferingMdcContainersImageAssessment. +func (d *DefenderCspmJFrogOfferingMdcContainersImageAssessment) UnmarshalJSON(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) @@ -6912,12 +6629,6 @@ func (d *DefenderFoDatabasesAwsOfferingArcAutoProvisioning) UnmarshalJSON(data [ for key, val := range rawMsg { var err error switch key { - case "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &d.CloudRoleArn) - delete(rawMsg, key) - case "configuration": - err = unpopulate(val, "Configuration", &d.Configuration) - delete(rawMsg, key) case "enabled": err = unpopulate(val, "Enabled", &d.Enabled) delete(rawMsg, key) @@ -6929,13 +6640,91 @@ func (d *DefenderFoDatabasesAwsOfferingArcAutoProvisioning) UnmarshalJSON(data [ return nil } -// MarshalJSON implements the json.Marshaller interface for type DefenderFoDatabasesAwsOfferingDatabasesDspm. -func (d DefenderFoDatabasesAwsOfferingDatabasesDspm) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DefenderFoDatabasesAwsOffering. +func (d DefenderFoDatabasesAwsOffering) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "cloudRoleArn", d.CloudRoleArn) - populate(objectMap, "enabled", d.Enabled) - return json.Marshal(objectMap) -} + populate(objectMap, "arcAutoProvisioning", d.ArcAutoProvisioning) + populate(objectMap, "databasesDspm", d.DatabasesDspm) + populate(objectMap, "description", d.Description) + objectMap["offeringType"] = OfferingTypeDefenderForDatabasesAws + populate(objectMap, "rds", d.Rds) + 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 "databasesDspm": + err = unpopulate(val, "DatabasesDspm", &d.DatabasesDspm) + 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) + case "rds": + err = unpopulate(val, "Rds", &d.Rds) + 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]any) + populate(objectMap, "cloudRoleArn", d.CloudRoleArn) + populate(objectMap, "configuration", d.Configuration) + populate(objectMap, "enabled", d.Enabled) + 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 "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 DefenderFoDatabasesAwsOfferingDatabasesDspm. +func (d DefenderFoDatabasesAwsOfferingDatabasesDspm) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "cloudRoleArn", d.CloudRoleArn) + populate(objectMap, "enabled", d.Enabled) + return json.Marshal(objectMap) +} // UnmarshalJSON implements the json.Unmarshaller interface for type DefenderFoDatabasesAwsOfferingDatabasesDspm. func (d *DefenderFoDatabasesAwsOfferingDatabasesDspm) UnmarshalJSON(data []byte) error { @@ -7275,6 +7064,37 @@ func (d *DefenderForContainersAwsOfferingVMScanners) UnmarshalJSON(data []byte) return nil } +// MarshalJSON implements the json.Marshaller interface for type DefenderForContainersDockerHubOffering. +func (d DefenderForContainersDockerHubOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", d.Description) + objectMap["offeringType"] = OfferingTypeDefenderForContainersDockerHub + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersDockerHubOffering. +func (d *DefenderForContainersDockerHubOffering) UnmarshalJSON(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 "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 DefenderForContainersGcpOffering. func (d DefenderForContainersGcpOffering) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -7501,6 +7321,37 @@ func (d *DefenderForContainersGcpOfferingVMScanners) UnmarshalJSON(data []byte) return nil } +// MarshalJSON implements the json.Marshaller interface for type DefenderForContainersJFrogOffering. +func (d DefenderForContainersJFrogOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "description", d.Description) + objectMap["offeringType"] = OfferingTypeDefenderForContainersJFrog + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersJFrogOffering. +func (d *DefenderForContainersJFrogOffering) UnmarshalJSON(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 "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 DefenderForDatabasesGcpOffering. func (d DefenderForDatabasesGcpOffering) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -8140,6 +7991,7 @@ func (d DefenderForStorageSetting) MarshalJSON() ([]byte, error) { populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } @@ -8162,6 +8014,9 @@ func (d *DefenderForStorageSetting) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) @@ -8173,6 +8028,37 @@ func (d *DefenderForStorageSetting) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DefenderForStorageSettingList. +func (d DefenderForStorageSettingList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", d.NextLink) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForStorageSettingList. +func (d *DefenderForStorageSettingList) UnmarshalJSON(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 DefenderForStorageSettingProperties. func (d DefenderForStorageSettingProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -8259,6 +8145,37 @@ func (d *DenylistCustomAlertRule) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type DevOpsCapability. +func (d DevOpsCapability) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "name", d.Name) + populate(objectMap, "value", d.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DevOpsCapability. +func (d *DevOpsCapability) UnmarshalJSON(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 "name": + err = unpopulate(val, "Name", &d.Name) + 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 DevOpsConfiguration. func (d DevOpsConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -8336,11 +8253,13 @@ func (d *DevOpsConfigurationListResponse) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type DevOpsConfigurationProperties. func (d DevOpsConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "agentlessConfiguration", d.AgentlessConfiguration) populate(objectMap, "authorization", d.Authorization) populate(objectMap, "autoDiscovery", d.AutoDiscovery) + populate(objectMap, "capabilities", d.Capabilities) populate(objectMap, "provisioningState", d.ProvisioningState) populate(objectMap, "provisioningStatusMessage", d.ProvisioningStatusMessage) - populateDateTimeRFC3339(objectMap, "provisioningStatusUpdateTimeUtc", d.ProvisioningStatusUpdateTimeUTC) + populateTime[datetime.RFC3339](objectMap, "provisioningStatusUpdateTimeUtc", d.ProvisioningStatusUpdateTimeUTC) populate(objectMap, "topLevelInventoryList", d.TopLevelInventoryList) return json.Marshal(objectMap) } @@ -8354,12 +8273,18 @@ func (d *DevOpsConfigurationProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "agentlessConfiguration": + err = unpopulate(val, "AgentlessConfiguration", &d.AgentlessConfiguration) + delete(rawMsg, key) case "authorization": err = unpopulate(val, "Authorization", &d.Authorization) delete(rawMsg, key) case "autoDiscovery": err = unpopulate(val, "AutoDiscovery", &d.AutoDiscovery) delete(rawMsg, key) + case "capabilities": + err = unpopulate(val, "Capabilities", &d.Capabilities) + delete(rawMsg, key) case "provisioningState": err = unpopulate(val, "ProvisioningState", &d.ProvisioningState) delete(rawMsg, key) @@ -8367,7 +8292,7 @@ func (d *DevOpsConfigurationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "ProvisioningStatusMessage", &d.ProvisioningStatusMessage) delete(rawMsg, key) case "provisioningStatusUpdateTimeUtc": - err = unpopulateDateTimeRFC3339(val, "ProvisioningStatusUpdateTimeUTC", &d.ProvisioningStatusUpdateTimeUTC) + err = unpopulateTime[datetime.RFC3339](val, "ProvisioningStatusUpdateTimeUTC", &d.ProvisioningStatusUpdateTimeUTC) delete(rawMsg, key) case "topLevelInventoryList": err = unpopulate(val, "TopLevelInventoryList", &d.TopLevelInventoryList) @@ -8386,6 +8311,7 @@ func (d DeviceSecurityGroup) MarshalJSON() ([]byte, error) { populate(objectMap, "id", d.ID) populate(objectMap, "name", d.Name) populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } @@ -8408,6 +8334,9 @@ func (d *DeviceSecurityGroup) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) @@ -8547,6 +8476,7 @@ func (d DiscoveredSecuritySolution) MarshalJSON() ([]byte, error) { populate(objectMap, "location", d.Location) populate(objectMap, "name", d.Name) populate(objectMap, "properties", d.Properties) + populate(objectMap, "systemData", d.SystemData) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } @@ -8572,6 +8502,9 @@ func (d *DiscoveredSecuritySolution) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &d.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &d.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &d.Type) delete(rawMsg, key) @@ -8653,59 +8586,36 @@ func (d *DiscoveredSecuritySolutionProperties) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type ETag. -func (e ETag) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type DockerHubEnvironmentData. +func (d DockerHubEnvironmentData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "etag", e.Etag) + populate(objectMap, "authentication", d.Authentication) + objectMap["environmentType"] = EnvironmentTypeDockerHubOrganization + populate(objectMap, "scanInterval", d.ScanInterval) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ETag. -func (e *ETag) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type DockerHubEnvironmentData. +func (d *DockerHubEnvironmentData) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } for key, val := range rawMsg { var err error switch key { - case "etag": - err = unpopulate(val, "Etag", &e.Etag) + case "authentication": + d.Authentication, err = unmarshalAuthenticationClassification(val) 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]any) - 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) + case "environmentType": + err = unpopulate(val, "EnvironmentType", &d.EnvironmentType) delete(rawMsg, key) - case "networkSecurityGroups": - err = unpopulate(val, "NetworkSecurityGroups", &e.NetworkSecurityGroups) + case "scanInterval": + err = unpopulate(val, "ScanInterval", &d.ScanInterval) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", e, err) + return fmt.Errorf("unmarshalling type %T: %v", d, err) } } return nil @@ -8714,7 +8624,7 @@ func (e *EffectiveNetworkSecurityGroups) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EnvironmentData. func (e EnvironmentData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["environmentType"] = e.EnvironmentType + populate(objectMap, "environmentType", e.EnvironmentType) return json.Marshal(objectMap) } @@ -8855,19 +8765,15 @@ func (e *ErrorDetail) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorDetailAutoGenerated. -func (e ErrorDetailAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ExecuteGovernanceRuleParams. +func (e ExecuteGovernanceRuleParams) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "additionalInfo", e.AdditionalInfo) - populate(objectMap, "code", e.Code) - populate(objectMap, "details", e.Details) - populate(objectMap, "message", e.Message) - populate(objectMap, "target", e.Target) + populate(objectMap, "override", e.Override) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorDetailAutoGenerated. -func (e *ErrorDetailAutoGenerated) UnmarshalJSON(data []byte) error { +// 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) @@ -8875,20 +8781,8 @@ func (e *ErrorDetailAutoGenerated) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "additionalInfo": - err = unpopulate(val, "AdditionalInfo", &e.AdditionalInfo) - delete(rawMsg, key) - case "code": - err = unpopulate(val, "Code", &e.Code) - delete(rawMsg, key) - case "details": - err = unpopulate(val, "Details", &e.Details) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &e.Message) - delete(rawMsg, key) - case "target": - err = unpopulate(val, "Target", &e.Target) + case "override": + err = unpopulate(val, "Override", &e.Override) delete(rawMsg, key) } if err != nil { @@ -8898,89 +8792,8 @@ func (e *ErrorDetailAutoGenerated) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ErrorResponse. -func (e ErrorResponse) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponse. -func (e *ErrorResponse) UnmarshalJSON(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 "error": - err = unpopulate(val, "Error", &e.Error) - 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 ErrorResponseAutoGenerated. -func (e ErrorResponseAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "error", e.Error) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ErrorResponseAutoGenerated. -func (e *ErrorResponseAutoGenerated) UnmarshalJSON(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 "error": - err = unpopulate(val, "Error", &e.Error) - 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]any) - 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 Extension. -func (e Extension) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Extension. +func (e Extension) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "additionalExtensionProperties", e.AdditionalExtensionProperties) populate(objectMap, "isEnabled", e.IsEnabled) @@ -9022,9 +8835,11 @@ func (e *Extension) UnmarshalJSON(data []byte) error { func (e ExternalSecuritySolution) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", e.ID) - objectMap["kind"] = e.Kind + populate(objectMap, "kind", e.Kind) populate(objectMap, "location", e.Location) populate(objectMap, "name", e.Name) + populateAny(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) populate(objectMap, "type", e.Type) return json.Marshal(objectMap) } @@ -9050,6 +8865,12 @@ func (e *ExternalSecuritySolution) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &e.Name) delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &e.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &e.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &e.Type) delete(rawMsg, key) @@ -9092,56 +8913,6 @@ func (e *ExternalSecuritySolutionList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ExternalSecuritySolutionProperties. -func (e ExternalSecuritySolutionProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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]any{} - } - if val != nil { - var aux any - 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]any) @@ -9244,80 +9015,44 @@ func (f *FileUploadsNotInAllowedRange) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type GcpCredentialsDetailsProperties. -func (g GcpCredentialsDetailsProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type FilesScanSummary. +func (f FilesScanSummary) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - 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) + populate(objectMap, "failedFilesCount", f.FailedFilesCount) + populate(objectMap, "maliciousFilesCount", f.MaliciousFilesCount) + populate(objectMap, "scannedFilesInGB", f.ScannedFilesInGB) + populate(objectMap, "skippedFilesCount", f.SkippedFilesCount) + populate(objectMap, "totalFilesScanned", f.TotalFilesScanned) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type GcpCredentialsDetailsProperties. -func (g *GcpCredentialsDetailsProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type FilesScanSummary. +func (f *FilesScanSummary) UnmarshalJSON(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) + return fmt.Errorf("unmarshalling type %T: %v", f, 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) + case "failedFilesCount": + err = unpopulate(val, "FailedFilesCount", &f.FailedFilesCount) delete(rawMsg, key) - case "clientX509CertUrl": - err = unpopulate(val, "ClientX509CertURL", &g.ClientX509CertURL) + case "maliciousFilesCount": + err = unpopulate(val, "MaliciousFilesCount", &f.MaliciousFilesCount) delete(rawMsg, key) - case "grantedPermissions": - err = unpopulate(val, "GrantedPermissions", &g.GrantedPermissions) + case "scannedFilesInGB": + err = unpopulate(val, "ScannedFilesInGB", &f.ScannedFilesInGB) delete(rawMsg, key) - case "organizationId": - err = unpopulate(val, "OrganizationID", &g.OrganizationID) + case "skippedFilesCount": + err = unpopulate(val, "SkippedFilesCount", &f.SkippedFilesCount) 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) + case "totalFilesScanned": + err = unpopulate(val, "TotalFilesScanned", &f.TotalFilesScanned) delete(rawMsg, key) } if err != nil { - return fmt.Errorf("unmarshalling type %T: %v", g, err) + return fmt.Errorf("unmarshalling type %T: %v", f, err) } } return nil @@ -9326,7 +9061,7 @@ func (g *GcpCredentialsDetailsProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type GcpOrganizationalData. func (g GcpOrganizationalData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["organizationMembershipType"] = g.OrganizationMembershipType + populate(objectMap, "organizationMembershipType", g.OrganizationMembershipType) return json.Marshal(objectMap) } @@ -9539,6 +9274,7 @@ func (g GetSensitivitySettingsResponse) MarshalJSON() ([]byte, error) { populate(objectMap, "id", g.ID) populate(objectMap, "name", g.Name) populate(objectMap, "properties", g.Properties) + populate(objectMap, "systemData", g.SystemData) populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } @@ -9561,6 +9297,9 @@ func (g *GetSensitivitySettingsResponse) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &g.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) @@ -9693,37 +9432,6 @@ func (g *GitHubOwner) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type GitHubOwnerConfiguration. -func (g GitHubOwnerConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "autoDiscovery", g.AutoDiscovery) - populate(objectMap, "repositoryConfigs", g.RepositoryConfigs) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GitHubOwnerConfiguration. -func (g *GitHubOwnerConfiguration) UnmarshalJSON(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 "autoDiscovery": - err = unpopulate(val, "AutoDiscovery", &g.AutoDiscovery) - delete(rawMsg, key) - case "repositoryConfigs": - err = unpopulate(val, "RepositoryConfigs", &g.RepositoryConfigs) - 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 GitHubOwnerListResponse. func (g GitHubOwnerListResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -9763,7 +9471,7 @@ func (g GitHubOwnerProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "ownerUrl", g.OwnerURL) populate(objectMap, "provisioningState", g.ProvisioningState) populate(objectMap, "provisioningStatusMessage", g.ProvisioningStatusMessage) - populateDateTimeRFC3339(objectMap, "provisioningStatusUpdateTimeUtc", g.ProvisioningStatusUpdateTimeUTC) + populateTime[datetime.RFC3339](objectMap, "provisioningStatusUpdateTimeUtc", g.ProvisioningStatusUpdateTimeUTC) return json.Marshal(objectMap) } @@ -9792,7 +9500,7 @@ func (g *GitHubOwnerProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "ProvisioningStatusMessage", &g.ProvisioningStatusMessage) delete(rawMsg, key) case "provisioningStatusUpdateTimeUtc": - err = unpopulateDateTimeRFC3339(val, "ProvisioningStatusUpdateTimeUTC", &g.ProvisioningStatusUpdateTimeUTC) + err = unpopulateTime[datetime.RFC3339](val, "ProvisioningStatusUpdateTimeUTC", &g.ProvisioningStatusUpdateTimeUTC) delete(rawMsg, key) } if err != nil { @@ -9883,7 +9591,7 @@ func (g GitHubRepositoryProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "parentOwnerName", g.ParentOwnerName) populate(objectMap, "provisioningState", g.ProvisioningState) populate(objectMap, "provisioningStatusMessage", g.ProvisioningStatusMessage) - populateDateTimeRFC3339(objectMap, "provisioningStatusUpdateTimeUtc", g.ProvisioningStatusUpdateTimeUTC) + populateTime[datetime.RFC3339](objectMap, "provisioningStatusUpdateTimeUtc", g.ProvisioningStatusUpdateTimeUTC) populate(objectMap, "repoFullName", g.RepoFullName) populate(objectMap, "repoId", g.RepoID) populate(objectMap, "repoName", g.RepoName) @@ -9913,7 +9621,7 @@ func (g *GitHubRepositoryProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "ProvisioningStatusMessage", &g.ProvisioningStatusMessage) delete(rawMsg, key) case "provisioningStatusUpdateTimeUtc": - err = unpopulateDateTimeRFC3339(val, "ProvisioningStatusUpdateTimeUTC", &g.ProvisioningStatusUpdateTimeUTC) + err = unpopulateTime[datetime.RFC3339](val, "ProvisioningStatusUpdateTimeUTC", &g.ProvisioningStatusUpdateTimeUTC) delete(rawMsg, key) case "repoFullName": err = unpopulate(val, "RepoFullName", &g.RepoFullName) @@ -9978,37 +9686,6 @@ func (g *GitLabGroup) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type GitLabGroupConfiguration. -func (g GitLabGroupConfiguration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "autoDiscovery", g.AutoDiscovery) - populate(objectMap, "projectConfigs", g.ProjectConfigs) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GitLabGroupConfiguration. -func (g *GitLabGroupConfiguration) UnmarshalJSON(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 "autoDiscovery": - err = unpopulate(val, "AutoDiscovery", &g.AutoDiscovery) - delete(rawMsg, key) - case "projectConfigs": - err = unpopulate(val, "ProjectConfigs", &g.ProjectConfigs) - 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 GitLabGroupListResponse. func (g GitLabGroupListResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -10048,7 +9725,7 @@ func (g GitLabGroupProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "onboardingState", g.OnboardingState) populate(objectMap, "provisioningState", g.ProvisioningState) populate(objectMap, "provisioningStatusMessage", g.ProvisioningStatusMessage) - populateDateTimeRFC3339(objectMap, "provisioningStatusUpdateTimeUtc", g.ProvisioningStatusUpdateTimeUTC) + populateTime[datetime.RFC3339](objectMap, "provisioningStatusUpdateTimeUtc", g.ProvisioningStatusUpdateTimeUTC) populate(objectMap, "url", g.URL) return json.Marshal(objectMap) } @@ -10078,7 +9755,7 @@ func (g *GitLabGroupProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "ProvisioningStatusMessage", &g.ProvisioningStatusMessage) delete(rawMsg, key) case "provisioningStatusUpdateTimeUtc": - err = unpopulateDateTimeRFC3339(val, "ProvisioningStatusUpdateTimeUTC", &g.ProvisioningStatusUpdateTimeUTC) + err = unpopulateTime[datetime.RFC3339](val, "ProvisioningStatusUpdateTimeUTC", &g.ProvisioningStatusUpdateTimeUTC) delete(rawMsg, key) case "url": err = unpopulate(val, "URL", &g.URL) @@ -10174,7 +9851,7 @@ func (g GitLabProjectProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "onboardingState", g.OnboardingState) populate(objectMap, "provisioningState", g.ProvisioningState) populate(objectMap, "provisioningStatusMessage", g.ProvisioningStatusMessage) - populateDateTimeRFC3339(objectMap, "provisioningStatusUpdateTimeUtc", g.ProvisioningStatusUpdateTimeUTC) + populateTime[datetime.RFC3339](objectMap, "provisioningStatusUpdateTimeUtc", g.ProvisioningStatusUpdateTimeUTC) populate(objectMap, "url", g.URL) return json.Marshal(objectMap) } @@ -10207,7 +9884,7 @@ func (g *GitLabProjectProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "ProvisioningStatusMessage", &g.ProvisioningStatusMessage) delete(rawMsg, key) case "provisioningStatusUpdateTimeUtc": - err = unpopulateDateTimeRFC3339(val, "ProvisioningStatusUpdateTimeUTC", &g.ProvisioningStatusUpdateTimeUTC) + err = unpopulateTime[datetime.RFC3339](val, "ProvisioningStatusUpdateTimeUTC", &g.ProvisioningStatusUpdateTimeUTC) delete(rawMsg, key) case "url": err = unpopulate(val, "URL", &g.URL) @@ -10280,6 +9957,7 @@ func (g GovernanceAssignment) MarshalJSON() ([]byte, error) { populate(objectMap, "id", g.ID) populate(objectMap, "name", g.Name) populate(objectMap, "properties", g.Properties) + populate(objectMap, "systemData", g.SystemData) populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } @@ -10302,6 +9980,9 @@ func (g *GovernanceAssignment) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &g.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) @@ -10355,7 +10036,7 @@ func (g GovernanceAssignmentProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "governanceEmailNotification", g.GovernanceEmailNotification) populate(objectMap, "isGracePeriod", g.IsGracePeriod) populate(objectMap, "owner", g.Owner) - populateDateTimeRFC3339(objectMap, "remediationDueDate", g.RemediationDueDate) + populateTime[datetime.RFC3339](objectMap, "remediationDueDate", g.RemediationDueDate) populate(objectMap, "remediationEta", g.RemediationEta) return json.Marshal(objectMap) } @@ -10382,7 +10063,7 @@ func (g *GovernanceAssignmentProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Owner", &g.Owner) delete(rawMsg, key) case "remediationDueDate": - err = unpopulateDateTimeRFC3339(val, "RemediationDueDate", &g.RemediationDueDate) + err = unpopulateTime[datetime.RFC3339](val, "RemediationDueDate", &g.RemediationDueDate) delete(rawMsg, key) case "remediationEta": err = unpopulate(val, "RemediationEta", &g.RemediationEta) @@ -10463,6 +10144,7 @@ func (g GovernanceRule) MarshalJSON() ([]byte, error) { populate(objectMap, "id", g.ID) populate(objectMap, "name", g.Name) populate(objectMap, "properties", g.Properties) + populate(objectMap, "systemData", g.SystemData) populate(objectMap, "type", g.Type) return json.Marshal(objectMap) } @@ -10485,6 +10167,9 @@ func (g *GovernanceRule) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &g.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &g.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &g.Type) delete(rawMsg, key) @@ -10562,9 +10247,9 @@ func (g *GovernanceRuleList) UnmarshalJSON(data []byte) error { func (g GovernanceRuleMetadata) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "createdBy", g.CreatedBy) - populateDateTimeRFC3339(objectMap, "createdOn", g.CreatedOn) + populateTime[datetime.RFC3339](objectMap, "createdOn", g.CreatedOn) populate(objectMap, "updatedBy", g.UpdatedBy) - populateDateTimeRFC3339(objectMap, "updatedOn", g.UpdatedOn) + populateTime[datetime.RFC3339](objectMap, "updatedOn", g.UpdatedOn) return json.Marshal(objectMap) } @@ -10581,13 +10266,13 @@ func (g *GovernanceRuleMetadata) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CreatedBy", &g.CreatedBy) delete(rawMsg, key) case "createdOn": - err = unpopulateDateTimeRFC3339(val, "CreatedOn", &g.CreatedOn) + err = unpopulateTime[datetime.RFC3339](val, "CreatedOn", &g.CreatedOn) delete(rawMsg, key) case "updatedBy": err = unpopulate(val, "UpdatedBy", &g.UpdatedBy) delete(rawMsg, key) case "updatedOn": - err = unpopulateDateTimeRFC3339(val, "UpdatedOn", &g.UpdatedOn) + err = unpopulateTime[datetime.RFC3339](val, "UpdatedOn", &g.UpdatedOn) delete(rawMsg, key) } if err != nil { @@ -10905,6 +10590,7 @@ func (h HealthReport) MarshalJSON() ([]byte, error) { populate(objectMap, "id", h.ID) populate(objectMap, "name", h.Name) populate(objectMap, "properties", h.Properties) + populate(objectMap, "systemData", h.SystemData) populate(objectMap, "type", h.Type) return json.Marshal(objectMap) } @@ -10927,6 +10613,9 @@ func (h *HealthReport) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &h.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &h.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &h.Type) delete(rawMsg, key) @@ -11024,59 +10713,14 @@ func (h *HealthReportsList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type HybridComputeSettingsProperties. -func (h HybridComputeSettingsProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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 Identity. func (i Identity) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "principalId", i.PrincipalID) populate(objectMap, "tenantId", i.TenantID) - objectMap["type"] = "SystemAssigned" + if i.Type != nil { + objectMap["type"] = "SystemAssigned" + } return json.Marshal(objectMap) } @@ -11186,6 +10830,7 @@ func (i InformationProtectionPolicy) MarshalJSON() ([]byte, error) { populate(objectMap, "id", i.ID) populate(objectMap, "name", i.Name) populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } @@ -11208,6 +10853,9 @@ func (i *InformationProtectionPolicy) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &i.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) @@ -11255,7 +10903,7 @@ func (i InformationProtectionPolicyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "informationTypes", i.InformationTypes) populate(objectMap, "labels", i.Labels) - populateDateTimeRFC3339(objectMap, "lastModifiedUtc", i.LastModifiedUTC) + populateTime[datetime.RFC3339](objectMap, "lastModifiedUtc", i.LastModifiedUTC) populate(objectMap, "version", i.Version) return json.Marshal(objectMap) } @@ -11276,7 +10924,7 @@ func (i *InformationProtectionPolicyProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, "Labels", &i.Labels) delete(rawMsg, key) case "lastModifiedUtc": - err = unpopulateDateTimeRFC3339(val, "LastModifiedUTC", &i.LastModifiedUTC) + err = unpopulateTime[datetime.RFC3339](val, "LastModifiedUTC", &i.LastModifiedUTC) delete(rawMsg, key) case "version": err = unpopulate(val, "Version", &i.Version) @@ -11340,12 +10988,44 @@ func (i *InformationType) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type InventoryList. +func (i InventoryList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "inventoryKind", i.InventoryKind) + populate(objectMap, "value", i.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type InventoryList. +func (i *InventoryList) UnmarshalJSON(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 "inventoryKind": + err = unpopulate(val, "InventoryKind", &i.InventoryKind) + 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 IoTSecurityAggregatedAlert. func (i IoTSecurityAggregatedAlert) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", i.ID) 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) @@ -11369,6 +11049,9 @@ func (i *IoTSecurityAggregatedAlert) UnmarshalJSON(data []byte) error { 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) @@ -11418,7 +11101,7 @@ func (i *IoTSecurityAggregatedAlertList) UnmarshalJSON(data []byte) error { func (i IoTSecurityAggregatedAlertProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "actionTaken", i.ActionTaken) - populateDateType(objectMap, "aggregatedDateUtc", i.AggregatedDateUTC) + populateTime[datetime.PlainDate](objectMap, "aggregatedDateUtc", i.AggregatedDateUTC) populate(objectMap, "alertDisplayName", i.AlertDisplayName) populate(objectMap, "alertType", i.AlertType) populate(objectMap, "count", i.Count) @@ -11446,7 +11129,7 @@ func (i *IoTSecurityAggregatedAlertProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, "ActionTaken", &i.ActionTaken) delete(rawMsg, key) case "aggregatedDateUtc": - err = unpopulateDateType(val, "AggregatedDateUTC", &i.AggregatedDateUTC) + err = unpopulateTime[datetime.PlainDate](val, "AggregatedDateUTC", &i.AggregatedDateUTC) delete(rawMsg, key) case "alertDisplayName": err = unpopulate(val, "AlertDisplayName", &i.AlertDisplayName) @@ -11530,6 +11213,7 @@ func (i IoTSecurityAggregatedRecommendation) MarshalJSON() ([]byte, error) { populate(objectMap, "id", i.ID) 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) @@ -11553,6 +11237,9 @@ func (i *IoTSecurityAggregatedRecommendation) UnmarshalJSON(data []byte) error { 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) @@ -11768,6 +11455,7 @@ func (i IoTSecuritySolutionAnalyticsModel) MarshalJSON() ([]byte, error) { populate(objectMap, "id", i.ID) populate(objectMap, "name", i.Name) populate(objectMap, "properties", i.Properties) + populate(objectMap, "systemData", i.SystemData) populate(objectMap, "type", i.Type) return json.Marshal(objectMap) } @@ -11790,6 +11478,9 @@ func (i *IoTSecuritySolutionAnalyticsModel) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &i.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &i.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &i.Type) delete(rawMsg, key) @@ -11882,7 +11573,7 @@ func (i *IoTSecuritySolutionAnalyticsModelProperties) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem. func (i IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "date", i.Date) + populateTime[datetime.RFC3339](objectMap, "date", i.Date) populate(objectMap, "devicesMetrics", i.DevicesMetrics) return json.Marshal(objectMap) } @@ -11897,7 +11588,7 @@ func (i *IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem) Unmarsha var err error switch key { case "date": - err = unpopulateDateTimeRFC3339(val, "Date", &i.Date) + err = unpopulateTime[datetime.RFC3339](val, "Date", &i.Date) delete(rawMsg, key) case "devicesMetrics": err = unpopulate(val, "DevicesMetrics", &i.DevicesMetrics) @@ -12145,7 +11836,65 @@ func (i *Issue) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type JitNetworkAccessPoliciesList. +// MarshalJSON implements the json.Marshaller interface for type IssueCreationRequest. +func (i IssueCreationRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "securityAssessmentResourceId", i.SecurityAssessmentResourceID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type IssueCreationRequest. +func (i *IssueCreationRequest) UnmarshalJSON(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 "securityAssessmentResourceId": + err = unpopulate(val, "SecurityAssessmentResourceID", &i.SecurityAssessmentResourceID) + 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 JFrogEnvironmentData. +func (j JFrogEnvironmentData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + objectMap["environmentType"] = EnvironmentTypeJFrogArtifactory + populate(objectMap, "scanInterval", j.ScanInterval) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type JFrogEnvironmentData. +func (j *JFrogEnvironmentData) UnmarshalJSON(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 "environmentType": + err = unpopulate(val, "EnvironmentType", &j.EnvironmentType) + delete(rawMsg, key) + case "scanInterval": + err = unpopulate(val, "ScanInterval", &j.ScanInterval) + 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 JitNetworkAccessPoliciesList. func (j JitNetworkAccessPoliciesList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", j.NextLink) @@ -12184,6 +11933,7 @@ func (j JitNetworkAccessPolicy) MarshalJSON() ([]byte, error) { populate(objectMap, "location", j.Location) populate(objectMap, "name", j.Name) populate(objectMap, "properties", j.Properties) + populate(objectMap, "systemData", j.SystemData) populate(objectMap, "type", j.Type) return json.Marshal(objectMap) } @@ -12212,6 +11962,9 @@ func (j *JitNetworkAccessPolicy) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &j.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &j.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &j.Type) delete(rawMsg, key) @@ -12227,7 +11980,7 @@ func (j *JitNetworkAccessPolicy) UnmarshalJSON(data []byte) error { func (j JitNetworkAccessPolicyInitiatePort) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "allowedSourceAddressPrefix", j.AllowedSourceAddressPrefix) - populateDateTimeRFC3339(objectMap, "endTimeUtc", j.EndTimeUTC) + populateTime[datetime.RFC3339](objectMap, "endTimeUtc", j.EndTimeUTC) populate(objectMap, "number", j.Number) return json.Marshal(objectMap) } @@ -12245,7 +11998,7 @@ func (j *JitNetworkAccessPolicyInitiatePort) UnmarshalJSON(data []byte) error { err = unpopulate(val, "AllowedSourceAddressPrefix", &j.AllowedSourceAddressPrefix) delete(rawMsg, key) case "endTimeUtc": - err = unpopulateDateTimeRFC3339(val, "EndTimeUTC", &j.EndTimeUTC) + err = unpopulateTime[datetime.RFC3339](val, "EndTimeUTC", &j.EndTimeUTC) delete(rawMsg, key) case "number": err = unpopulate(val, "Number", &j.Number) @@ -12438,7 +12191,7 @@ func (j JitNetworkAccessRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "justification", j.Justification) populate(objectMap, "requestor", j.Requestor) - populateDateTimeRFC3339(objectMap, "startTimeUtc", j.StartTimeUTC) + populateTime[datetime.RFC3339](objectMap, "startTimeUtc", j.StartTimeUTC) populate(objectMap, "virtualMachines", j.VirtualMachines) return json.Marshal(objectMap) } @@ -12459,7 +12212,7 @@ func (j *JitNetworkAccessRequest) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Requestor", &j.Requestor) delete(rawMsg, key) case "startTimeUtc": - err = unpopulateDateTimeRFC3339(val, "StartTimeUTC", &j.StartTimeUTC) + err = unpopulateTime[datetime.RFC3339](val, "StartTimeUTC", &j.StartTimeUTC) delete(rawMsg, key) case "virtualMachines": err = unpopulate(val, "VirtualMachines", &j.VirtualMachines) @@ -12477,7 +12230,7 @@ func (j JitNetworkAccessRequestPort) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "allowedSourceAddressPrefix", j.AllowedSourceAddressPrefix) populate(objectMap, "allowedSourceAddressPrefixes", j.AllowedSourceAddressPrefixes) - populateDateTimeRFC3339(objectMap, "endTimeUtc", j.EndTimeUTC) + populateTime[datetime.RFC3339](objectMap, "endTimeUtc", j.EndTimeUTC) populate(objectMap, "mappedPort", j.MappedPort) populate(objectMap, "number", j.Number) populate(objectMap, "status", j.Status) @@ -12501,7 +12254,7 @@ func (j *JitNetworkAccessRequestPort) UnmarshalJSON(data []byte) error { err = unpopulate(val, "AllowedSourceAddressPrefixes", &j.AllowedSourceAddressPrefixes) delete(rawMsg, key) case "endTimeUtc": - err = unpopulateDateTimeRFC3339(val, "EndTimeUTC", &j.EndTimeUTC) + err = unpopulateTime[datetime.RFC3339](val, "EndTimeUTC", &j.EndTimeUTC) delete(rawMsg, key) case "mappedPort": err = unpopulate(val, "MappedPort", &j.MappedPort) @@ -12554,33 +12307,6 @@ func (j *JitNetworkAccessRequestVirtualMachine) UnmarshalJSON(data []byte) error return nil } -// MarshalJSON implements the json.Marshaller interface for type KindAutoGenerated. -func (k KindAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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 Label. func (l Label) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -12706,33 +12432,6 @@ func (l *LocalUserNotAllowed) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Location. -func (l Location) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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]any) @@ -12776,9 +12475,85 @@ func (l *LogAnalyticsIdentifier) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type MalwareScan. +func (m MalwareScan) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "properties", m.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MalwareScan. +func (m *MalwareScan) UnmarshalJSON(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 "properties": + err = unpopulate(val, "Properties", &m.Properties) + 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 MalwareScanProperties. +func (m MalwareScanProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "scanEndTime", m.ScanEndTime) + populate(objectMap, "scanId", m.ScanID) + populate(objectMap, "scanStartTime", m.ScanStartTime) + populate(objectMap, "scanStatus", m.ScanStatus) + populate(objectMap, "scanStatusMessage", m.ScanStatusMessage) + populate(objectMap, "scanSummary", m.ScanSummary) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MalwareScanProperties. +func (m *MalwareScanProperties) UnmarshalJSON(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 "scanEndTime": + err = unpopulate(val, "ScanEndTime", &m.ScanEndTime) + delete(rawMsg, key) + case "scanId": + err = unpopulate(val, "ScanID", &m.ScanID) + delete(rawMsg, key) + case "scanStartTime": + err = unpopulate(val, "ScanStartTime", &m.ScanStartTime) + delete(rawMsg, key) + case "scanStatus": + err = unpopulate(val, "ScanStatus", &m.ScanStatus) + delete(rawMsg, key) + case "scanStatusMessage": + err = unpopulate(val, "ScanStatusMessage", &m.ScanStatusMessage) + delete(rawMsg, key) + case "scanSummary": + err = unpopulate(val, "ScanSummary", &m.ScanSummary) + 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 MalwareScanningProperties. func (m MalwareScanningProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "automatedResponse", m.AutomatedResponse) + populate(objectMap, "blobScanResultsOptions", m.BlobScanResultsOptions) populate(objectMap, "onUpload", m.OnUpload) populate(objectMap, "operationStatus", m.OperationStatus) populate(objectMap, "scanResultsEventGridTopicResourceId", m.ScanResultsEventGridTopicResourceID) @@ -12794,6 +12569,12 @@ func (m *MalwareScanningProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "automatedResponse": + err = unpopulate(val, "AutomatedResponse", &m.AutomatedResponse) + delete(rawMsg, key) + case "blobScanResultsOptions": + err = unpopulate(val, "BlobScanResultsOptions", &m.BlobScanResultsOptions) + delete(rawMsg, key) case "onUpload": err = unpopulate(val, "OnUpload", &m.OnUpload) delete(rawMsg, key) @@ -12817,6 +12598,7 @@ func (m MdeOnboardingData) MarshalJSON() ([]byte, error) { populate(objectMap, "id", m.ID) populate(objectMap, "name", m.Name) populate(objectMap, "properties", m.Properties) + populate(objectMap, "systemData", m.SystemData) populate(objectMap, "type", m.Type) return json.Marshal(objectMap) } @@ -12839,6 +12621,9 @@ func (m *MdeOnboardingData) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &m.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &m.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &m.Type) delete(rawMsg, key) @@ -13072,7 +12857,7 @@ func (m *MqttD2CMessagesNotInAllowedRange) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type NotificationsSource. func (n NotificationsSource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["sourceType"] = n.SourceType + populate(objectMap, "sourceType", n.SourceType) return json.Marshal(objectMap) } @@ -13162,7 +12947,7 @@ func (n *NotificationsSourceAttackPath) UnmarshalJSON(data []byte) error { func (o OnPremiseResourceDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "machineName", o.MachineName) - objectMap["source"] = SourceOnPremise + objectMap["source"] = SourceOnPremiseResourceDetails populate(objectMap, "sourceComputerId", o.SourceComputerID) populate(objectMap, "vmuuid", o.Vmuuid) populate(objectMap, "workspaceId", o.WorkspaceID) @@ -13252,10 +13037,46 @@ func (o *OnPremiseSQLResourceDetails) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type OnUploadFilters. +func (o OnUploadFilters) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateAny(objectMap, "excludeBlobsLargerThan", o.ExcludeBlobsLargerThan) + populate(objectMap, "excludeBlobsWithPrefix", o.ExcludeBlobsWithPrefix) + populate(objectMap, "excludeBlobsWithSuffix", o.ExcludeBlobsWithSuffix) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type OnUploadFilters. +func (o *OnUploadFilters) UnmarshalJSON(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 "excludeBlobsLargerThan": + err = unpopulate(val, "ExcludeBlobsLargerThan", &o.ExcludeBlobsLargerThan) + delete(rawMsg, key) + case "excludeBlobsWithPrefix": + err = unpopulate(val, "ExcludeBlobsWithPrefix", &o.ExcludeBlobsWithPrefix) + delete(rawMsg, key) + case "excludeBlobsWithSuffix": + err = unpopulate(val, "ExcludeBlobsWithSuffix", &o.ExcludeBlobsWithSuffix) + 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 OnUploadProperties. func (o OnUploadProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "capGBPerMonth", o.CapGBPerMonth) + populate(objectMap, "filters", o.Filters) populate(objectMap, "isEnabled", o.IsEnabled) return json.Marshal(objectMap) } @@ -13272,6 +13093,9 @@ func (o *OnUploadProperties) UnmarshalJSON(data []byte) error { case "capGBPerMonth": err = unpopulate(val, "CapGBPerMonth", &o.CapGBPerMonth) delete(rawMsg, key) + case "filters": + err = unpopulate(val, "Filters", &o.Filters) + delete(rawMsg, key) case "isEnabled": err = unpopulate(val, "IsEnabled", &o.IsEnabled) delete(rawMsg, key) @@ -13286,7 +13110,9 @@ func (o *OnUploadProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "actionType", o.ActionType) populate(objectMap, "display", o.Display) + populate(objectMap, "isDataAction", o.IsDataAction) populate(objectMap, "name", o.Name) populate(objectMap, "origin", o.Origin) return json.Marshal(objectMap) @@ -13301,9 +13127,15 @@ func (o *Operation) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "actionType": + err = unpopulate(val, "ActionType", &o.ActionType) + delete(rawMsg, key) case "display": err = unpopulate(val, "Display", &o.Display) delete(rawMsg, key) + case "isDataAction": + err = unpopulate(val, "IsDataAction", &o.IsDataAction) + delete(rawMsg, key) case "name": err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) @@ -13357,16 +13189,16 @@ func (o *OperationDisplay) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationList. -func (o OperationList) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationListResult. +func (o OperationListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) 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 { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationListResult. +func (o *OperationListResult) UnmarshalJSON(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) @@ -13388,15 +13220,15 @@ func (o *OperationList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationResultAutoGenerated. -func (o OperationResultAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type OperationResult. +func (o OperationResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "status", o.Status) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResultAutoGenerated. -func (o *OperationResultAutoGenerated) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type OperationResult. +func (o *OperationResult) UnmarshalJSON(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) @@ -13446,47 +13278,17 @@ func (o *OperationStatus) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type OperationStatusAutoGenerated. -func (o OperationStatusAutoGenerated) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", o.Code) - populate(objectMap, "message", o.Message) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type OperationStatusAutoGenerated. -func (o *OperationStatusAutoGenerated) UnmarshalJSON(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 "code": - err = unpopulate(val, "Code", &o.Code) - delete(rawMsg, key) - case "message": - err = unpopulate(val, "Message", &o.Message) - 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 OperationStatusResult. func (o OperationStatusResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "endTime", o.EndTime) + populateTime[datetime.RFC3339](objectMap, "endTime", o.EndTime) populate(objectMap, "error", o.Error) populate(objectMap, "id", o.ID) populate(objectMap, "name", o.Name) populate(objectMap, "operations", o.Operations) populate(objectMap, "percentComplete", o.PercentComplete) - populateDateTimeRFC3339(objectMap, "startTime", o.StartTime) + populate(objectMap, "resourceId", o.ResourceID) + populateTime[datetime.RFC3339](objectMap, "startTime", o.StartTime) populate(objectMap, "status", o.Status) return json.Marshal(objectMap) } @@ -13501,7 +13303,7 @@ func (o *OperationStatusResult) UnmarshalJSON(data []byte) error { var err error switch key { case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &o.EndTime) + err = unpopulateTime[datetime.RFC3339](val, "EndTime", &o.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, "Error", &o.Error) @@ -13518,8 +13320,11 @@ func (o *OperationStatusResult) UnmarshalJSON(data []byte) error { case "percentComplete": err = unpopulate(val, "PercentComplete", &o.PercentComplete) delete(rawMsg, key) + case "resourceId": + err = unpopulate(val, "ResourceID", &o.ResourceID) + delete(rawMsg, key) case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &o.StartTime) + err = unpopulateTime[datetime.RFC3339](val, "StartTime", &o.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &o.Status) @@ -13565,6 +13370,7 @@ func (o OperatorResource) MarshalJSON() ([]byte, error) { populate(objectMap, "id", o.ID) populate(objectMap, "identity", o.Identity) populate(objectMap, "name", o.Name) + populate(objectMap, "systemData", o.SystemData) populate(objectMap, "type", o.Type) return json.Marshal(objectMap) } @@ -13587,6 +13393,9 @@ func (o *OperatorResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &o.Name) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &o.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &o.Type) delete(rawMsg, key) @@ -13598,23 +13407,15 @@ func (o *OperatorResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PathRecommendation. -func (p PathRecommendation) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PartialAssessmentProperties. +func (p PartialAssessmentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - 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) + populate(objectMap, "assessmentKey", p.AssessmentKey) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PathRecommendation. -func (p *PathRecommendation) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PartialAssessmentProperties. +func (p *PartialAssessmentProperties) UnmarshalJSON(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) @@ -13622,32 +13423,8 @@ func (p *PathRecommendation) UnmarshalJSON(data []byte) error { 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) + case "assessmentKey": + err = unpopulate(val, "AssessmentKey", &p.AssessmentKey) delete(rawMsg, key) } if err != nil { @@ -13663,6 +13440,7 @@ func (p Pricing) MarshalJSON() ([]byte, error) { populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } @@ -13685,6 +13463,9 @@ func (p *Pricing) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -13727,7 +13508,7 @@ func (p *PricingList) UnmarshalJSON(data []byte) error { func (p PricingProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "deprecated", p.Deprecated) - populateDateTimeRFC3339(objectMap, "enablementTime", p.EnablementTime) + populateTime[datetime.RFC3339](objectMap, "enablementTime", p.EnablementTime) populate(objectMap, "enforce", p.Enforce) populate(objectMap, "extensions", p.Extensions) populate(objectMap, "freeTrialRemainingTime", p.FreeTrialRemainingTime) @@ -13753,7 +13534,7 @@ func (p *PricingProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Deprecated", &p.Deprecated) delete(rawMsg, key) case "enablementTime": - err = unpopulateDateTimeRFC3339(val, "EnablementTime", &p.EnablementTime) + err = unpopulateTime[datetime.RFC3339](val, "EnablementTime", &p.EnablementTime) delete(rawMsg, key) case "enforce": err = unpopulate(val, "Enforce", &p.Enforce) @@ -13790,20 +13571,15 @@ func (p *PricingProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProcessNotAllowed. -func (p ProcessNotAllowed) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpoint. +func (p PrivateEndpoint) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - 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) + populate(objectMap, "id", p.ID) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProcessNotAllowed. -func (p *ProcessNotAllowed) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpoint. +func (p *PrivateEndpoint) UnmarshalJSON(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) @@ -13811,23 +13587,8 @@ func (p *ProcessNotAllowed) UnmarshalJSON(data []byte) error { 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) + case "id": + err = unpopulate(val, "ID", &p.ID) delete(rawMsg, key) } if err != nil { @@ -13837,18 +13598,19 @@ func (p *ProcessNotAllowed) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProtectionMode. -func (p ProtectionMode) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "exe", p.Exe) - populate(objectMap, "executable", p.Executable) - populate(objectMap, "msi", p.Msi) - populate(objectMap, "script", p.Script) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProtectionMode. -func (p *ProtectionMode) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnection. +func (p *PrivateEndpointConnection) UnmarshalJSON(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) @@ -13856,17 +13618,20 @@ func (p *ProtectionMode) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "exe": - err = unpopulate(val, "Exe", &p.Exe) + case "id": + err = unpopulate(val, "ID", &p.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) - case "executable": - err = unpopulate(val, "Executable", &p.Executable) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) delete(rawMsg, key) - case "msi": - err = unpopulate(val, "Msi", &p.Msi) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) delete(rawMsg, key) - case "script": - err = unpopulate(val, "Script", &p.Script) + case "type": + err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) } if err != nil { @@ -13876,17 +13641,89 @@ func (p *ProtectionMode) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyResource. -func (p ProxyResource) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "id", p.ID) - populate(objectMap, "name", p.Name) - populate(objectMap, "type", p.Type) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionListResult. +func (p *PrivateEndpointConnectionListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionProperties. +func (p PrivateEndpointConnectionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupIds", p.GroupIDs) + populate(objectMap, "privateEndpoint", p.PrivateEndpoint) + populate(objectMap, "privateLinkServiceConnectionState", p.PrivateLinkServiceConnectionState) + populate(objectMap, "provisioningState", p.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateEndpointConnectionProperties. +func (p *PrivateEndpointConnectionProperties) UnmarshalJSON(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 "groupIds": + err = unpopulate(val, "GroupIDs", &p.GroupIDs) + delete(rawMsg, key) + case "privateEndpoint": + err = unpopulate(val, "PrivateEndpoint", &p.PrivateEndpoint) + delete(rawMsg, key) + case "privateLinkServiceConnectionState": + err = unpopulate(val, "PrivateLinkServiceConnectionState", &p.PrivateLinkServiceConnectionState) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) + 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 PrivateLinkGroupResource. +func (p PrivateLinkGroupResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "type", p.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyResource. -func (p *ProxyResource) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkGroupResource. +func (p *PrivateLinkGroupResource) UnmarshalJSON(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) @@ -13900,6 +13737,12 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &p.Name) delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &p.Type) delete(rawMsg, key) @@ -13911,16 +13754,16 @@ func (p *ProxyResource) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ProxyServerProperties. -func (p ProxyServerProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkGroupResourceListResult. +func (p PrivateLinkGroupResourceListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "ip", p.IP) - populate(objectMap, "port", p.Port) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ProxyServerProperties. -func (p *ProxyServerProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkGroupResourceListResult. +func (p *PrivateLinkGroupResourceListResult) UnmarshalJSON(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) @@ -13928,11 +13771,11 @@ func (p *ProxyServerProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "ip": - err = unpopulate(val, "IP", &p.IP) + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) delete(rawMsg, key) - case "port": - err = unpopulate(val, "Port", &p.Port) + case "value": + err = unpopulate(val, "Value", &p.Value) delete(rawMsg, key) } if err != nil { @@ -13942,18 +13785,18 @@ func (p *ProxyServerProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type PublisherInfo. -func (p PublisherInfo) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkProperties. +func (p PrivateLinkProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "binaryName", p.BinaryName) - populate(objectMap, "productName", p.ProductName) - populate(objectMap, "publisherName", p.PublisherName) - populate(objectMap, "version", p.Version) + populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) + populate(objectMap, "privateLinkResources", p.PrivateLinkResources) + populate(objectMap, "provisioningState", p.ProvisioningState) + populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PublisherInfo. -func (p *PublisherInfo) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkProperties. +func (p *PrivateLinkProperties) UnmarshalJSON(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) @@ -13961,17 +13804,243 @@ func (p *PublisherInfo) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "binaryName": - err = unpopulate(val, "BinaryName", &p.BinaryName) + case "privateEndpointConnections": + err = unpopulate(val, "PrivateEndpointConnections", &p.PrivateEndpointConnections) delete(rawMsg, key) - case "productName": - err = unpopulate(val, "ProductName", &p.ProductName) + case "privateLinkResources": + err = unpopulate(val, "PrivateLinkResources", &p.PrivateLinkResources) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &p.ProvisioningState) delete(rawMsg, key) - case "publisherName": - err = unpopulate(val, "PublisherName", &p.PublisherName) + case "publicNetworkAccess": + err = unpopulate(val, "PublicNetworkAccess", &p.PublicNetworkAccess) delete(rawMsg, key) - case "version": - err = unpopulate(val, "Version", &p.Version) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type PrivateLinkResource. +func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", p.ID) + populate(objectMap, "location", p.Location) + populate(objectMap, "name", p.Name) + populate(objectMap, "properties", p.Properties) + populate(objectMap, "systemData", p.SystemData) + populate(objectMap, "tags", p.Tags) + populate(objectMap, "type", p.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. +func (p *PrivateLinkResource) UnmarshalJSON(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 "location": + err = unpopulate(val, "Location", &p.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &p.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &p.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &p.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &p.Tags) + 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 PrivateLinkResourceProperties. +func (p PrivateLinkResourceProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "groupId", p.GroupID) + populate(objectMap, "requiredMembers", p.RequiredMembers) + populate(objectMap, "requiredZoneNames", p.RequiredZoneNames) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResourceProperties. +func (p *PrivateLinkResourceProperties) UnmarshalJSON(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 "groupId": + err = unpopulate(val, "GroupID", &p.GroupID) + delete(rawMsg, key) + case "requiredMembers": + err = unpopulate(val, "RequiredMembers", &p.RequiredMembers) + delete(rawMsg, key) + case "requiredZoneNames": + err = unpopulate(val, "RequiredZoneNames", &p.RequiredZoneNames) + 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 PrivateLinkServiceConnectionState. +func (p PrivateLinkServiceConnectionState) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "actionsRequired", p.ActionsRequired) + populate(objectMap, "description", p.Description) + populate(objectMap, "status", p.Status) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkServiceConnectionState. +func (p *PrivateLinkServiceConnectionState) UnmarshalJSON(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 "actionsRequired": + err = unpopulate(val, "ActionsRequired", &p.ActionsRequired) + delete(rawMsg, key) + case "description": + err = unpopulate(val, "Description", &p.Description) + delete(rawMsg, key) + case "status": + err = unpopulate(val, "Status", &p.Status) + 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 PrivateLinkUpdate. +func (p PrivateLinkUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "tags", p.Tags) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkUpdate. +func (p *PrivateLinkUpdate) UnmarshalJSON(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 "tags": + err = unpopulate(val, "Tags", &p.Tags) + 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 PrivateLinksList. +func (p PrivateLinksList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", p.NextLink) + populate(objectMap, "value", p.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinksList. +func (p *PrivateLinksList) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &p.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &p.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", p, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ProcessNotAllowed. +func (p ProcessNotAllowed) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + 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 { @@ -14108,6 +14177,7 @@ func (r RegulatoryComplianceAssessment) MarshalJSON() ([]byte, error) { populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -14130,6 +14200,9 @@ func (r *RegulatoryComplianceAssessment) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -14233,6 +14306,7 @@ func (r RegulatoryComplianceControl) MarshalJSON() ([]byte, error) { populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -14255,6 +14329,9 @@ func (r *RegulatoryComplianceControl) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -14346,6 +14423,7 @@ func (r RegulatoryComplianceStandard) MarshalJSON() ([]byte, error) { populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -14368,6 +14446,9 @@ func (r *RegulatoryComplianceStandard) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -14495,7 +14576,7 @@ func (r *Remediation) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RemediationEta. func (r RemediationEta) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "eta", r.Eta) + populateTime[datetime.RFC3339](objectMap, "eta", r.Eta) populate(objectMap, "justification", r.Justification) return json.Marshal(objectMap) } @@ -14510,7 +14591,7 @@ func (r *RemediationEta) UnmarshalJSON(data []byte) error { var err error switch key { case "eta": - err = unpopulateDateTimeRFC3339(val, "Eta", &r.Eta) + err = unpopulateTime[datetime.RFC3339](val, "Eta", &r.Eta) delete(rawMsg, key) case "justification": err = unpopulate(val, "Justification", &r.Justification) @@ -14523,52 +14604,18 @@ func (r *RemediationEta) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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 ResourceAutoGenerated. -func (r ResourceAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceDetails. +func (r ResourceDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "connectorId", r.ConnectorID) populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "type", r.Type) + populate(objectMap, "source", r.Source) + populate(objectMap, "source", r.Source) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated. -func (r *ResourceAutoGenerated) UnmarshalJSON(data []byte) error { +// 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) @@ -14576,78 +14623,15 @@ func (r *ResourceAutoGenerated) UnmarshalJSON(data []byte) error { 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) + case "connectorId": + err = unpopulate(val, "ConnectorID", &r.ConnectorID) 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 ResourceAutoGenerated2. -func (r ResourceAutoGenerated2) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "id", r.ID) - populate(objectMap, "name", r.Name) - populate(objectMap, "systemData", r.SystemData) - populate(objectMap, "type", r.Type) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceAutoGenerated2. -func (r *ResourceAutoGenerated2) UnmarshalJSON(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 "systemData": - err = unpopulate(val, "SystemData", &r.SystemData) - delete(rawMsg, key) - case "type": - err = unpopulate(val, "Type", &r.Type) + 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 ResourceDetails. -func (r ResourceDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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) @@ -14659,17 +14643,18 @@ func (r *ResourceDetails) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ResourceDetailsAutoGenerated. -func (r ResourceDetailsAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ResourceDetails. +func (r ResourceDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "connectorId", r.ConnectorID) populate(objectMap, "id", r.ID) populate(objectMap, "source", r.Source) + populate(objectMap, "source", r.Source) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ResourceDetailsAutoGenerated. -func (r *ResourceDetailsAutoGenerated) UnmarshalJSON(data []byte) error { +// 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) @@ -14686,6 +14671,9 @@ func (r *ResourceDetailsAutoGenerated) UnmarshalJSON(data []byte) error { case "source": err = unpopulate(val, "Source", &r.Source) delete(rawMsg, key) + case "source": + err = unpopulate(val, "Source", &r.Source) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -14697,7 +14685,7 @@ func (r *ResourceDetailsAutoGenerated) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ResourceIdentifier. func (r ResourceIdentifier) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["type"] = r.Type + populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -14721,55 +14709,13 @@ func (r *ResourceIdentifier) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Rule. -func (r Rule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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]any) populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) populate(objectMap, "properties", r.Properties) + populate(objectMap, "systemData", r.SystemData) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -14792,6 +14738,9 @@ func (r *RuleResults) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &r.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &r.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &r.Type) delete(rawMsg, key) @@ -14837,6 +14786,7 @@ func (r *RuleResultsInput) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RuleResultsProperties. func (r RuleResultsProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "latestScan", r.LatestScan) populate(objectMap, "results", r.Results) return json.Marshal(objectMap) } @@ -14850,6 +14800,9 @@ func (r *RuleResultsProperties) UnmarshalJSON(data []byte) error { 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) @@ -14864,6 +14817,7 @@ func (r *RuleResultsProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type RulesResults. func (r RulesResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", r.NextLink) populate(objectMap, "value", r.Value) return json.Marshal(objectMap) } @@ -14877,6 +14831,9 @@ func (r *RulesResults) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &r.NextLink) + delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &r.Value) delete(rawMsg, key) @@ -14954,18 +14911,93 @@ func (s *SQLServerVulnerabilityProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Scan. -func (s Scan) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLVulnerabilityAssessmentScanOperationResult. +func (s SQLVulnerabilityAssessmentScanOperationResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLVulnerabilityAssessmentScanOperationResult. +func (s *SQLVulnerabilityAssessmentScanOperationResult) UnmarshalJSON(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 "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type SQLVulnerabilityAssessmentScanOperationResultProperties. +func (s SQLVulnerabilityAssessmentScanOperationResultProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "operationId", s.OperationID) + populate(objectMap, "scanStatus", s.ScanStatus) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLVulnerabilityAssessmentScanOperationResultProperties. +func (s *SQLVulnerabilityAssessmentScanOperationResultProperties) UnmarshalJSON(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 "operationId": + err = unpopulate(val, "OperationID", &s.OperationID) + delete(rawMsg, key) + case "scanStatus": + err = unpopulate(val, "ScanStatus", &s.ScanStatus) + 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 SQLVulnerabilityAssessmentSettings. +func (s SQLVulnerabilityAssessmentSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Scan. -func (s *Scan) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLVulnerabilityAssessmentSettings. +func (s *SQLVulnerabilityAssessmentSettings) UnmarshalJSON(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) @@ -14982,6 +15014,9 @@ func (s *Scan) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) @@ -14993,19 +15028,50 @@ func (s *Scan) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ScanProperties. -func (s ScanProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type SQLVulnerabilityAssessmentSettingsProperties. +func (s SQLVulnerabilityAssessmentSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populateTime[datetime.RFC3339](objectMap, "creationTime", s.CreationTime) + populate(objectMap, "state", s.State) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SQLVulnerabilityAssessmentSettingsProperties. +func (s *SQLVulnerabilityAssessmentSettingsProperties) UnmarshalJSON(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 "creationTime": + err = unpopulateTime[datetime.RFC3339](val, "CreationTime", &s.CreationTime) + delete(rawMsg, key) + case "state": + err = unpopulate(val, "State", &s.State) + 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 ScanPropertiesV2. +func (s ScanPropertiesV2) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "database", s.Database) - populateDateTimeRFC3339(objectMap, "endTime", s.EndTime) + populateTime[datetime.RFC3339](objectMap, "endTime", s.EndTime) populate(objectMap, "highSeverityFailedRulesCount", s.HighSeverityFailedRulesCount) populate(objectMap, "isBaselineApplied", s.IsBaselineApplied) - populateDateTimeRFC3339(objectMap, "lastScanTime", s.LastScanTime) + populateTime[datetime.RFC3339](objectMap, "lastScanTime", s.LastScanTime) populate(objectMap, "lowSeverityFailedRulesCount", s.LowSeverityFailedRulesCount) populate(objectMap, "mediumSeverityFailedRulesCount", s.MediumSeverityFailedRulesCount) populate(objectMap, "sqlVersion", s.SQLVersion) populate(objectMap, "server", s.Server) - populateDateTimeRFC3339(objectMap, "startTime", s.StartTime) + populateTime[datetime.RFC3339](objectMap, "startTime", s.StartTime) populate(objectMap, "state", s.State) populate(objectMap, "totalFailedRulesCount", s.TotalFailedRulesCount) populate(objectMap, "totalPassedRulesCount", s.TotalPassedRulesCount) @@ -15014,8 +15080,8 @@ func (s ScanProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ScanProperties. -func (s *ScanProperties) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScanPropertiesV2. +func (s *ScanPropertiesV2) UnmarshalJSON(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) @@ -15027,7 +15093,7 @@ func (s *ScanProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Database", &s.Database) delete(rawMsg, key) case "endTime": - err = unpopulateDateTimeRFC3339(val, "EndTime", &s.EndTime) + err = unpopulateTime[datetime.RFC3339](val, "EndTime", &s.EndTime) delete(rawMsg, key) case "highSeverityFailedRulesCount": err = unpopulate(val, "HighSeverityFailedRulesCount", &s.HighSeverityFailedRulesCount) @@ -15036,7 +15102,7 @@ func (s *ScanProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "IsBaselineApplied", &s.IsBaselineApplied) delete(rawMsg, key) case "lastScanTime": - err = unpopulateDateTimeRFC3339(val, "LastScanTime", &s.LastScanTime) + err = unpopulateTime[datetime.RFC3339](val, "LastScanTime", &s.LastScanTime) delete(rawMsg, key) case "lowSeverityFailedRulesCount": err = unpopulate(val, "LowSeverityFailedRulesCount", &s.LowSeverityFailedRulesCount) @@ -15051,7 +15117,7 @@ func (s *ScanProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Server", &s.Server) delete(rawMsg, key) case "startTime": - err = unpopulateDateTimeRFC3339(val, "StartTime", &s.StartTime) + err = unpopulateTime[datetime.RFC3339](val, "StartTime", &s.StartTime) delete(rawMsg, key) case "state": err = unpopulate(val, "State", &s.State) @@ -15082,6 +15148,7 @@ func (s ScanResult) MarshalJSON() ([]byte, error) { populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } @@ -15104,6 +15171,9 @@ func (s *ScanResult) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) @@ -15169,6 +15239,7 @@ func (s *ScanResultProperties) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type ScanResults. func (s ScanResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } @@ -15182,6 +15253,9 @@ func (s *ScanResults) UnmarshalJSON(data []byte) error { 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) @@ -15193,15 +15267,17 @@ func (s *ScanResults) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Scans. -func (s Scans) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ScanSummary. +func (s ScanSummary) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populate(objectMap, "value", s.Value) + populate(objectMap, "blobs", s.Blobs) + populate(objectMap, "estimatedScanCostUSD", s.EstimatedScanCostUSD) + populate(objectMap, "files", s.Files) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type Scans. -func (s *Scans) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type ScanSummary. +func (s *ScanSummary) UnmarshalJSON(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) @@ -15209,8 +15285,88 @@ func (s *Scans) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "value": - err = unpopulate(val, "Value", &s.Value) + case "blobs": + err = unpopulate(val, "Blobs", &s.Blobs) + delete(rawMsg, key) + case "estimatedScanCostUSD": + err = unpopulate(val, "EstimatedScanCostUSD", &s.EstimatedScanCostUSD) + delete(rawMsg, key) + case "files": + err = unpopulate(val, "Files", &s.Files) + 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 ScanV2. +func (s ScanV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScanV2. +func (s *ScanV2) UnmarshalJSON(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 "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type ScansV2. +func (s ScansV2) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ScansV2. +func (s *ScansV2) UnmarshalJSON(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 { @@ -15303,6 +15459,7 @@ func (s SecureScoreControlDefinitionItem) MarshalJSON() ([]byte, error) { populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } @@ -15325,6 +15482,9 @@ func (s *SecureScoreControlDefinitionItem) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) @@ -15443,6 +15603,7 @@ func (s SecureScoreControlDetails) MarshalJSON() ([]byte, error) { populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } @@ -15465,6 +15626,9 @@ func (s *SecureScoreControlDetails) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) @@ -15507,41 +15671,6 @@ func (s *SecureScoreControlList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type SecureScoreControlScore. -func (s SecureScoreControlScore) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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]any) @@ -15599,6 +15728,7 @@ func (s SecureScoreItem) MarshalJSON() ([]byte, error) { populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } @@ -15621,6 +15751,9 @@ func (s *SecureScoreItem) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) @@ -15778,6 +15911,7 @@ func (s ServerVulnerabilityAssessment) MarshalJSON() ([]byte, error) { populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } @@ -15800,6 +15934,9 @@ func (s *ServerVulnerabilityAssessment) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) @@ -15896,8 +16033,9 @@ func (s *ServerVulnerabilityAssessmentsList) UnmarshalJSON(data []byte) error { func (s ServerVulnerabilityAssessmentsSetting) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "id", s.ID) - objectMap["kind"] = s.Kind + populate(objectMap, "kind", s.Kind) populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) populate(objectMap, "systemData", s.SystemData) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) @@ -15921,6 +16059,9 @@ func (s *ServerVulnerabilityAssessmentsSetting) UnmarshalJSON(data []byte) error case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) case "systemData": err = unpopulate(val, "SystemData", &s.SystemData) delete(rawMsg, key) @@ -15969,11 +16110,11 @@ func (s *ServerVulnerabilityAssessmentsSettingsList) UnmarshalJSON(data []byte) // MarshalJSON implements the json.Marshaller interface for type ServerVulnerabilityProperties. func (s ServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - objectMap["assessedResourceType"] = "ServerVulnerabilityAssessment" + objectMap["assessedResourceType"] = AssessedResourceTypeServerVulnerabilityAssessment populate(objectMap, "cve", s.Cve) populate(objectMap, "cvss", s.Cvss) populate(objectMap, "patchable", s.Patchable) - populateDateTimeRFC3339(objectMap, "publishedTime", s.PublishedTime) + populateTime[datetime.RFC3339](objectMap, "publishedTime", s.PublishedTime) populate(objectMap, "threat", s.Threat) populate(objectMap, "type", s.Type) populate(objectMap, "vendorReferences", s.VendorReferences) @@ -16002,7 +16143,7 @@ func (s *ServerVulnerabilityProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Patchable", &s.Patchable) delete(rawMsg, key) case "publishedTime": - err = unpopulateDateTimeRFC3339(val, "PublishedTime", &s.PublishedTime) + err = unpopulateTime[datetime.RFC3339](val, "PublishedTime", &s.PublishedTime) delete(rawMsg, key) case "threat": err = unpopulate(val, "Threat", &s.Threat) @@ -16021,43 +16162,14 @@ func (s *ServerVulnerabilityProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type ServicePrincipalProperties. -func (s ServicePrincipalProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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]any) populate(objectMap, "id", s.ID) - objectMap["kind"] = s.Kind + populate(objectMap, "kind", s.Kind) populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } @@ -16080,6 +16192,12 @@ func (s *Setting) UnmarshalJSON(data []byte) error { case "name": err = unpopulate(val, "Name", &s.Name) delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) @@ -16122,135 +16240,6 @@ func (s *SettingsList) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Software. -func (s Software) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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]any) - 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]any) - 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]any) @@ -16258,6 +16247,7 @@ func (s Solution) MarshalJSON() ([]byte, error) { populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } @@ -16283,6 +16273,9 @@ func (s *Solution) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) @@ -16371,6 +16364,7 @@ func (s SolutionsReferenceData) MarshalJSON() ([]byte, error) { populate(objectMap, "location", s.Location) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } @@ -16396,6 +16390,9 @@ func (s *SolutionsReferenceData) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) @@ -16447,8 +16444,503 @@ func (s SolutionsReferenceDataProperties) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SolutionsReferenceDataProperties. -func (s *SolutionsReferenceDataProperties) UnmarshalJSON(data []byte) error { +// 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 Standard. +func (s Standard) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "etag", s.Etag) + populate(objectMap, "id", s.ID) + populate(objectMap, "kind", s.Kind) + populate(objectMap, "location", s.Location) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "tags", s.Tags) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type Standard. +func (s *Standard) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "etag": + err = unpopulate(val, "Etag", &s.Etag) + delete(rawMsg, key) + case "id": + err = unpopulate(val, "ID", &s.ID) + delete(rawMsg, key) + case "kind": + err = unpopulate(val, "Kind", &s.Kind) + delete(rawMsg, key) + case "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 "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &s.Tags) + 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 StandardAssignment. +func (s StandardAssignment) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandardAssignment. +func (s *StandardAssignment) UnmarshalJSON(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 "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &s.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", s, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type StandardAssignmentMetadata. +func (s StandardAssignmentMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "createdBy", s.CreatedBy) + populateTime[datetime.RFC3339](objectMap, "createdOn", s.CreatedOn) + populate(objectMap, "lastUpdatedBy", s.LastUpdatedBy) + populateTime[datetime.RFC3339](objectMap, "lastUpdatedOn", s.LastUpdatedOn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandardAssignmentMetadata. +func (s *StandardAssignmentMetadata) UnmarshalJSON(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 "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTime[datetime.RFC3339](val, "CreatedOn", &s.CreatedOn) + delete(rawMsg, key) + case "lastUpdatedBy": + err = unpopulate(val, "LastUpdatedBy", &s.LastUpdatedBy) + delete(rawMsg, key) + case "lastUpdatedOn": + err = unpopulateTime[datetime.RFC3339](val, "LastUpdatedOn", &s.LastUpdatedOn) + 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 StandardAssignmentProperties. +func (s StandardAssignmentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assignedStandard", s.AssignedStandard) + populate(objectMap, "attestationData", s.AttestationData) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "effect", s.Effect) + populate(objectMap, "excludedScopes", s.ExcludedScopes) + populate(objectMap, "exemptionData", s.ExemptionData) + populateTime[datetime.RFC3339](objectMap, "expiresOn", s.ExpiresOn) + populate(objectMap, "metadata", s.Metadata) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandardAssignmentProperties. +func (s *StandardAssignmentProperties) UnmarshalJSON(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 "assignedStandard": + err = unpopulate(val, "AssignedStandard", &s.AssignedStandard) + delete(rawMsg, key) + case "attestationData": + err = unpopulate(val, "AttestationData", &s.AttestationData) + 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 "effect": + err = unpopulate(val, "Effect", &s.Effect) + delete(rawMsg, key) + case "excludedScopes": + err = unpopulate(val, "ExcludedScopes", &s.ExcludedScopes) + delete(rawMsg, key) + case "exemptionData": + err = unpopulate(val, "ExemptionData", &s.ExemptionData) + delete(rawMsg, key) + case "expiresOn": + err = unpopulateTime[datetime.RFC3339](val, "ExpiresOn", &s.ExpiresOn) + delete(rawMsg, key) + case "metadata": + err = unpopulate(val, "Metadata", &s.Metadata) + 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 StandardAssignmentPropertiesAttestationData. +func (s StandardAssignmentPropertiesAttestationData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assignedAssessment", s.AssignedAssessment) + populateTime[datetime.RFC3339](objectMap, "complianceDate", s.ComplianceDate) + populate(objectMap, "complianceState", s.ComplianceState) + populate(objectMap, "evidence", s.Evidence) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandardAssignmentPropertiesAttestationData. +func (s *StandardAssignmentPropertiesAttestationData) UnmarshalJSON(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 "assignedAssessment": + err = unpopulate(val, "AssignedAssessment", &s.AssignedAssessment) + delete(rawMsg, key) + case "complianceDate": + err = unpopulateTime[datetime.RFC3339](val, "ComplianceDate", &s.ComplianceDate) + delete(rawMsg, key) + case "complianceState": + err = unpopulate(val, "ComplianceState", &s.ComplianceState) + delete(rawMsg, key) + case "evidence": + err = unpopulate(val, "Evidence", &s.Evidence) + 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 StandardAssignmentPropertiesExemptionData. +func (s StandardAssignmentPropertiesExemptionData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "assignedAssessment", s.AssignedAssessment) + populate(objectMap, "exemptionCategory", s.ExemptionCategory) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandardAssignmentPropertiesExemptionData. +func (s *StandardAssignmentPropertiesExemptionData) UnmarshalJSON(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 "assignedAssessment": + err = unpopulate(val, "AssignedAssessment", &s.AssignedAssessment) + delete(rawMsg, key) + case "exemptionCategory": + err = unpopulate(val, "ExemptionCategory", &s.ExemptionCategory) + 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 StandardAssignmentsList. +func (s StandardAssignmentsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandardAssignmentsList. +func (s *StandardAssignmentsList) UnmarshalJSON(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 StandardComponentProperties. +func (s StandardComponentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "key", s.Key) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandardComponentProperties. +func (s *StandardComponentProperties) UnmarshalJSON(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 "key": + err = unpopulate(val, "Key", &s.Key) + 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 StandardList. +func (s StandardList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandardList. +func (s *StandardList) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + 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 StandardList. +func (s StandardList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandardList. +func (s *StandardList) UnmarshalJSON(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 "nextLink": + err = unpopulate(val, "NextLink", &s.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &s.Value) + 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 StandardMetadata. +func (s StandardMetadata) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "createdBy", s.CreatedBy) + populateTime[datetime.RFC3339](objectMap, "createdOn", s.CreatedOn) + populate(objectMap, "lastUpdatedBy", s.LastUpdatedBy) + populateTime[datetime.RFC3339](objectMap, "lastUpdatedOn", s.LastUpdatedOn) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandardMetadata. +func (s *StandardMetadata) UnmarshalJSON(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 "createdBy": + err = unpopulate(val, "CreatedBy", &s.CreatedBy) + delete(rawMsg, key) + case "createdOn": + err = unpopulateTime[datetime.RFC3339](val, "CreatedOn", &s.CreatedOn) + delete(rawMsg, key) + case "lastUpdatedBy": + err = unpopulate(val, "LastUpdatedBy", &s.LastUpdatedBy) + delete(rawMsg, key) + case "lastUpdatedOn": + err = unpopulateTime[datetime.RFC3339](val, "LastUpdatedOn", &s.LastUpdatedOn) + 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 StandardProperties. +func (s StandardProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "category", s.Category) + populate(objectMap, "components", s.Components) + populate(objectMap, "description", s.Description) + populate(objectMap, "displayName", s.DisplayName) + populate(objectMap, "standardType", s.StandardType) + populate(objectMap, "supportedClouds", s.SupportedClouds) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StandardProperties. +func (s *StandardProperties) UnmarshalJSON(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) @@ -16456,26 +16948,23 @@ func (s *SolutionsReferenceDataProperties) UnmarshalJSON(data []byte) error { 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) + case "category": + err = unpopulate(val, "Category", &s.Category) delete(rawMsg, key) - case "productName": - err = unpopulate(val, "ProductName", &s.ProductName) + case "components": + err = unpopulate(val, "Components", &s.Components) delete(rawMsg, key) - case "publisher": - err = unpopulate(val, "Publisher", &s.Publisher) + case "description": + err = unpopulate(val, "Description", &s.Description) delete(rawMsg, key) - case "publisherDisplayName": - err = unpopulate(val, "PublisherDisplayName", &s.PublisherDisplayName) + case "displayName": + err = unpopulate(val, "DisplayName", &s.DisplayName) delete(rawMsg, key) - case "securityFamily": - err = unpopulate(val, "SecurityFamily", &s.SecurityFamily) + case "standardType": + err = unpopulate(val, "StandardType", &s.StandardType) delete(rawMsg, key) - case "template": - err = unpopulate(val, "Template", &s.Template) + case "supportedClouds": + err = unpopulate(val, "SupportedClouds", &s.SupportedClouds) delete(rawMsg, key) } if err != nil { @@ -16485,19 +16974,19 @@ func (s *SolutionsReferenceDataProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type StatusAutoGenerated. -func (s StatusAutoGenerated) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type Status. +func (s Status) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "code", s.Code) - populateDateTimeRFC3339(objectMap, "firstEvaluationDate", s.FirstEvaluationDate) - populateDateTimeRFC3339(objectMap, "lastScannedDate", s.LastScannedDate) + populateTime[datetime.RFC3339](objectMap, "firstEvaluationDate", s.FirstEvaluationDate) + populateTime[datetime.RFC3339](objectMap, "lastScannedDate", s.LastScannedDate) populate(objectMap, "reason", s.Reason) - populateDateTimeRFC3339(objectMap, "statusChangeDate", s.StatusChangeDate) + populateTime[datetime.RFC3339](objectMap, "statusChangeDate", s.StatusChangeDate) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type StatusAutoGenerated. -func (s *StatusAutoGenerated) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type Status. +func (s *Status) UnmarshalJSON(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) @@ -16509,16 +16998,16 @@ func (s *StatusAutoGenerated) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Code", &s.Code) delete(rawMsg, key) case "firstEvaluationDate": - err = unpopulateDateTimeRFC3339(val, "FirstEvaluationDate", &s.FirstEvaluationDate) + err = unpopulateTime[datetime.RFC3339](val, "FirstEvaluationDate", &s.FirstEvaluationDate) delete(rawMsg, key) case "lastScannedDate": - err = unpopulateDateTimeRFC3339(val, "LastScannedDate", &s.LastScannedDate) + err = unpopulateTime[datetime.RFC3339](val, "LastScannedDate", &s.LastScannedDate) delete(rawMsg, key) case "reason": err = unpopulate(val, "Reason", &s.Reason) delete(rawMsg, key) case "statusChangeDate": - err = unpopulateDateTimeRFC3339(val, "StatusChangeDate", &s.StatusChangeDate) + err = unpopulateTime[datetime.RFC3339](val, "StatusChangeDate", &s.StatusChangeDate) delete(rawMsg, key) } if err != nil { @@ -16534,6 +17023,7 @@ func (s SubAssessment) MarshalJSON() ([]byte, error) { populate(objectMap, "id", s.ID) populate(objectMap, "name", s.Name) populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } @@ -16556,6 +17046,9 @@ func (s *SubAssessment) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &s.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &s.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &s.Type) delete(rawMsg, key) @@ -16610,7 +17103,7 @@ func (s SubAssessmentProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "remediation", s.Remediation) populate(objectMap, "resourceDetails", s.ResourceDetails) populate(objectMap, "status", s.Status) - populateDateTimeRFC3339(objectMap, "timeGenerated", s.TimeGenerated) + populateTime[datetime.RFC3339](objectMap, "timeGenerated", s.TimeGenerated) return json.Marshal(objectMap) } @@ -16651,7 +17144,7 @@ func (s *SubAssessmentProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Status", &s.Status) delete(rawMsg, key) case "timeGenerated": - err = unpopulateDateTimeRFC3339(val, "TimeGenerated", &s.TimeGenerated) + err = unpopulateTime[datetime.RFC3339](val, "TimeGenerated", &s.TimeGenerated) delete(rawMsg, key) } if err != nil { @@ -16730,10 +17223,10 @@ func (s *SuppressionAlertsScope) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populateTime[datetime.RFC3339](objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populateDateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populateTime[datetime.RFC3339](objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -16749,7 +17242,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - err = unpopulateDateTimeRFC3339(val, "CreatedAt", &s.CreatedAt) + err = unpopulateTime[datetime.RFC3339](val, "CreatedAt", &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, "CreatedBy", &s.CreatedBy) @@ -16758,7 +17251,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, "CreatedByType", &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - err = unpopulateDateTimeRFC3339(val, "LastModifiedAt", &s.LastModifiedAt) + err = unpopulateTime[datetime.RFC3339](val, "LastModifiedAt", &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, "LastModifiedBy", &s.LastModifiedBy) @@ -16774,60 +17267,6 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Tags. -func (t Tags) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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]any) - 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 TargetBranchConfiguration. func (t TargetBranchConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -16865,6 +17304,7 @@ func (t Task) MarshalJSON() ([]byte, error) { populate(objectMap, "id", t.ID) populate(objectMap, "name", t.Name) populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } @@ -16887,6 +17327,9 @@ func (t *Task) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &t.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) @@ -16974,8 +17417,8 @@ func (t *TaskParameters) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TaskProperties. func (t TaskProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "creationTimeUtc", t.CreationTimeUTC) - populateDateTimeRFC3339(objectMap, "lastStateChangeTimeUtc", t.LastStateChangeTimeUTC) + populateTime[datetime.RFC3339](objectMap, "creationTimeUtc", t.CreationTimeUTC) + populateTime[datetime.RFC3339](objectMap, "lastStateChangeTimeUtc", t.LastStateChangeTimeUTC) populate(objectMap, "securityTaskParameters", t.SecurityTaskParameters) populate(objectMap, "state", t.State) populate(objectMap, "subState", t.SubState) @@ -16992,10 +17435,10 @@ func (t *TaskProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTimeUtc": - err = unpopulateDateTimeRFC3339(val, "CreationTimeUTC", &t.CreationTimeUTC) + err = unpopulateTime[datetime.RFC3339](val, "CreationTimeUTC", &t.CreationTimeUTC) delete(rawMsg, key) case "lastStateChangeTimeUtc": - err = unpopulateDateTimeRFC3339(val, "LastStateChangeTimeUTC", &t.LastStateChangeTimeUTC) + err = unpopulateTime[datetime.RFC3339](val, "LastStateChangeTimeUTC", &t.LastStateChangeTimeUTC) delete(rawMsg, key) case "securityTaskParameters": err = unpopulate(val, "SecurityTaskParameters", &t.SecurityTaskParameters) @@ -17150,6 +17593,7 @@ func (t TopologyResource) MarshalJSON() ([]byte, error) { populate(objectMap, "location", t.Location) populate(objectMap, "name", t.Name) populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) populate(objectMap, "type", t.Type) return json.Marshal(objectMap) } @@ -17175,6 +17619,9 @@ func (t *TopologyResource) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &t.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &t.Type) delete(rawMsg, key) @@ -17189,7 +17636,7 @@ func (t *TopologyResource) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type TopologyResourceProperties. func (t TopologyResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) - populateDateTimeRFC3339(objectMap, "calculatedDateTime", t.CalculatedDateTime) + populateTime[datetime.RFC3339](objectMap, "calculatedDateTime", t.CalculatedDateTime) populate(objectMap, "topologyResources", t.TopologyResources) return json.Marshal(objectMap) } @@ -17204,7 +17651,7 @@ func (t *TopologyResourceProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "calculatedDateTime": - err = unpopulateDateTimeRFC3339(val, "CalculatedDateTime", &t.CalculatedDateTime) + err = unpopulateTime[datetime.RFC3339](val, "CalculatedDateTime", &t.CalculatedDateTime) delete(rawMsg, key) case "topologyResources": err = unpopulate(val, "TopologyResources", &t.TopologyResources) @@ -17326,57 +17773,6 @@ func (t *TopologySingleResourceParent) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type TrackedResource. -func (t TrackedResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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]any) @@ -17607,142 +18003,6 @@ func (u *UserDefinedResourcesProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type UserRecommendation. -func (u UserRecommendation) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - 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]any) - 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 VMScannersAws. -func (v VMScannersAws) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "cloudRoleArn", v.CloudRoleArn) - populate(objectMap, "configuration", v.Configuration) - populate(objectMap, "enabled", v.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VMScannersAws. -func (v *VMScannersAws) UnmarshalJSON(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 "cloudRoleArn": - err = unpopulate(val, "CloudRoleArn", &v.CloudRoleArn) - delete(rawMsg, key) - case "configuration": - err = unpopulate(val, "Configuration", &v.Configuration) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &v.Enabled) - 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 VMScannersBase. -func (v VMScannersBase) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "configuration", v.Configuration) - populate(objectMap, "enabled", v.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VMScannersBase. -func (v *VMScannersBase) UnmarshalJSON(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 "configuration": - err = unpopulate(val, "Configuration", &v.Configuration) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &v.Enabled) - 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 VMScannersBaseConfiguration. func (v VMScannersBaseConfiguration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -17774,37 +18034,6 @@ func (v *VMScannersBaseConfiguration) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type VMScannersGcp. -func (v VMScannersGcp) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "configuration", v.Configuration) - populate(objectMap, "enabled", v.Enabled) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type VMScannersGcp. -func (v *VMScannersGcp) UnmarshalJSON(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 "configuration": - err = unpopulate(val, "Configuration", &v.Configuration) - delete(rawMsg, key) - case "enabled": - err = unpopulate(val, "Enabled", &v.Enabled) - 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]any) @@ -17901,6 +18130,7 @@ func (w WorkspaceSetting) MarshalJSON() ([]byte, error) { populate(objectMap, "id", w.ID) populate(objectMap, "name", w.Name) populate(objectMap, "properties", w.Properties) + populate(objectMap, "systemData", w.SystemData) populate(objectMap, "type", w.Type) return json.Marshal(objectMap) } @@ -17923,6 +18153,9 @@ func (w *WorkspaceSetting) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, "Properties", &w.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &w.SystemData) + delete(rawMsg, key) case "type": err = unpopulate(val, "Type", &w.Type) delete(rawMsg, key) @@ -18006,6 +18239,17 @@ func populate(m map[string]any, k string, v any) { } } +func populateTime[T dateTimeConstraints](m map[string]any, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + } else if !reflect.ValueOf(t).IsNil() { + newTime := T(*t) + m[k] = (*T)(&newTime) + } +} + func populateAny(m map[string]any, k string, v any) { if v == nil { return @@ -18035,3 +18279,20 @@ func unpopulate(data json.RawMessage, fn string, v any) error { } return nil } + +func unpopulateTime[T dateTimeConstraints](data json.RawMessage, fn string, t **time.Time) error { + if data == nil || string(data) == "null" { + return nil + } + var aux T + if err := json.Unmarshal(data, &aux); err != nil { + return fmt.Errorf("struct field %s: %v", fn, err) + } + newTime := time.Time(aux) + *t = &newTime + return nil +} + +type dateTimeConstraints interface { + datetime.PlainDate | datetime.PlainTime | datetime.RFC1123 | datetime.RFC3339 | datetime.Unix +} diff --git a/sdk/resourcemanager/security/armsecurity/operationresults_client.go b/sdk/resourcemanager/security/armsecurity/operationresults_client.go new file mode 100644 index 000000000000..d080accab804 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/operationresults_client.go @@ -0,0 +1,112 @@ +// 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) Go Code Generator. 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" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// OperationResultsClient contains the methods for the OperationResults group. +// Don't use this type directly, use NewOperationResultsClient() instead. +type OperationResultsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewOperationResultsClient creates a new instance of OperationResultsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationResultsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationResultsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Returns operation results for long running operations. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-10-01-preview +// - location - The name of the Azure region. +// - operationID - The ID of an ongoing async operation. +// - options - OperationResultsClientGetOptions contains the optional parameters for the OperationResultsClient.Get method. +func (client *OperationResultsClient) Get(ctx context.Context, location string, operationID string, options *OperationResultsClientGetOptions) (OperationResultsClientGetResponse, error) { + var err error + const operationName = "OperationResultsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, operationID, options) + if err != nil { + return OperationResultsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperationResultsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return OperationResultsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *OperationResultsClient) getCreateRequest(ctx context.Context, location string, operationID string, _ *OperationResultsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{location}/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 location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *OperationResultsClient) getHandleResponse(resp *http.Response) (OperationResultsClientGetResponse, error) { + result := OperationResultsClientGetResponse{} + if val := resp.Header.Get("Location"); val != "" { + result.Location = &val + } + if val := resp.Header.Get("Retry-After"); val != "" { + retryAfter32, err := strconv.ParseInt(val, 10, 32) + retryAfter := int32(retryAfter32) + if err != nil { + return OperationResultsClientGetResponse{}, err + } + result.RetryAfter = &retryAfter + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/operations_client.go b/sdk/resourcemanager/security/armsecurity/operations_client.go index 758d96cb70f4..9ab9114fa533 100644 --- a/sdk/resourcemanager/security/armsecurity/operations_client.go +++ b/sdk/resourcemanager/security/armsecurity/operations_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -22,7 +21,7 @@ type OperationsClient struct { // NewOperationsClient creates a new instance of OperationsClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -36,7 +35,7 @@ func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientO // NewListPager - Exposes all available operations for discovery purposes. // -// Generated from API version 2015-06-01-preview +// Generated from API version 2025-10-01-preview // - options - OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. func (client *OperationsClient) NewListPager(options *OperationsClientListOptions) *runtime.Pager[OperationsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[OperationsClientListResponse]{ @@ -62,14 +61,14 @@ func (client *OperationsClient) NewListPager(options *OperationsClientListOption } // listCreateRequest creates the List request. -func (client *OperationsClient) listCreateRequest(ctx context.Context, options *OperationsClientListOptions) (*policy.Request, error) { +func (client *OperationsClient) listCreateRequest(ctx context.Context, _ *OperationsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Security/operations" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2015-06-01-preview") + reqQP.Set("api-version", "2025-10-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -78,7 +77,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * // listHandleResponse handles the List response. func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsClientListResponse, error) { result := OperationsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.OperationList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { return OperationsClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/security/armsecurity/operationstatuses_client.go b/sdk/resourcemanager/security/armsecurity/operationstatuses_client.go new file mode 100644 index 000000000000..49df9d172d16 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/operationstatuses_client.go @@ -0,0 +1,104 @@ +// 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) Go Code Generator. 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" + "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" +) + +// OperationStatusesClient contains the methods for the OperationStatuses group. +// Don't use this type directly, use NewOperationStatusesClient() instead. +type OperationStatusesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewOperationStatusesClient creates a new instance of OperationStatusesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &OperationStatusesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get the status of a long running azure asynchronous operation. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-10-01-preview +// - location - The name of the Azure region. +// - operationID - The ID of an ongoing async operation. +// - options - OperationStatusesClientGetOptions contains the optional parameters for the OperationStatusesClient.Get method. +func (client *OperationStatusesClient) Get(ctx context.Context, location string, operationID string, options *OperationStatusesClientGetOptions) (OperationStatusesClientGetResponse, error) { + var err error + const operationName = "OperationStatusesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, location, operationID, options) + if err != nil { + return OperationStatusesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperationStatusesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return OperationStatusesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *OperationStatusesClient) getCreateRequest(ctx context.Context, location string, operationID string, _ *OperationStatusesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{location}/operationStatuses/{operationId}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-10-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 *OperationStatusesClient) getHandleResponse(resp *http.Response) (OperationStatusesClientGetResponse, error) { + result := OperationStatusesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatusResult); err != nil { + return OperationStatusesClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/operators_client.go b/sdk/resourcemanager/security/armsecurity/operators_client.go index 607315258a30..32de335994c8 100644 --- a/sdk/resourcemanager/security/armsecurity/operators_client.go +++ b/sdk/resourcemanager/security/armsecurity/operators_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -17,7 +16,7 @@ import ( "strings" ) -// OperatorsClient contains the methods for the SecurityOperators group. +// OperatorsClient contains the methods for the Operators group. // Don't use this type directly, use NewOperatorsClient() instead. type OperatorsClient struct { internal *arm.Client @@ -25,9 +24,9 @@ type OperatorsClient struct { } // NewOperatorsClient creates a new instance of OperatorsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewOperatorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperatorsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -44,8 +43,8 @@ func NewOperatorsClient(subscriptionID string, credential azcore.TokenCredential // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-01-01-preview -// - pricingName - name of the pricing configuration -// - securityOperatorName - name of the securityOperator +// - pricingName - Name of the pricing configuration. +// - securityOperatorName - Name of the security operator. // - options - OperatorsClientCreateOrUpdateOptions contains the optional parameters for the OperatorsClient.CreateOrUpdate // method. func (client *OperatorsClient) CreateOrUpdate(ctx context.Context, pricingName string, securityOperatorName string, options *OperatorsClientCreateOrUpdateOptions) (OperatorsClientCreateOrUpdateResponse, error) { @@ -71,7 +70,7 @@ func (client *OperatorsClient) CreateOrUpdate(ctx context.Context, pricingName s } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *OperatorsClient) createOrUpdateCreateRequest(ctx context.Context, pricingName string, securityOperatorName string, options *OperatorsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *OperatorsClient) createOrUpdateCreateRequest(ctx context.Context, pricingName string, securityOperatorName string, _ *OperatorsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators/{securityOperatorName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -109,8 +108,8 @@ func (client *OperatorsClient) createOrUpdateHandleResponse(resp *http.Response) // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-01-01-preview -// - pricingName - name of the pricing configuration -// - securityOperatorName - name of the securityOperator +// - pricingName - Name of the pricing configuration. +// - securityOperatorName - Name of the security operator. // - options - OperatorsClientDeleteOptions contains the optional parameters for the OperatorsClient.Delete method. func (client *OperatorsClient) Delete(ctx context.Context, pricingName string, securityOperatorName string, options *OperatorsClientDeleteOptions) (OperatorsClientDeleteResponse, error) { var err error @@ -134,7 +133,7 @@ func (client *OperatorsClient) Delete(ctx context.Context, pricingName string, s } // deleteCreateRequest creates the Delete request. -func (client *OperatorsClient) deleteCreateRequest(ctx context.Context, pricingName string, securityOperatorName string, options *OperatorsClientDeleteOptions) (*policy.Request, error) { +func (client *OperatorsClient) deleteCreateRequest(ctx context.Context, pricingName string, securityOperatorName string, _ *OperatorsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators/{securityOperatorName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -155,7 +154,6 @@ func (client *OperatorsClient) deleteCreateRequest(ctx context.Context, pricingN reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2023-01-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -163,8 +161,8 @@ func (client *OperatorsClient) deleteCreateRequest(ctx context.Context, pricingN // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2023-01-01-preview -// - pricingName - name of the pricing configuration -// - securityOperatorName - name of the securityOperator +// - pricingName - Name of the pricing configuration. +// - securityOperatorName - Name of the security operator. // - options - OperatorsClientGetOptions contains the optional parameters for the OperatorsClient.Get method. func (client *OperatorsClient) Get(ctx context.Context, pricingName string, securityOperatorName string, options *OperatorsClientGetOptions) (OperatorsClientGetResponse, error) { var err error @@ -189,7 +187,7 @@ func (client *OperatorsClient) Get(ctx context.Context, pricingName string, secu } // getCreateRequest creates the Get request. -func (client *OperatorsClient) getCreateRequest(ctx context.Context, pricingName string, securityOperatorName string, options *OperatorsClientGetOptions) (*policy.Request, error) { +func (client *OperatorsClient) getCreateRequest(ctx context.Context, pricingName string, securityOperatorName string, _ *OperatorsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators/{securityOperatorName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -223,36 +221,37 @@ func (client *OperatorsClient) getHandleResponse(resp *http.Response) (Operators return result, nil } -// List - Lists Microsoft Defender for Cloud securityOperators in the subscription. -// If the operation fails it returns an *azcore.ResponseError type. +// NewListPager - Lists Microsoft Defender for Cloud securityOperators in the subscription. // // Generated from API version 2023-01-01-preview -// - pricingName - name of the pricing configuration -// - options - OperatorsClientListOptions contains the optional parameters for the OperatorsClient.List method. -func (client *OperatorsClient) List(ctx context.Context, pricingName string, options *OperatorsClientListOptions) (OperatorsClientListResponse, error) { - var err error - const operationName = "OperatorsClient.List" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listCreateRequest(ctx, pricingName, options) - if err != nil { - return OperatorsClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return OperatorsClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return OperatorsClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err +// - pricingName - Name of the pricing configuration. +// - options - OperatorsClientListOptions contains the optional parameters for the OperatorsClient.NewListPager method. +func (client *OperatorsClient) NewListPager(pricingName string, options *OperatorsClientListOptions) *runtime.Pager[OperatorsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[OperatorsClientListResponse]{ + More: func(page OperatorsClientListResponse) bool { + return false + }, + Fetcher: func(ctx context.Context, page *OperatorsClientListResponse) (OperatorsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "OperatorsClient.NewListPager") + req, err := client.listCreateRequest(ctx, pricingName, options) + if err != nil { + return OperatorsClientListResponse{}, err + } + resp, err := client.internal.Pipeline().Do(req) + if err != nil { + return OperatorsClientListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return OperatorsClientListResponse{}, runtime.NewResponseError(resp) + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) } // listCreateRequest creates the List request. -func (client *OperatorsClient) listCreateRequest(ctx context.Context, pricingName string, options *OperatorsClientListOptions) (*policy.Request, error) { +func (client *OperatorsClient) listCreateRequest(ctx context.Context, pricingName string, _ *OperatorsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/pricings/{pricingName}/securityOperators" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/options.go b/sdk/resourcemanager/security/armsecurity/options.go index 93626b630f8d..f7013e654e90 100644 --- a/sdk/resourcemanager/security/armsecurity/options.go +++ b/sdk/resourcemanager/security/armsecurity/options.go @@ -1,14 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity // APICollectionsClientBeginOnboardAzureAPIManagementAPIOptions contains the optional parameters for the APICollectionsClient.BeginOnboardAzureAPIManagementAPI // method. type APICollectionsClientBeginOnboardAzureAPIManagementAPIOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -42,74 +41,6 @@ type APICollectionsClientOffboardAzureAPIManagementAPIOptions struct { // placeholder for future optional parameters } -// AccountConnectorsClientCreateOrUpdateOptions contains the optional parameters for the AccountConnectorsClient.CreateOrUpdate -// method. -type AccountConnectorsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// AccountConnectorsClientDeleteOptions contains the optional parameters for the AccountConnectorsClient.Delete method. -type AccountConnectorsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// AccountConnectorsClientGetOptions contains the optional parameters for the AccountConnectorsClient.Get method. -type AccountConnectorsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AccountConnectorsClientListOptions contains the optional parameters for the AccountConnectorsClient.NewListPager method. -type AccountConnectorsClientListOptions struct { - // placeholder for future optional parameters -} - -// AdaptiveApplicationControlsClientDeleteOptions contains the optional parameters for the AdaptiveApplicationControlsClient.Delete -// method. -type AdaptiveApplicationControlsClientDeleteOptions struct { - // placeholder for future optional parameters -} - -// AdaptiveApplicationControlsClientGetOptions contains the optional parameters for the AdaptiveApplicationControlsClient.Get -// method. -type AdaptiveApplicationControlsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AdaptiveApplicationControlsClientListOptions contains the optional parameters for the AdaptiveApplicationControlsClient.List -// method. -type AdaptiveApplicationControlsClientListOptions struct { - // Include the policy rules - IncludePathRecommendations *bool - - // Return output in a summarized form - Summary *bool -} - -// AdaptiveApplicationControlsClientPutOptions contains the optional parameters for the AdaptiveApplicationControlsClient.Put -// method. -type AdaptiveApplicationControlsClientPutOptions struct { - // placeholder for future optional parameters -} - -// AdaptiveNetworkHardeningsClientBeginEnforceOptions contains the optional parameters for the AdaptiveNetworkHardeningsClient.BeginEnforce -// method. -type AdaptiveNetworkHardeningsClientBeginEnforceOptions struct { - // Resumes the LRO from the provided token. - ResumeToken string -} - -// AdaptiveNetworkHardeningsClientGetOptions contains the optional parameters for the AdaptiveNetworkHardeningsClient.Get -// method. -type AdaptiveNetworkHardeningsClientGetOptions struct { - // placeholder for future optional parameters -} - -// AdaptiveNetworkHardeningsClientListByExtendedResourceOptions contains the optional parameters for the AdaptiveNetworkHardeningsClient.NewListByExtendedResourcePager -// method. -type AdaptiveNetworkHardeningsClientListByExtendedResourceOptions struct { - // placeholder for future optional parameters -} - // AdvancedThreatProtectionClientCreateOptions contains the optional parameters for the AdvancedThreatProtectionClient.Create // method. type AdvancedThreatProtectionClientCreateOptions struct { @@ -123,7 +54,7 @@ type AdvancedThreatProtectionClientGetOptions struct { // AlertsClientBeginSimulateOptions contains the optional parameters for the AlertsClient.BeginSimulate method. type AlertsClientBeginSimulateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -323,6 +254,32 @@ type AssessmentsMetadataClientListOptions struct { // placeholder for future optional parameters } +// AssignmentsClientCreateOrUpdateOptions contains the optional parameters for the AssignmentsClient.CreateOrUpdate method. +type AssignmentsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// AssignmentsClientDeleteOptions contains the optional parameters for the AssignmentsClient.Delete method. +type AssignmentsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// AssignmentsClientGetOptions contains the optional parameters for the AssignmentsClient.Get method. +type AssignmentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// AssignmentsClientListBySubscriptionOptions contains the optional parameters for the AssignmentsClient.NewListBySubscriptionPager +// method. +type AssignmentsClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// AssignmentsClientListOptions contains the optional parameters for the AssignmentsClient.NewListPager method. +type AssignmentsClientListOptions struct { + // placeholder for future optional parameters +} + // AutoProvisioningSettingsClientCreateOptions contains the optional parameters for the AutoProvisioningSettingsClient.Create // method. type AutoProvisioningSettingsClientCreateOptions struct { @@ -379,13 +336,13 @@ type AutomationsClientValidateOptions struct { // AzureDevOpsOrgsClientBeginCreateOrUpdateOptions contains the optional parameters for the AzureDevOpsOrgsClient.BeginCreateOrUpdate // method. type AzureDevOpsOrgsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AzureDevOpsOrgsClientBeginUpdateOptions contains the optional parameters for the AzureDevOpsOrgsClient.BeginUpdate method. type AzureDevOpsOrgsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -408,14 +365,14 @@ type AzureDevOpsOrgsClientListOptions struct { // AzureDevOpsProjectsClientBeginCreateOrUpdateOptions contains the optional parameters for the AzureDevOpsProjectsClient.BeginCreateOrUpdate // method. type AzureDevOpsProjectsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AzureDevOpsProjectsClientBeginUpdateOptions contains the optional parameters for the AzureDevOpsProjectsClient.BeginUpdate // method. type AzureDevOpsProjectsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -432,13 +389,13 @@ type AzureDevOpsProjectsClientListOptions struct { // AzureDevOpsReposClientBeginCreateOrUpdateOptions contains the optional parameters for the AzureDevOpsReposClient.BeginCreateOrUpdate // method. type AzureDevOpsReposClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // AzureDevOpsReposClientBeginUpdateOptions contains the optional parameters for the AzureDevOpsReposClient.BeginUpdate method. type AzureDevOpsReposClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -545,94 +502,79 @@ type ContactsClientListOptions struct { // placeholder for future optional parameters } -// CustomAssessmentAutomationsClientCreateOptions contains the optional parameters for the CustomAssessmentAutomationsClient.Create +// CustomRecommendationsClientCreateOrUpdateOptions contains the optional parameters for the CustomRecommendationsClient.CreateOrUpdate // method. -type CustomAssessmentAutomationsClientCreateOptions struct { +type CustomRecommendationsClientCreateOrUpdateOptions struct { // placeholder for future optional parameters } -// CustomAssessmentAutomationsClientDeleteOptions contains the optional parameters for the CustomAssessmentAutomationsClient.Delete -// method. -type CustomAssessmentAutomationsClientDeleteOptions struct { +// CustomRecommendationsClientDeleteOptions contains the optional parameters for the CustomRecommendationsClient.Delete method. +type CustomRecommendationsClientDeleteOptions struct { // placeholder for future optional parameters } -// CustomAssessmentAutomationsClientGetOptions contains the optional parameters for the CustomAssessmentAutomationsClient.Get -// method. -type CustomAssessmentAutomationsClientGetOptions struct { +// CustomRecommendationsClientGetOptions contains the optional parameters for the CustomRecommendationsClient.Get method. +type CustomRecommendationsClientGetOptions struct { // placeholder for future optional parameters } -// CustomAssessmentAutomationsClientListByResourceGroupOptions contains the optional parameters for the CustomAssessmentAutomationsClient.NewListByResourceGroupPager +// CustomRecommendationsClientListOptions contains the optional parameters for the CustomRecommendationsClient.NewListPager // method. -type CustomAssessmentAutomationsClientListByResourceGroupOptions struct { +type CustomRecommendationsClientListOptions struct { // placeholder for future optional parameters } -// CustomAssessmentAutomationsClientListBySubscriptionOptions contains the optional parameters for the CustomAssessmentAutomationsClient.NewListBySubscriptionPager +// DefenderForStorageClientCancelMalwareScanOptions contains the optional parameters for the DefenderForStorageClient.CancelMalwareScan // method. -type CustomAssessmentAutomationsClientListBySubscriptionOptions struct { +type DefenderForStorageClientCancelMalwareScanOptions struct { // placeholder for future optional parameters } -// CustomEntityStoreAssignmentsClientCreateOptions contains the optional parameters for the CustomEntityStoreAssignmentsClient.Create -// method. -type CustomEntityStoreAssignmentsClientCreateOptions struct { +// DefenderForStorageClientCreateOptions contains the optional parameters for the DefenderForStorageClient.Create method. +type DefenderForStorageClientCreateOptions struct { // placeholder for future optional parameters } -// CustomEntityStoreAssignmentsClientDeleteOptions contains the optional parameters for the CustomEntityStoreAssignmentsClient.Delete +// DefenderForStorageClientGetMalwareScanOptions contains the optional parameters for the DefenderForStorageClient.GetMalwareScan // method. -type CustomEntityStoreAssignmentsClientDeleteOptions struct { +type DefenderForStorageClientGetMalwareScanOptions struct { // placeholder for future optional parameters } -// CustomEntityStoreAssignmentsClientGetOptions contains the optional parameters for the CustomEntityStoreAssignmentsClient.Get -// method. -type CustomEntityStoreAssignmentsClientGetOptions struct { +// DefenderForStorageClientGetOptions contains the optional parameters for the DefenderForStorageClient.Get method. +type DefenderForStorageClientGetOptions struct { // placeholder for future optional parameters } -// CustomEntityStoreAssignmentsClientListByResourceGroupOptions contains the optional parameters for the CustomEntityStoreAssignmentsClient.NewListByResourceGroupPager -// method. -type CustomEntityStoreAssignmentsClientListByResourceGroupOptions struct { +// DefenderForStorageClientListOptions contains the optional parameters for the DefenderForStorageClient.NewListPager method. +type DefenderForStorageClientListOptions struct { // placeholder for future optional parameters } -// CustomEntityStoreAssignmentsClientListBySubscriptionOptions contains the optional parameters for the CustomEntityStoreAssignmentsClient.NewListBySubscriptionPager +// DefenderForStorageClientStartMalwareScanOptions contains the optional parameters for the DefenderForStorageClient.StartMalwareScan // method. -type CustomEntityStoreAssignmentsClientListBySubscriptionOptions struct { - // placeholder for future optional parameters -} - -// DefenderForStorageClientCreateOptions contains the optional parameters for the DefenderForStorageClient.Create method. -type DefenderForStorageClientCreateOptions struct { - // placeholder for future optional parameters -} - -// DefenderForStorageClientGetOptions contains the optional parameters for the DefenderForStorageClient.Get method. -type DefenderForStorageClientGetOptions struct { +type DefenderForStorageClientStartMalwareScanOptions struct { // placeholder for future optional parameters } // DevOpsConfigurationsClientBeginCreateOrUpdateOptions contains the optional parameters for the DevOpsConfigurationsClient.BeginCreateOrUpdate // method. type DevOpsConfigurationsClientBeginCreateOrUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // DevOpsConfigurationsClientBeginDeleteOptions contains the optional parameters for the DevOpsConfigurationsClient.BeginDelete // method. type DevOpsConfigurationsClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } // DevOpsConfigurationsClientBeginUpdateOptions contains the optional parameters for the DevOpsConfigurationsClient.BeginUpdate // method. type DevOpsConfigurationsClientBeginUpdateOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -710,6 +652,15 @@ type ExternalSecuritySolutionsClientListOptions struct { // placeholder for future optional parameters } +// GitHubIssuesClientBeginCreateOptions contains the optional parameters for the GitHubIssuesClient.BeginCreate method. +type GitHubIssuesClientBeginCreateOptions struct { + // The request model containing details for creating the GitHub issue. + CreateIssueRequest *IssueCreationRequest + + // Resumes the long-running operation from the provided token. + ResumeToken string +} + // GitHubOwnersClientGetOptions contains the optional parameters for the GitHubOwnersClient.Get method. type GitHubOwnersClientGetOptions struct { // placeholder for future optional parameters @@ -789,7 +740,7 @@ type GovernanceAssignmentsClientListOptions struct { // GovernanceRulesClientBeginDeleteOptions contains the optional parameters for the GovernanceRulesClient.BeginDelete method. type GovernanceRulesClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -798,7 +749,7 @@ type GovernanceRulesClientBeginExecuteOptions struct { // Execute governance rule over a given scope ExecuteGovernanceRuleParams *ExecuteGovernanceRuleParams - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -998,6 +949,16 @@ type MdeOnboardingsClientListOptions struct { // placeholder for future optional parameters } +// OperationResultsClientGetOptions contains the optional parameters for the OperationResultsClient.Get method. +type OperationResultsClientGetOptions struct { + // placeholder for future optional parameters +} + +// OperationStatusesClientGetOptions contains the optional parameters for the OperationStatusesClient.Get method. +type OperationStatusesClientGetOptions struct { + // placeholder for future optional parameters +} + // OperationsClientListOptions contains the optional parameters for the OperationsClient.NewListPager method. type OperationsClientListOptions struct { // placeholder for future optional parameters @@ -1018,7 +979,7 @@ type OperatorsClientGetOptions struct { // placeholder for future optional parameters } -// OperatorsClientListOptions contains the optional parameters for the OperatorsClient.List method. +// OperatorsClientListOptions contains the optional parameters for the OperatorsClient.NewListPager method. type OperatorsClientListOptions struct { // placeholder for future optional parameters } @@ -1044,6 +1005,87 @@ type PricingsClientUpdateOptions struct { // placeholder for future optional parameters } +// PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate +// method. +type PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +type PrivateEndpointConnectionsClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +type PrivateEndpointConnectionsClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager +// method. +type PrivateEndpointConnectionsClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkParameters contains a group of parameters for the PrivateLinkResourcesClient.Get method. +type PrivateLinkParameters struct { + // The name of the private link resource. + PrivateLinkName string +} + +// PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get method. +type PrivateLinkResourcesClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager +// method. +type PrivateLinkResourcesClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinksClientBeginCreateOptions contains the optional parameters for the PrivateLinksClient.BeginCreate method. +type PrivateLinksClientBeginCreateOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// PrivateLinksClientBeginDeleteOptions contains the optional parameters for the PrivateLinksClient.BeginDelete method. +type PrivateLinksClientBeginDeleteOptions struct { + // Resumes the long-running operation from the provided token. + ResumeToken string +} + +// PrivateLinksClientGetOptions contains the optional parameters for the PrivateLinksClient.Get method. +type PrivateLinksClientGetOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinksClientHeadOptions contains the optional parameters for the PrivateLinksClient.Head method. +type PrivateLinksClientHeadOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinksClientListBySubscriptionOptions contains the optional parameters for the PrivateLinksClient.NewListBySubscriptionPager +// method. +type PrivateLinksClientListBySubscriptionOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinksClientListOptions contains the optional parameters for the PrivateLinksClient.NewListPager method. +type PrivateLinksClientListOptions struct { + // placeholder for future optional parameters +} + +// PrivateLinksClientUpdateOptions contains the optional parameters for the PrivateLinksClient.Update method. +type PrivateLinksClientUpdateOptions struct { + // placeholder for future optional parameters +} + // RegulatoryComplianceAssessmentsClientGetOptions contains the optional parameters for the RegulatoryComplianceAssessmentsClient.Get // method. type RegulatoryComplianceAssessmentsClientGetOptions struct { @@ -1086,56 +1128,108 @@ type RegulatoryComplianceStandardsClientListOptions struct { // SQLVulnerabilityAssessmentBaselineRulesClientAddOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.Add // method. type SQLVulnerabilityAssessmentBaselineRulesClientAddOptions struct { - // The baseline rules. + // The content of the action request Body *RulesResultsInput + + // The name of the database to assess. Required when the API is called on the parent resource (e.g., server level) rather + // than on a specific database resource, since the database name is not part of the resource URI. This is the only way to + // assess system databases (e.g., master), which cannot be referenced directly in the resource URI. + DatabaseName *string } // SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.CreateOrUpdate // method. type SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions struct { - // The baseline results for this rule. - Body *RuleResultsInput + // The name of the database to assess. Required when the API is called on the parent resource (e.g., server level) rather + // than on a specific database resource, since the database name is not part of the resource URI. This is the only way to + // assess system databases (e.g., master), which cannot be referenced directly in the resource URI. + DatabaseName *string } // SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.Delete // method. type SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions struct { - // placeholder for future optional parameters + // The name of the database to assess. Required when the API is called on the parent resource (e.g., server level) rather + // than on a specific database resource, since the database name is not part of the resource URI. This is the only way to + // assess system databases (e.g., master), which cannot be referenced directly in the resource URI. + DatabaseName *string } // SQLVulnerabilityAssessmentBaselineRulesClientGetOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.Get // method. type SQLVulnerabilityAssessmentBaselineRulesClientGetOptions struct { - // placeholder for future optional parameters + // The name of the database to assess. Required when the API is called on the parent resource (e.g., server level) rather + // than on a specific database resource, since the database name is not part of the resource URI. This is the only way to + // assess system databases (e.g., master), which cannot be referenced directly in the resource URI. + DatabaseName *string } -// SQLVulnerabilityAssessmentBaselineRulesClientListOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.List +// SQLVulnerabilityAssessmentBaselineRulesClientListOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.NewListPager // method. type SQLVulnerabilityAssessmentBaselineRulesClientListOptions struct { - // placeholder for future optional parameters + // The name of the database to assess. Required when the API is called on the parent resource (e.g., server level) rather + // than on a specific database resource, since the database name is not part of the resource URI. This is the only way to + // assess system databases (e.g., master), which cannot be referenced directly in the resource URI. + DatabaseName *string } // SQLVulnerabilityAssessmentScanResultsClientGetOptions contains the optional parameters for the SQLVulnerabilityAssessmentScanResultsClient.Get // method. type SQLVulnerabilityAssessmentScanResultsClientGetOptions struct { - // placeholder for future optional parameters + DatabaseName *string } -// SQLVulnerabilityAssessmentScanResultsClientListOptions contains the optional parameters for the SQLVulnerabilityAssessmentScanResultsClient.List +// SQLVulnerabilityAssessmentScanResultsClientListOptions contains the optional parameters for the SQLVulnerabilityAssessmentScanResultsClient.NewListPager // method. type SQLVulnerabilityAssessmentScanResultsClientListOptions struct { - // placeholder for future optional parameters + DatabaseName *string +} + +// SQLVulnerabilityAssessmentScansClientBeginInitiateScanOptions contains the optional parameters for the SQLVulnerabilityAssessmentScansClient.BeginInitiateScan +// method. +type SQLVulnerabilityAssessmentScansClientBeginInitiateScanOptions struct { + DatabaseName *string + + // Resumes the long-running operation from the provided token. + ResumeToken string } // SQLVulnerabilityAssessmentScansClientGetOptions contains the optional parameters for the SQLVulnerabilityAssessmentScansClient.Get // method. type SQLVulnerabilityAssessmentScansClientGetOptions struct { - // placeholder for future optional parameters + DatabaseName *string } -// SQLVulnerabilityAssessmentScansClientListOptions contains the optional parameters for the SQLVulnerabilityAssessmentScansClient.List +// SQLVulnerabilityAssessmentScansClientGetScanOperationResultOptions contains the optional parameters for the SQLVulnerabilityAssessmentScansClient.GetScanOperationResult +// method. +type SQLVulnerabilityAssessmentScansClientGetScanOperationResultOptions struct { + DatabaseName *string +} + +// SQLVulnerabilityAssessmentScansClientListOptions contains the optional parameters for the SQLVulnerabilityAssessmentScansClient.NewListPager // method. type SQLVulnerabilityAssessmentScansClientListOptions struct { + // The name of the database to assess. Required when the API is called on the parent resource (e.g., server level) rather + // than on a specific database resource, since the database name is not part of the resource URI. This is the only way to + // assess system databases (e.g., master), which cannot be referenced directly in the resource URI. + DatabaseName *string +} + +// SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateOptions contains the optional parameters for the SQLVulnerabilityAssessmentSettingsClient.CreateOrUpdate +// method. +type SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SQLVulnerabilityAssessmentSettingsClientDeleteOptions contains the optional parameters for the SQLVulnerabilityAssessmentSettingsClient.Delete +// method. +type SQLVulnerabilityAssessmentSettingsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// SQLVulnerabilityAssessmentSettingsClientGetOptions contains the optional parameters for the SQLVulnerabilityAssessmentSettingsClient.Get +// method. +type SQLVulnerabilityAssessmentSettingsClientGetOptions struct { // placeholder for future optional parameters } @@ -1193,7 +1287,7 @@ type SensitivitySettingsClientListOptions struct { // ServerVulnerabilityAssessmentClientBeginDeleteOptions contains the optional parameters for the ServerVulnerabilityAssessmentClient.BeginDelete // method. type ServerVulnerabilityAssessmentClientBeginDeleteOptions struct { - // Resumes the LRO from the provided token. + // Resumes the long-running operation from the provided token. ResumeToken string } @@ -1254,41 +1348,90 @@ type SettingsClientUpdateOptions struct { // placeholder for future optional parameters } -// SoftwareInventoriesClientGetOptions contains the optional parameters for the SoftwareInventoriesClient.Get method. -type SoftwareInventoriesClientGetOptions struct { +// SolutionsClientGetOptions contains the optional parameters for the SolutionsClient.Get method. +type SolutionsClientGetOptions struct { // placeholder for future optional parameters } -// SoftwareInventoriesClientListByExtendedResourceOptions contains the optional parameters for the SoftwareInventoriesClient.NewListByExtendedResourcePager -// method. -type SoftwareInventoriesClientListByExtendedResourceOptions struct { +// SolutionsClientListOptions contains the optional parameters for the SolutionsClient.NewListPager method. +type SolutionsClientListOptions struct { // placeholder for future optional parameters } -// SoftwareInventoriesClientListBySubscriptionOptions contains the optional parameters for the SoftwareInventoriesClient.NewListBySubscriptionPager +// SolutionsReferenceDataClientListByHomeRegionOptions contains the optional parameters for the SolutionsReferenceDataClient.ListByHomeRegion // method. -type SoftwareInventoriesClientListBySubscriptionOptions struct { +type SolutionsReferenceDataClientListByHomeRegionOptions struct { // placeholder for future optional parameters } -// SolutionsClientGetOptions contains the optional parameters for the SolutionsClient.Get method. -type SolutionsClientGetOptions struct { +// SolutionsReferenceDataClientListOptions contains the optional parameters for the SolutionsReferenceDataClient.List method. +type SolutionsReferenceDataClientListOptions struct { // placeholder for future optional parameters } -// SolutionsClientListOptions contains the optional parameters for the SolutionsClient.NewListPager method. -type SolutionsClientListOptions struct { +// StandardAssignmentsClientCreateOptions contains the optional parameters for the StandardAssignmentsClient.Create method. +type StandardAssignmentsClientCreateOptions struct { // placeholder for future optional parameters } -// SolutionsReferenceDataClientListByHomeRegionOptions contains the optional parameters for the SolutionsReferenceDataClient.ListByHomeRegion +// StandardAssignmentsClientDeleteOptions contains the optional parameters for the StandardAssignmentsClient.Delete method. +type StandardAssignmentsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// StandardAssignmentsClientGetOptions contains the optional parameters for the StandardAssignmentsClient.Get method. +type StandardAssignmentsClientGetOptions struct { + // placeholder for future optional parameters +} + +// StandardAssignmentsClientListOptions contains the optional parameters for the StandardAssignmentsClient.NewListPager method. +type StandardAssignmentsClientListOptions struct { + // placeholder for future optional parameters +} + +// StandardsClientCreateOrUpdateOptions contains the optional parameters for the StandardsClient.CreateOrUpdate method. +type StandardsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// StandardsClientCreateOrUpdateOptions contains the optional parameters for the StandardsClient.CreateOrUpdate method. +type StandardsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// StandardsClientDeleteOptions contains the optional parameters for the StandardsClient.Delete method. +type StandardsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// StandardsClientDeleteOptions contains the optional parameters for the StandardsClient.Delete method. +type StandardsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// StandardsClientGetOptions contains the optional parameters for the StandardsClient.Get method. +type StandardsClientGetOptions struct { + // placeholder for future optional parameters +} + +// StandardsClientGetOptions contains the optional parameters for the StandardsClient.Get method. +type StandardsClientGetOptions struct { + // placeholder for future optional parameters +} + +// StandardsClientListBySubscriptionOptions contains the optional parameters for the StandardsClient.NewListBySubscriptionPager // method. -type SolutionsReferenceDataClientListByHomeRegionOptions struct { +type StandardsClientListBySubscriptionOptions struct { // placeholder for future optional parameters } -// SolutionsReferenceDataClientListOptions contains the optional parameters for the SolutionsReferenceDataClient.List method. -type SolutionsReferenceDataClientListOptions struct { +// StandardsClientListOptions contains the optional parameters for the StandardsClient.NewListPager method. +type StandardsClientListOptions struct { + // placeholder for future optional parameters +} + +// StandardsClientListOptions contains the optional parameters for the StandardsClient.NewListPager method. +type StandardsClientListOptions struct { // placeholder for future optional parameters } diff --git a/sdk/resourcemanager/security/armsecurity/polymorphic_helpers.go b/sdk/resourcemanager/security/armsecurity/polymorphic_helpers.go index 431a5497f915..d1f2e6f8044b 100644 --- a/sdk/resourcemanager/security/armsecurity/polymorphic_helpers.go +++ b/sdk/resourcemanager/security/armsecurity/polymorphic_helpers.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -17,12 +16,12 @@ func unmarshalAdditionalDataClassification(rawMsg json.RawMessage) (AdditionalDa } var b AdditionalDataClassification switch m["assessedResourceType"] { - case "ServerVulnerabilityAssessment": - b = &ServerVulnerabilityProperties{} - case string(AssessedResourceTypeContainerRegistryVulnerability): - b = &ContainerRegistryVulnerabilityProperties{} case string(AssessedResourceTypeSQLServerVulnerability): b = &SQLServerVulnerabilityProperties{} + case string(AssessedResourceTypeContainerRegistryVulnerability): + b = &ContainerRegistryVulnerabilityProperties{} + case string(AssessedResourceTypeServerVulnerabilityAssessment): + b = &ServerVulnerabilityProperties{} default: b = &AdditionalData{} } @@ -99,7 +98,7 @@ func unmarshalAllowlistCustomAlertRuleClassificationArray(rawMsg json.RawMessage return fArray, nil } -func unmarshalAuthenticationDetailsPropertiesClassification(rawMsg json.RawMessage) (AuthenticationDetailsPropertiesClassification, error) { +func unmarshalAuthenticationClassification(rawMsg json.RawMessage) (AuthenticationClassification, error) { if rawMsg == nil || string(rawMsg) == "null" { return nil, nil } @@ -107,16 +106,12 @@ func unmarshalAuthenticationDetailsPropertiesClassification(rawMsg json.RawMessa if err := json.Unmarshal(rawMsg, &m); err != nil { return nil, err } - var b AuthenticationDetailsPropertiesClassification + var b AuthenticationClassification switch m["authenticationType"] { - case string(AuthenticationTypeAwsAssumeRole): - b = &AwAssumeRoleAuthenticationDetailsProperties{} - case string(AuthenticationTypeAwsCreds): - b = &AwsCredsAuthenticationDetailsProperties{} - case string(AuthenticationTypeGcpCredentials): - b = &GcpCredentialsDetailsProperties{} + case string(AuthenticationTypeAccessToken): + b = &AccessTokenAuthentication{} default: - b = &AuthenticationDetailsProperties{} + b = &Authentication{} } if err := json.Unmarshal(rawMsg, b); err != nil { return nil, err @@ -134,10 +129,10 @@ func unmarshalAutomationActionClassification(rawMsg json.RawMessage) (Automation } var b AutomationActionClassification switch m["actionType"] { - case string(ActionTypeEventHub): - b = &AutomationActionEventHub{} case string(ActionTypeLogicApp): b = &AutomationActionLogicApp{} + case string(ActionTypeEventHub): + b = &AutomationActionEventHub{} case string(ActionTypeWorkspace): b = &AutomationActionWorkspace{} default: @@ -178,10 +173,10 @@ func unmarshalAwsOrganizationalDataClassification(rawMsg json.RawMessage) (AwsOr } var b AwsOrganizationalDataClassification switch m["organizationMembershipType"] { - case string(OrganizationMembershipTypeMember): - b = &AwsOrganizationalDataMember{} case string(OrganizationMembershipTypeOrganization): b = &AwsOrganizationalDataMaster{} + case string(OrganizationMembershipTypeMember): + b = &AwsOrganizationalDataMember{} default: b = &AwsOrganizationalData{} } @@ -203,30 +198,42 @@ func unmarshalCloudOfferingClassification(rawMsg json.RawMessage) (CloudOffering switch m["offeringType"] { case string(OfferingTypeCspmMonitorAws): b = &CspmMonitorAwsOffering{} - case string(OfferingTypeCspmMonitorAzureDevOps): - b = &CspmMonitorAzureDevOpsOffering{} + case string(OfferingTypeDefenderForContainersAws): + b = &DefenderForContainersAwsOffering{} + case string(OfferingTypeDefenderForServersAws): + b = &DefenderForServersAwsOffering{} + case string(OfferingTypeDefenderForDatabasesAws): + b = &DefenderFoDatabasesAwsOffering{} case string(OfferingTypeCspmMonitorGcp): b = &CspmMonitorGcpOffering{} - case string(OfferingTypeCspmMonitorGitLab): - b = &CspmMonitorGitLabOffering{} + case string(OfferingTypeDefenderForServersGcp): + b = &DefenderForServersGcpOffering{} + case string(OfferingTypeDefenderForDatabasesGcp): + b = &DefenderForDatabasesGcpOffering{} + case string(OfferingTypeDefenderForContainersGcp): + b = &DefenderForContainersGcpOffering{} case string(OfferingTypeCspmMonitorGithub): b = &CspmMonitorGithubOffering{} + case string(OfferingTypeCspmMonitorAzureDevOps): + b = &CspmMonitorAzureDevOpsOffering{} case string(OfferingTypeDefenderCspmAws): b = &DefenderCspmAwsOffering{} case string(OfferingTypeDefenderCspmGcp): b = &DefenderCspmGcpOffering{} - 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(OfferingTypeCspmMonitorGitLab): + b = &CspmMonitorGitLabOffering{} + case string(OfferingTypeCspmMonitorDockerHub): + b = &CspmMonitorDockerHubOffering{} + case string(OfferingTypeDefenderForContainersDockerHub): + b = &DefenderForContainersDockerHubOffering{} + case string(OfferingTypeDefenderCspmDockerHub): + b = &DefenderCspmDockerHubOffering{} + case string(OfferingTypeCspmMonitorJFrog): + b = &CspmMonitorJFrogOffering{} + case string(OfferingTypeDefenderForContainersJFrog): + b = &DefenderForContainersJFrogOffering{} + case string(OfferingTypeDefenderCspmJFrog): + b = &DefenderCspmJFrogOffering{} default: b = &CloudOffering{} } @@ -267,14 +274,18 @@ func unmarshalEnvironmentDataClassification(rawMsg json.RawMessage) (Environment switch m["environmentType"] { case string(EnvironmentTypeAwsAccount): b = &AwsEnvironmentData{} - case string(EnvironmentTypeAzureDevOpsScope): - b = &AzureDevOpsScopeEnvironmentData{} case string(EnvironmentTypeGcpProject): b = &GcpProjectEnvironmentData{} case string(EnvironmentTypeGithubScope): b = &GithubScopeEnvironmentData{} + case string(EnvironmentTypeAzureDevOpsScope): + b = &AzureDevOpsScopeEnvironmentData{} case string(EnvironmentTypeGitlabScope): b = &GitlabScopeEnvironmentData{} + case string(EnvironmentTypeDockerHubOrganization): + b = &DockerHubEnvironmentData{} + case string(EnvironmentTypeJFrogArtifactory): + b = &JFrogEnvironmentData{} default: b = &EnvironmentData{} } @@ -294,12 +305,12 @@ func unmarshalExternalSecuritySolutionClassification(rawMsg json.RawMessage) (Ex } var b ExternalSecuritySolutionClassification switch m["kind"] { - case string(ExternalSecuritySolutionKindAAD): - b = &AADExternalSecuritySolution{} - case string(ExternalSecuritySolutionKindATA): - b = &AtaExternalSecuritySolution{} case string(ExternalSecuritySolutionKindCEF): b = &CefExternalSecuritySolution{} + case string(ExternalSecuritySolutionKindATA): + b = &AtaExternalSecuritySolution{} + case string(ExternalSecuritySolutionKindAAD): + b = &AADExternalSecuritySolution{} default: b = &ExternalSecuritySolution{} } @@ -338,10 +349,10 @@ func unmarshalGcpOrganizationalDataClassification(rawMsg json.RawMessage) (GcpOr } var b GcpOrganizationalDataClassification switch m["organizationMembershipType"] { - case string(OrganizationMembershipTypeMember): - b = &GcpOrganizationalDataMember{} case string(OrganizationMembershipTypeOrganization): b = &GcpOrganizationalDataOrganization{} + case string(OrganizationMembershipTypeMember): + b = &GcpOrganizationalDataMember{} default: b = &GcpOrganizationalData{} } @@ -405,7 +416,7 @@ func unmarshalResourceDetailsClassification(rawMsg json.RawMessage) (ResourceDet switch m["source"] { case string(SourceAzure): b = &AzureResourceDetails{} - case string(SourceOnPremise): + case string(SourceOnPremiseResourceDetails): b = &OnPremiseResourceDetails{} case string(SourceOnPremiseSQL): b = &OnPremiseSQLResourceDetails{} @@ -510,10 +521,10 @@ func unmarshalSettingClassification(rawMsg json.RawMessage) (SettingClassificati } var b SettingClassification switch m["kind"] { - case string(SettingKindAlertSyncSettings): - b = &AlertSyncSettings{} case string(SettingKindDataExportSettings): b = &DataExportSettings{} + case string(SettingKindAlertSyncSettings): + b = &AlertSyncSettings{} default: b = &Setting{} } diff --git a/sdk/resourcemanager/security/armsecurity/pricings_client.go b/sdk/resourcemanager/security/armsecurity/pricings_client.go index dad23d3b37a7..e590f5a55a94 100644 --- a/sdk/resourcemanager/security/armsecurity/pricings_client.go +++ b/sdk/resourcemanager/security/armsecurity/pricings_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,7 +24,7 @@ type PricingsClient struct { // NewPricingsClient creates a new instance of PricingsClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewPricingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*PricingsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -38,11 +37,11 @@ func NewPricingsClient(credential azcore.TokenCredential, options *arm.ClientOpt } // Delete - Deletes a provided Microsoft Defender for Cloud pricing configuration in a specific resource. Valid only for resource -// scope (Supported resources are: 'VirtualMachines, VMSS and ARC MachinesS'). +// scope (Supported resources are: 'VirtualMachines, VMSS, ARC Machines, and Containers'). // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-01-01 -// - scopeID - The identifier of the resource, (format: 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) +// - scopeID - The fully qualified Azure Resource manager identifier of the resource. // - pricingName - name of the pricing configuration // - options - PricingsClientDeleteOptions contains the optional parameters for the PricingsClient.Delete method. func (client *PricingsClient) Delete(ctx context.Context, scopeID string, pricingName string, options *PricingsClientDeleteOptions) (PricingsClientDeleteResponse, error) { @@ -67,8 +66,11 @@ func (client *PricingsClient) Delete(ctx context.Context, scopeID string, pricin } // deleteCreateRequest creates the Delete request. -func (client *PricingsClient) deleteCreateRequest(ctx context.Context, scopeID string, pricingName string, options *PricingsClientDeleteOptions) (*policy.Request, error) { +func (client *PricingsClient) deleteCreateRequest(ctx context.Context, scopeID string, pricingName string, _ *PricingsClientDeleteOptions) (*policy.Request, error) { urlPath := "/{scopeId}/providers/Microsoft.Security/pricings/{pricingName}" + if scopeID == "" { + return nil, errors.New("parameter scopeID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{scopeId}", scopeID) if pricingName == "" { return nil, errors.New("parameter pricingName cannot be empty") @@ -81,20 +83,15 @@ func (client *PricingsClient) deleteCreateRequest(ctx context.Context, scopeID s reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Get the Defender plans pricing configurations of the selected scope (valid scopes are resource id or a subscription -// id). At the resource level, supported resource types are 'VirtualMachines, VMSS and -// ARC Machines'. +// id). At the resource level, supported resource types are 'VirtualMachines, VMSS and ARC Machines'. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-01-01 -// - scopeID - The scope id of the pricing. Valid scopes are: subscription (format: 'subscriptions/{subscriptionId}'), or a -// specific resource (format: -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) -// - Supported resources are (VirtualMachines) +// - scopeID - The fully qualified Azure Resource manager identifier of the resource. // - pricingName - name of the pricing configuration // - options - PricingsClientGetOptions contains the optional parameters for the PricingsClient.Get method. func (client *PricingsClient) Get(ctx context.Context, scopeID string, pricingName string, options *PricingsClientGetOptions) (PricingsClientGetResponse, error) { @@ -120,8 +117,11 @@ func (client *PricingsClient) Get(ctx context.Context, scopeID string, pricingNa } // getCreateRequest creates the Get request. -func (client *PricingsClient) getCreateRequest(ctx context.Context, scopeID string, pricingName string, options *PricingsClientGetOptions) (*policy.Request, error) { +func (client *PricingsClient) getCreateRequest(ctx context.Context, scopeID string, pricingName string, _ *PricingsClientGetOptions) (*policy.Request, error) { urlPath := "/{scopeId}/providers/Microsoft.Security/pricings/{pricingName}" + if scopeID == "" { + return nil, errors.New("parameter scopeID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{scopeId}", scopeID) if pricingName == "" { return nil, errors.New("parameter pricingName cannot be empty") @@ -148,17 +148,14 @@ func (client *PricingsClient) getHandleResponse(resp *http.Response) (PricingsCl } // List - Lists Microsoft Defender for Cloud pricing configurations of the scopeId, that match the optional given $filter. -// Valid scopes are: subscription id or a specific resource id (Supported resources are: -// 'VirtualMachines, VMSS and ARC Machines'). Valid $filter is: 'name in ({planName1},{planName2},…)'. If $filter is not provided, -// the unfiltered list will be returned. If '$filter=name in -// (planName1,planName2)' is provided, the returned list includes the pricings set for 'planName1' and 'planName2' only. +// Valid scopes are: subscription id or a specific resource id (Supported resources are: 'VirtualMachines, VMSS and ARC Machines'). +// Valid $filter is: 'name in ({planName1},{planName2},...)'. If $filter is not provided, the unfiltered list will be returned. +// If '$filter=name in (planName1,planName2)' is provided, the returned list includes the pricings set for 'planName1' and +// 'planName2' only. // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-01-01 -// - scopeID - The scope id of the pricing. Valid scopes are: subscription (format: 'subscriptions/{subscriptionId}'), or a -// specific resource (format: -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) -// - Supported resources are (VirtualMachines) +// - scopeID - The fully qualified Azure Resource manager identifier of the resource. // - options - PricingsClientListOptions contains the optional parameters for the PricingsClient.List method. func (client *PricingsClient) List(ctx context.Context, scopeID string, options *PricingsClientListOptions) (PricingsClientListResponse, error) { var err error @@ -185,6 +182,9 @@ func (client *PricingsClient) List(ctx context.Context, scopeID string, options // listCreateRequest creates the List request. func (client *PricingsClient) listCreateRequest(ctx context.Context, scopeID string, options *PricingsClientListOptions) (*policy.Request, error) { urlPath := "/{scopeId}/providers/Microsoft.Security/pricings" + if scopeID == "" { + return nil, errors.New("parameter scopeID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{scopeId}", scopeID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -210,15 +210,12 @@ func (client *PricingsClient) listHandleResponse(resp *http.Response) (PricingsC } // Update - Updates a provided Microsoft Defender for Cloud pricing configuration in the scope. Valid scopes are: subscription -// id or a specific resource id (Supported resources are: 'VirtualMachines, VMSS and ARC -// Machines' and only for plan='VirtualMachines' and subPlan='P1'). +// id or a specific resource id (Supported resources are: 'VirtualMachines, VMSS and ARC Machines' and only for plan='VirtualMachines' +// and subPlan='P1'). // If the operation fails it returns an *azcore.ResponseError type. // // Generated from API version 2024-01-01 -// - scopeID - The scope id of the pricing. Valid scopes are: subscription (format: 'subscriptions/{subscriptionId}'), or a -// specific resource (format: -// 'subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}) -// - Supported resources are (VirtualMachines) +// - scopeID - The fully qualified Azure Resource manager identifier of the resource. // - pricingName - name of the pricing configuration // - pricing - Pricing object // - options - PricingsClientUpdateOptions contains the optional parameters for the PricingsClient.Update method. @@ -245,8 +242,11 @@ func (client *PricingsClient) Update(ctx context.Context, scopeID string, pricin } // updateCreateRequest creates the Update request. -func (client *PricingsClient) updateCreateRequest(ctx context.Context, scopeID string, pricingName string, pricing Pricing, options *PricingsClientUpdateOptions) (*policy.Request, error) { +func (client *PricingsClient) updateCreateRequest(ctx context.Context, scopeID string, pricingName string, pricing Pricing, _ *PricingsClientUpdateOptions) (*policy.Request, error) { urlPath := "/{scopeId}/providers/Microsoft.Security/pricings/{pricingName}" + if scopeID == "" { + return nil, errors.New("parameter scopeID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{scopeId}", scopeID) if pricingName == "" { return nil, errors.New("parameter pricingName cannot be empty") @@ -260,6 +260,7 @@ func (client *PricingsClient) updateCreateRequest(ctx context.Context, scopeID s reqQP.Set("api-version", "2024-01-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, pricing); err != nil { return nil, err } diff --git a/sdk/resourcemanager/security/armsecurity/privateendpointconnections_client.go b/sdk/resourcemanager/security/armsecurity/privateendpointconnections_client.go new file mode 100644 index 000000000000..bed55efd9766 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/privateendpointconnections_client.go @@ -0,0 +1,344 @@ +// 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) Go Code Generator. 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" + "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" +) + +// PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. +// Don't use this type directly, use NewPrivateEndpointConnectionsClient() instead. +type PrivateEndpointConnectionsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateEndpointConnectionsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreateOrUpdate - Update the state of specified private endpoint connection associated with the private link. This +// operation is typically used to approve or reject pending private endpoint connections. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - privateLinkName - PrivateLinkParameters contains a group of parameters for the PrivateLinkResourcesClient.Get method. +// - options - PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginCreateOrUpdate +// method. +func (client *PrivateEndpointConnectionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, privateEndpointConnectionName string, properties PrivateEndpointConnectionProperties, privateLinkName PrivateLinkParameters, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.createOrUpdate(ctx, resourceGroupName, privateEndpointConnectionName, properties, privateLinkName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientCreateOrUpdateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// CreateOrUpdate - Update the state of specified private endpoint connection associated with the private link. This operation +// is typically used to approve or reject pending private endpoint connections. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-01-01 +func (client *PrivateEndpointConnectionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, privateEndpointConnectionName string, properties PrivateEndpointConnectionProperties, privateLinkName PrivateLinkParameters, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*http.Response, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.BeginCreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, privateEndpointConnectionName, properties, privateLinkName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, privateEndpointConnectionName string, properties PrivateEndpointConnectionProperties, privateLinkName PrivateLinkParameters, _ *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 privateLinkName.PrivateLinkName == "" { + return nil, errors.New("parameter privateLinkName.PrivateLinkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateLinkName}", url.PathEscape(privateLinkName.PrivateLinkName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Deletes the specified private endpoint connection associated with the private link. This operation will disconnect +// the private endpoint and remove the connection configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - privateLinkName - PrivateLinkParameters contains a group of parameters for the PrivateLinkResourcesClient.Get method. +// - options - PrivateEndpointConnectionsClientBeginDeleteOptions contains the optional parameters for the PrivateEndpointConnectionsClient.BeginDelete +// method. +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, privateEndpointConnectionName string, privateLinkName PrivateLinkParameters, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, privateEndpointConnectionName, privateLinkName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateEndpointConnectionsClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Deletes the specified private endpoint connection associated with the private link. This operation will disconnect +// the private endpoint and remove the connection configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-01-01 +func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, privateEndpointConnectionName string, privateLinkName PrivateLinkParameters, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateEndpointConnectionName, privateLinkName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateEndpointConnectionName string, privateLinkName PrivateLinkParameters, _ *PrivateEndpointConnectionsClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 privateLinkName.PrivateLinkName == "" { + return nil, errors.New("parameter privateLinkName.PrivateLinkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateLinkName}", url.PathEscape(privateLinkName.PrivateLinkName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Gets the specified private endpoint connection associated with the private link. Returns the connection details, +// status, and configuration for a specific private endpoint. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - privateLinkName - PrivateLinkParameters contains a group of parameters for the PrivateLinkResourcesClient.Get method. +// - options - PrivateEndpointConnectionsClientGetOptions contains the optional parameters for the PrivateEndpointConnectionsClient.Get +// method. +func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, privateEndpointConnectionName string, privateLinkName PrivateLinkParameters, options *PrivateEndpointConnectionsClientGetOptions) (PrivateEndpointConnectionsClientGetResponse, error) { + var err error + const operationName = "PrivateEndpointConnectionsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, privateEndpointConnectionName, privateLinkName, options) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateEndpointConnectionsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateEndpointConnectionName string, privateLinkName PrivateLinkParameters, _ *PrivateEndpointConnectionsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}/privateEndpointConnections/{privateEndpointConnectionName}" + 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 privateLinkName.PrivateLinkName == "" { + return nil, errors.New("parameter privateLinkName.PrivateLinkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateLinkName}", url.PathEscape(privateLinkName.PrivateLinkName)) + if privateEndpointConnectionName == "" { + return nil, errors.New("parameter privateEndpointConnectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateEndpointConnectionName}", url.PathEscape(privateEndpointConnectionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientGetResponse, error) { + result := PrivateEndpointConnectionsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { + return PrivateEndpointConnectionsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Gets all private endpoint connections for a private link. Returns the list of private endpoints that are +// connected or in the process of connecting to this private link. +// +// Generated from API version 2026-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - privateLinkName - PrivateLinkParameters contains a group of parameters for the PrivateLinkResourcesClient.Get method. +// - options - PrivateEndpointConnectionsClientListOptions contains the optional parameters for the PrivateEndpointConnectionsClient.NewListPager +// method. +func (client *PrivateEndpointConnectionsClient) NewListPager(resourceGroupName string, privateLinkName PrivateLinkParameters, options *PrivateEndpointConnectionsClientListOptions) *runtime.Pager[PrivateEndpointConnectionsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateEndpointConnectionsClientListResponse]{ + More: func(page PrivateEndpointConnectionsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateEndpointConnectionsClientListResponse) (PrivateEndpointConnectionsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateEndpointConnectionsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, privateLinkName, options) + }, nil) + if err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateLinkName PrivateLinkParameters, _ *PrivateEndpointConnectionsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}/privateEndpointConnections" + 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 privateLinkName.PrivateLinkName == "" { + return nil, errors.New("parameter privateLinkName.PrivateLinkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateLinkName}", url.PathEscape(privateLinkName.PrivateLinkName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsClientListResponse, error) { + result := PrivateEndpointConnectionsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { + return PrivateEndpointConnectionsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/privatelinkresources_client.go b/sdk/resourcemanager/security/armsecurity/privatelinkresources_client.go new file mode 100644 index 000000000000..63f3303edbe3 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/privatelinkresources_client.go @@ -0,0 +1,174 @@ +// 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) Go Code Generator. 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" + "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" +) + +// PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. +// Don't use this type directly, use NewPrivateLinkResourcesClient() instead. +type PrivateLinkResourcesClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinkResourcesClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateLinkResourcesClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// Get - Get the specified private link resource associated with the private link. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - privateLinkName - PrivateLinkParameters contains a group of parameters for the PrivateLinkResourcesClient.Get method. +// - options - PrivateLinkResourcesClientGetOptions contains the optional parameters for the PrivateLinkResourcesClient.Get +// method. +func (client *PrivateLinkResourcesClient) Get(ctx context.Context, resourceGroupName string, groupID string, privateLinkName PrivateLinkParameters, options *PrivateLinkResourcesClientGetOptions) (PrivateLinkResourcesClientGetResponse, error) { + var err error + const operationName = "PrivateLinkResourcesClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, groupID, privateLinkName, options) + if err != nil { + return PrivateLinkResourcesClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateLinkResourcesClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinkResourcesClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, resourceGroupName string, groupID string, privateLinkName PrivateLinkParameters, _ *PrivateLinkResourcesClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}/privateLinkResources/{groupId}" + 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 privateLinkName.PrivateLinkName == "" { + return nil, errors.New("parameter privateLinkName.PrivateLinkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateLinkName}", url.PathEscape(privateLinkName.PrivateLinkName)) + if groupID == "" { + return nil, errors.New("parameter groupID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupId}", url.PathEscape(groupID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesClientGetResponse, error) { + result := PrivateLinkResourcesClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkGroupResource); err != nil { + return PrivateLinkResourcesClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - List all private link resources in a private link. +// +// Generated from API version 2026-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - privateLinkName - PrivateLinkParameters contains a group of parameters for the PrivateLinkResourcesClient.Get method. +// - options - PrivateLinkResourcesClientListOptions contains the optional parameters for the PrivateLinkResourcesClient.NewListPager +// method. +func (client *PrivateLinkResourcesClient) NewListPager(resourceGroupName string, privateLinkName PrivateLinkParameters, options *PrivateLinkResourcesClientListOptions) *runtime.Pager[PrivateLinkResourcesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinkResourcesClientListResponse]{ + More: func(page PrivateLinkResourcesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateLinkResourcesClientListResponse) (PrivateLinkResourcesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinkResourcesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, privateLinkName, options) + }, nil) + if err != nil { + return PrivateLinkResourcesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, resourceGroupName string, privateLinkName PrivateLinkParameters, _ *PrivateLinkResourcesClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}/privateLinkResources" + 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 privateLinkName.PrivateLinkName == "" { + return nil, errors.New("parameter privateLinkName.PrivateLinkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateLinkName}", url.PathEscape(privateLinkName.PrivateLinkName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesClientListResponse, error) { + result := PrivateLinkResourcesClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkGroupResourceListResult); err != nil { + return PrivateLinkResourcesClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/privatelinks_client.go b/sdk/resourcemanager/security/armsecurity/privatelinks_client.go new file mode 100644 index 000000000000..13c36b4ef851 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/privatelinks_client.go @@ -0,0 +1,506 @@ +// 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) Go Code Generator. 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" + "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" +) + +// PrivateLinksClient contains the methods for the PrivateLinks group. +// Don't use this type directly, use NewPrivateLinksClient() instead. +type PrivateLinksClient struct { + internal *arm.Client + subscriptionID string +} + +// NewPrivateLinksClient creates a new instance of PrivateLinksClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewPrivateLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateLinksClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &PrivateLinksClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// BeginCreate - Create a private link resource. This operation creates the necessary infrastructure to enable private endpoint +// connections to Microsoft Defender for Cloud services. For updates to existing resources, use the PATCH operation. The operation +// is asynchronous and may take several minutes to complete. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - privateLinkName - PrivateLinkParameters contains a group of parameters for the PrivateLinkResourcesClient.Get method. +// - options - PrivateLinksClientBeginCreateOptions contains the optional parameters for the PrivateLinksClient.BeginCreate +// method. +func (client *PrivateLinksClient) BeginCreate(ctx context.Context, resourceGroupName string, privateLink PrivateLinkResource, privateLinkName PrivateLinkParameters, options *PrivateLinksClientBeginCreateOptions) (*runtime.Poller[PrivateLinksClientCreateResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.create(ctx, resourceGroupName, privateLink, privateLinkName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateLinksClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateLinksClientCreateResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Create - Create a private link resource. This operation creates the necessary infrastructure to enable private endpoint +// connections to Microsoft Defender for Cloud services. For updates to existing resources, use the PATCH operation. The operation +// is asynchronous and may take several minutes to complete. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-01-01 +func (client *PrivateLinksClient) create(ctx context.Context, resourceGroupName string, privateLink PrivateLinkResource, privateLinkName PrivateLinkParameters, options *PrivateLinksClientBeginCreateOptions) (*http.Response, error) { + var err error + const operationName = "PrivateLinksClient.BeginCreate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceGroupName, privateLink, privateLinkName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// createCreateRequest creates the Create request. +func (client *PrivateLinksClient) createCreateRequest(ctx context.Context, resourceGroupName string, privateLink PrivateLinkResource, privateLinkName PrivateLinkParameters, _ *PrivateLinksClientBeginCreateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}" + 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 privateLinkName.PrivateLinkName == "" { + return nil, errors.New("parameter privateLinkName.PrivateLinkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateLinkName}", url.PathEscape(privateLinkName.PrivateLinkName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, privateLink); err != nil { + return nil, err + } + return req, nil +} + +// BeginDelete - Delete a private link resource. This operation will remove the private link infrastructure and disconnect +// all associated private endpoints. This operation is asynchronous and may take several minutes to complete. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - privateLinkName - PrivateLinkParameters contains a group of parameters for the PrivateLinkResourcesClient.Get method. +// - options - PrivateLinksClientBeginDeleteOptions contains the optional parameters for the PrivateLinksClient.BeginDelete +// method. +func (client *PrivateLinksClient) BeginDelete(ctx context.Context, resourceGroupName string, privateLinkName PrivateLinkParameters, options *PrivateLinksClientBeginDeleteOptions) (*runtime.Poller[PrivateLinksClientDeleteResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.deleteOperation(ctx, resourceGroupName, privateLinkName, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[PrivateLinksClientDeleteResponse]{ + FinalStateVia: runtime.FinalStateViaAzureAsyncOp, + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[PrivateLinksClientDeleteResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// Delete - Delete a private link resource. This operation will remove the private link infrastructure and disconnect all +// associated private endpoints. This operation is asynchronous and may take several minutes to complete. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-01-01 +func (client *PrivateLinksClient) deleteOperation(ctx context.Context, resourceGroupName string, privateLinkName PrivateLinkParameters, options *PrivateLinksClientBeginDeleteOptions) (*http.Response, error) { + var err error + const operationName = "PrivateLinksClient.BeginDelete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, privateLinkName, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusAccepted, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *PrivateLinksClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, privateLinkName PrivateLinkParameters, _ *PrivateLinksClientBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}" + 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 privateLinkName.PrivateLinkName == "" { + return nil, errors.New("parameter privateLinkName.PrivateLinkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateLinkName}", url.PathEscape(privateLinkName.PrivateLinkName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Get a private link resource. Returns the configuration and status of private endpoint connectivity for Microsoft +// Defender for Cloud services in the specified region. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - privateLinkName - PrivateLinkParameters contains a group of parameters for the PrivateLinkResourcesClient.Get method. +// - options - PrivateLinksClientGetOptions contains the optional parameters for the PrivateLinksClient.Get method. +func (client *PrivateLinksClient) Get(ctx context.Context, resourceGroupName string, privateLinkName PrivateLinkParameters, options *PrivateLinksClientGetOptions) (PrivateLinksClientGetResponse, error) { + var err error + const operationName = "PrivateLinksClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, privateLinkName, options) + if err != nil { + return PrivateLinksClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateLinksClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinksClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *PrivateLinksClient) getCreateRequest(ctx context.Context, resourceGroupName string, privateLinkName PrivateLinkParameters, _ *PrivateLinksClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}" + 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 privateLinkName.PrivateLinkName == "" { + return nil, errors.New("parameter privateLinkName.PrivateLinkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateLinkName}", url.PathEscape(privateLinkName.PrivateLinkName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *PrivateLinksClient) getHandleResponse(resp *http.Response) (PrivateLinksClientGetResponse, error) { + result := PrivateLinksClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { + return PrivateLinksClientGetResponse{}, err + } + return result, nil +} + +// Head - Checks whether private link exists. +// +// Generated from API version 2026-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - privateLinkName - PrivateLinkParameters contains a group of parameters for the PrivateLinkResourcesClient.Get method. +// - options - PrivateLinksClientHeadOptions contains the optional parameters for the PrivateLinksClient.Head method. +func (client *PrivateLinksClient) Head(ctx context.Context, resourceGroupName string, privateLinkName PrivateLinkParameters, options *PrivateLinksClientHeadOptions) (PrivateLinksClientHeadResponse, error) { + var err error + const operationName = "PrivateLinksClient.Head" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.headCreateRequest(ctx, resourceGroupName, privateLinkName, options) + if err != nil { + return PrivateLinksClientHeadResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateLinksClientHeadResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinksClientHeadResponse{}, err + } + return PrivateLinksClientHeadResponse{Success: httpResp.StatusCode >= 200 && httpResp.StatusCode < 300}, nil +} + +// headCreateRequest creates the Head request. +func (client *PrivateLinksClient) headCreateRequest(ctx context.Context, resourceGroupName string, privateLinkName PrivateLinkParameters, _ *PrivateLinksClientHeadOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}" + 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 privateLinkName.PrivateLinkName == "" { + return nil, errors.New("parameter privateLinkName.PrivateLinkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateLinkName}", url.PathEscape(privateLinkName.PrivateLinkName)) + req, err := runtime.NewRequest(ctx, http.MethodHead, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// NewListPager - Lists all the private links in the specified resource group. private links enable secure, private connectivity +// to Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' property in +// the response to get the next page of private links for the specified resource group. +// +// Generated from API version 2026-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - PrivateLinksClientListOptions contains the optional parameters for the PrivateLinksClient.NewListPager method. +func (client *PrivateLinksClient) NewListPager(resourceGroupName string, options *PrivateLinksClientListOptions) *runtime.Pager[PrivateLinksClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinksClientListResponse]{ + More: func(page PrivateLinksClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateLinksClientListResponse) (PrivateLinksClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinksClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return PrivateLinksClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *PrivateLinksClient) listCreateRequest(ctx context.Context, resourceGroupName string, _ *PrivateLinksClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks" + 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)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *PrivateLinksClient) listHandleResponse(resp *http.Response) (PrivateLinksClientListResponse, error) { + result := PrivateLinksClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinksList); err != nil { + return PrivateLinksClientListResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Lists all the private links in the specified subscription. private links enable secure, private +// connectivity to Microsoft Defender for Cloud services without exposing traffic to the public internet. Use the 'nextLink' +// property in the response to get the next page of private links for the specified subscription. +// +// Generated from API version 2026-01-01 +// - options - PrivateLinksClientListBySubscriptionOptions contains the optional parameters for the PrivateLinksClient.NewListBySubscriptionPager +// method. +func (client *PrivateLinksClient) NewListBySubscriptionPager(options *PrivateLinksClientListBySubscriptionOptions) *runtime.Pager[PrivateLinksClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[PrivateLinksClientListBySubscriptionResponse]{ + More: func(page PrivateLinksClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *PrivateLinksClientListBySubscriptionResponse) (PrivateLinksClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "PrivateLinksClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return PrivateLinksClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *PrivateLinksClient) listBySubscriptionCreateRequest(ctx context.Context, _ *PrivateLinksClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/privateLinks" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *PrivateLinksClient) listBySubscriptionHandleResponse(resp *http.Response) (PrivateLinksClientListBySubscriptionResponse, error) { + result := PrivateLinksClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinksList); err != nil { + return PrivateLinksClientListBySubscriptionResponse{}, err + } + return result, nil +} + +// Update - Update specific properties of a private link resource. Use this operation to update mutable properties like tags +// without affecting the entire resource configuration. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-01-01 +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - privateLinkName - PrivateLinkParameters contains a group of parameters for the PrivateLinkResourcesClient.Get method. +// - options - PrivateLinksClientUpdateOptions contains the optional parameters for the PrivateLinksClient.Update method. +func (client *PrivateLinksClient) Update(ctx context.Context, resourceGroupName string, privateLink PrivateLinkUpdate, privateLinkName PrivateLinkParameters, options *PrivateLinksClientUpdateOptions) (PrivateLinksClientUpdateResponse, error) { + var err error + const operationName = "PrivateLinksClient.Update" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, resourceGroupName, privateLink, privateLinkName, options) + if err != nil { + return PrivateLinksClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return PrivateLinksClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return PrivateLinksClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *PrivateLinksClient) updateCreateRequest(ctx context.Context, resourceGroupName string, privateLink PrivateLinkUpdate, privateLinkName PrivateLinkParameters, _ *PrivateLinksClientUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/privateLinks/{privateLinkName}" + 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 privateLinkName.PrivateLinkName == "" { + return nil, errors.New("parameter privateLinkName.PrivateLinkName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{privateLinkName}", url.PathEscape(privateLinkName.PrivateLinkName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-01-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, privateLink); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *PrivateLinksClient) updateHandleResponse(resp *http.Response) (PrivateLinksClientUpdateResponse, error) { + result := PrivateLinksClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { + return PrivateLinksClientUpdateResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/regulatorycomplianceassessments_client.go b/sdk/resourcemanager/security/armsecurity/regulatorycomplianceassessments_client.go index bfbd383224b9..656b95f4e5c9 100644 --- a/sdk/resourcemanager/security/armsecurity/regulatorycomplianceassessments_client.go +++ b/sdk/resourcemanager/security/armsecurity/regulatorycomplianceassessments_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type RegulatoryComplianceAssessmentsClient struct { } // NewRegulatoryComplianceAssessmentsClient creates a new instance of RegulatoryComplianceAssessmentsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewRegulatoryComplianceAssessmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RegulatoryComplianceAssessmentsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -72,7 +71,7 @@ func (client *RegulatoryComplianceAssessmentsClient) Get(ctx context.Context, re } // getCreateRequest creates the Get request. -func (client *RegulatoryComplianceAssessmentsClient) getCreateRequest(ctx context.Context, regulatoryComplianceStandardName string, regulatoryComplianceControlName string, regulatoryComplianceAssessmentName string, options *RegulatoryComplianceAssessmentsClientGetOptions) (*policy.Request, error) { +func (client *RegulatoryComplianceAssessmentsClient) getCreateRequest(ctx context.Context, regulatoryComplianceStandardName string, regulatoryComplianceControlName string, regulatoryComplianceAssessmentName string, _ *RegulatoryComplianceAssessmentsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}/regulatoryComplianceAssessments/{regulatoryComplianceAssessmentName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/regulatorycompliancecontrols_client.go b/sdk/resourcemanager/security/armsecurity/regulatorycompliancecontrols_client.go index 73baf8b2ce00..032ef52182fc 100644 --- a/sdk/resourcemanager/security/armsecurity/regulatorycompliancecontrols_client.go +++ b/sdk/resourcemanager/security/armsecurity/regulatorycompliancecontrols_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type RegulatoryComplianceControlsClient struct { } // NewRegulatoryComplianceControlsClient creates a new instance of RegulatoryComplianceControlsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewRegulatoryComplianceControlsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RegulatoryComplianceControlsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -71,7 +70,7 @@ func (client *RegulatoryComplianceControlsClient) Get(ctx context.Context, regul } // getCreateRequest creates the Get request. -func (client *RegulatoryComplianceControlsClient) getCreateRequest(ctx context.Context, regulatoryComplianceStandardName string, regulatoryComplianceControlName string, options *RegulatoryComplianceControlsClientGetOptions) (*policy.Request, error) { +func (client *RegulatoryComplianceControlsClient) getCreateRequest(ctx context.Context, regulatoryComplianceStandardName string, regulatoryComplianceControlName string, _ *RegulatoryComplianceControlsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}/regulatoryComplianceControls/{regulatoryComplianceControlName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/regulatorycompliancestandards_client.go b/sdk/resourcemanager/security/armsecurity/regulatorycompliancestandards_client.go index 53b2dfc86fe5..d18c28b08b89 100644 --- a/sdk/resourcemanager/security/armsecurity/regulatorycompliancestandards_client.go +++ b/sdk/resourcemanager/security/armsecurity/regulatorycompliancestandards_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type RegulatoryComplianceStandardsClient struct { } // NewRegulatoryComplianceStandardsClient creates a new instance of RegulatoryComplianceStandardsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewRegulatoryComplianceStandardsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*RegulatoryComplianceStandardsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -70,7 +69,7 @@ func (client *RegulatoryComplianceStandardsClient) Get(ctx context.Context, regu } // getCreateRequest creates the Get request. -func (client *RegulatoryComplianceStandardsClient) getCreateRequest(ctx context.Context, regulatoryComplianceStandardName string, options *RegulatoryComplianceStandardsClientGetOptions) (*policy.Request, error) { +func (client *RegulatoryComplianceStandardsClient) getCreateRequest(ctx context.Context, regulatoryComplianceStandardName string, _ *RegulatoryComplianceStandardsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/regulatoryComplianceStandards/{regulatoryComplianceStandardName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/responses.go b/sdk/resourcemanager/security/armsecurity/responses.go index cf40c7b2fb76..af2be3887ac7 100644 --- a/sdk/resourcemanager/security/armsecurity/responses.go +++ b/sdk/resourcemanager/security/armsecurity/responses.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -40,67 +39,6 @@ type APICollectionsClientOnboardAzureAPIManagementAPIResponse struct { APICollection } -// AccountConnectorsClientCreateOrUpdateResponse contains the response from method AccountConnectorsClient.CreateOrUpdate. -type AccountConnectorsClientCreateOrUpdateResponse struct { - // The connector setting - ConnectorSetting -} - -// AccountConnectorsClientDeleteResponse contains the response from method AccountConnectorsClient.Delete. -type AccountConnectorsClientDeleteResponse struct { - // placeholder for future response values -} - -// AccountConnectorsClientGetResponse contains the response from method AccountConnectorsClient.Get. -type AccountConnectorsClientGetResponse struct { - // The connector setting - ConnectorSetting -} - -// AccountConnectorsClientListResponse contains the response from method AccountConnectorsClient.NewListPager. -type AccountConnectorsClientListResponse struct { - // For a subscription, list of all cloud account connectors and their settings - ConnectorSettingList -} - -// AdaptiveApplicationControlsClientDeleteResponse contains the response from method AdaptiveApplicationControlsClient.Delete. -type AdaptiveApplicationControlsClientDeleteResponse struct { - // placeholder for future response values -} - -// AdaptiveApplicationControlsClientGetResponse contains the response from method AdaptiveApplicationControlsClient.Get. -type AdaptiveApplicationControlsClientGetResponse struct { - AdaptiveApplicationControlGroup -} - -// AdaptiveApplicationControlsClientListResponse contains the response from method AdaptiveApplicationControlsClient.List. -type AdaptiveApplicationControlsClientListResponse struct { - // Represents a list of VM/server groups and set of rules that are Recommended by Microsoft Defender for Cloud to be allowed - AdaptiveApplicationControlGroups -} - -// AdaptiveApplicationControlsClientPutResponse contains the response from method AdaptiveApplicationControlsClient.Put. -type AdaptiveApplicationControlsClientPutResponse struct { - AdaptiveApplicationControlGroup -} - -// AdaptiveNetworkHardeningsClientEnforceResponse contains the response from method AdaptiveNetworkHardeningsClient.BeginEnforce. -type AdaptiveNetworkHardeningsClientEnforceResponse struct { - // placeholder for future response values -} - -// AdaptiveNetworkHardeningsClientGetResponse contains the response from method AdaptiveNetworkHardeningsClient.Get. -type AdaptiveNetworkHardeningsClientGetResponse struct { - // The resource whose properties describes the Adaptive Network Hardening settings for some Azure resource - AdaptiveNetworkHardening -} - -// AdaptiveNetworkHardeningsClientListByExtendedResourceResponse contains the response from method AdaptiveNetworkHardeningsClient.NewListByExtendedResourcePager. -type AdaptiveNetworkHardeningsClientListByExtendedResourceResponse struct { - // Response for ListAdaptiveNetworkHardenings API service call - AdaptiveNetworkHardeningsList -} - // AdvancedThreatProtectionClientCreateResponse contains the response from method AdvancedThreatProtectionClient.Create. type AdvancedThreatProtectionClientCreateResponse struct { // The Advanced Threat Protection resource. @@ -316,6 +254,35 @@ type AssessmentsMetadataClientListResponse struct { AssessmentMetadataResponseList } +// AssignmentsClientCreateOrUpdateResponse contains the response from method AssignmentsClient.CreateOrUpdate. +type AssignmentsClientCreateOrUpdateResponse struct { + // Security Assignment on a resource group over a given scope + Assignment +} + +// AssignmentsClientDeleteResponse contains the response from method AssignmentsClient.Delete. +type AssignmentsClientDeleteResponse struct { + // placeholder for future response values +} + +// AssignmentsClientGetResponse contains the response from method AssignmentsClient.Get. +type AssignmentsClientGetResponse struct { + // Security Assignment on a resource group over a given scope + Assignment +} + +// AssignmentsClientListBySubscriptionResponse contains the response from method AssignmentsClient.NewListBySubscriptionPager. +type AssignmentsClientListBySubscriptionResponse struct { + // Page of a standard assignment list + AssignmentList +} + +// AssignmentsClientListResponse contains the response from method AssignmentsClient.NewListPager. +type AssignmentsClientListResponse struct { + // Page of a standard assignment list + AssignmentList +} + // AutoProvisioningSettingsClientCreateResponse contains the response from method AutoProvisioningSettingsClient.Create. type AutoProvisioningSettingsClientCreateResponse struct { // Auto provisioning setting @@ -558,62 +525,33 @@ type ContactsClientListResponse struct { ContactList } -// CustomAssessmentAutomationsClientCreateResponse contains the response from method CustomAssessmentAutomationsClient.Create. -type CustomAssessmentAutomationsClientCreateResponse struct { - // Custom Assessment Automation - CustomAssessmentAutomation -} - -// CustomAssessmentAutomationsClientDeleteResponse contains the response from method CustomAssessmentAutomationsClient.Delete. -type CustomAssessmentAutomationsClientDeleteResponse struct { - // placeholder for future response values -} - -// CustomAssessmentAutomationsClientGetResponse contains the response from method CustomAssessmentAutomationsClient.Get. -type CustomAssessmentAutomationsClientGetResponse struct { - // Custom Assessment Automation - CustomAssessmentAutomation -} - -// CustomAssessmentAutomationsClientListByResourceGroupResponse contains the response from method CustomAssessmentAutomationsClient.NewListByResourceGroupPager. -type CustomAssessmentAutomationsClientListByResourceGroupResponse struct { - // A list of Custom Assessment Automations - CustomAssessmentAutomationsListResult -} - -// CustomAssessmentAutomationsClientListBySubscriptionResponse contains the response from method CustomAssessmentAutomationsClient.NewListBySubscriptionPager. -type CustomAssessmentAutomationsClientListBySubscriptionResponse struct { - // A list of Custom Assessment Automations - CustomAssessmentAutomationsListResult -} - -// CustomEntityStoreAssignmentsClientCreateResponse contains the response from method CustomEntityStoreAssignmentsClient.Create. -type CustomEntityStoreAssignmentsClientCreateResponse struct { - // Custom entity store assignment - CustomEntityStoreAssignment +// CustomRecommendationsClientCreateOrUpdateResponse contains the response from method CustomRecommendationsClient.CreateOrUpdate. +type CustomRecommendationsClientCreateOrUpdateResponse struct { + // Custom Recommendation + CustomRecommendation } -// CustomEntityStoreAssignmentsClientDeleteResponse contains the response from method CustomEntityStoreAssignmentsClient.Delete. -type CustomEntityStoreAssignmentsClientDeleteResponse struct { +// CustomRecommendationsClientDeleteResponse contains the response from method CustomRecommendationsClient.Delete. +type CustomRecommendationsClientDeleteResponse struct { // placeholder for future response values } -// CustomEntityStoreAssignmentsClientGetResponse contains the response from method CustomEntityStoreAssignmentsClient.Get. -type CustomEntityStoreAssignmentsClientGetResponse struct { - // Custom entity store assignment - CustomEntityStoreAssignment +// CustomRecommendationsClientGetResponse contains the response from method CustomRecommendationsClient.Get. +type CustomRecommendationsClientGetResponse struct { + // Custom Recommendation + CustomRecommendation } -// CustomEntityStoreAssignmentsClientListByResourceGroupResponse contains the response from method CustomEntityStoreAssignmentsClient.NewListByResourceGroupPager. -type CustomEntityStoreAssignmentsClientListByResourceGroupResponse struct { - // A list of custom entity store assignments - CustomEntityStoreAssignmentsListResult +// CustomRecommendationsClientListResponse contains the response from method CustomRecommendationsClient.NewListPager. +type CustomRecommendationsClientListResponse struct { + // A list of Custom Recommendations + CustomRecommendationsList } -// CustomEntityStoreAssignmentsClientListBySubscriptionResponse contains the response from method CustomEntityStoreAssignmentsClient.NewListBySubscriptionPager. -type CustomEntityStoreAssignmentsClientListBySubscriptionResponse struct { - // A list of custom entity store assignments - CustomEntityStoreAssignmentsListResult +// DefenderForStorageClientCancelMalwareScanResponse contains the response from method DefenderForStorageClient.CancelMalwareScan. +type DefenderForStorageClientCancelMalwareScanResponse struct { + // Describes the state of a malware scan operation. + MalwareScan } // DefenderForStorageClientCreateResponse contains the response from method DefenderForStorageClient.Create. @@ -622,12 +560,30 @@ type DefenderForStorageClientCreateResponse struct { DefenderForStorageSetting } +// DefenderForStorageClientGetMalwareScanResponse contains the response from method DefenderForStorageClient.GetMalwareScan. +type DefenderForStorageClientGetMalwareScanResponse struct { + // Describes the state of a malware scan operation. + MalwareScan +} + // DefenderForStorageClientGetResponse contains the response from method DefenderForStorageClient.Get. type DefenderForStorageClientGetResponse struct { // The Defender for Storage resource. DefenderForStorageSetting } +// DefenderForStorageClientListResponse contains the response from method DefenderForStorageClient.NewListPager. +type DefenderForStorageClientListResponse struct { + // List of Defender for Storage settings. + DefenderForStorageSettingList +} + +// DefenderForStorageClientStartMalwareScanResponse contains the response from method DefenderForStorageClient.StartMalwareScan. +type DefenderForStorageClientStartMalwareScanResponse struct { + // Describes the state of a malware scan operation. + MalwareScan +} + // DevOpsConfigurationsClientCreateOrUpdateResponse contains the response from method DevOpsConfigurationsClient.BeginCreateOrUpdate. type DevOpsConfigurationsClientCreateOrUpdateResponse struct { // DevOps Configuration resource. @@ -688,6 +644,7 @@ type DeviceSecurityGroupsClientListResponse struct { // DiscoveredSecuritySolutionsClientGetResponse contains the response from method DiscoveredSecuritySolutionsClient.Get. type DiscoveredSecuritySolutionsClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. DiscoveredSecuritySolution } @@ -708,16 +665,6 @@ type ExternalSecuritySolutionsClientGetResponse struct { ExternalSecuritySolutionClassification } -// UnmarshalJSON implements the json.Unmarshaller interface for type ExternalSecuritySolutionsClientGetResponse. -func (e *ExternalSecuritySolutionsClientGetResponse) UnmarshalJSON(data []byte) error { - res, err := unmarshalExternalSecuritySolutionClassification(data) - if err != nil { - return err - } - e.ExternalSecuritySolutionClassification = res - return nil -} - // ExternalSecuritySolutionsClientListByHomeRegionResponse contains the response from method ExternalSecuritySolutionsClient.NewListByHomeRegionPager. type ExternalSecuritySolutionsClientListByHomeRegionResponse struct { ExternalSecuritySolutionList @@ -728,6 +675,11 @@ type ExternalSecuritySolutionsClientListResponse struct { ExternalSecuritySolutionList } +// GitHubIssuesClientCreateResponse contains the response from method GitHubIssuesClient.BeginCreate. +type GitHubIssuesClientCreateResponse struct { + // placeholder for future response values +} + // GitHubOwnersClientGetResponse contains the response from method GitHubOwnersClient.Get. type GitHubOwnersClientGetResponse struct { // GitHub Owner resource. @@ -848,9 +800,9 @@ type GovernanceRulesClientListResponse struct { // GovernanceRulesClientOperationResultsResponse contains the response from method GovernanceRulesClient.OperationResults. type GovernanceRulesClientOperationResultsResponse struct { // Long run operation status of governance rule over a given scope - OperationResultAutoGenerated + OperationResult - // Location contains the information returned from the location header response. + // Location URL for the execution status Location *string } @@ -962,6 +914,7 @@ type IotSecuritySolutionsAnalyticsRecommendationClientListResponse struct { // JitNetworkAccessPoliciesClientCreateOrUpdateResponse contains the response from method JitNetworkAccessPoliciesClient.CreateOrUpdate. type JitNetworkAccessPoliciesClientCreateOrUpdateResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. JitNetworkAccessPolicy } @@ -972,6 +925,7 @@ type JitNetworkAccessPoliciesClientDeleteResponse struct { // JitNetworkAccessPoliciesClientGetResponse contains the response from method JitNetworkAccessPoliciesClient.Get. type JitNetworkAccessPoliciesClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. JitNetworkAccessPolicy } @@ -1024,10 +978,25 @@ type MdeOnboardingsClientListResponse struct { MdeOnboardingDataList } +// OperationResultsClientGetResponse contains the response from method OperationResultsClient.Get. +type OperationResultsClientGetResponse struct { + // URL to query for status of the operation. + Location *string + + // The Retry-After header can indicate how long the client should wait before polling the operation status. + RetryAfter *int32 +} + +// OperationStatusesClientGetResponse contains the response from method OperationStatusesClient.Get. +type OperationStatusesClientGetResponse struct { + // The current status of an async operation. + OperationStatusResult +} + // OperationsClientListResponse contains the response from method OperationsClient.NewListPager. type OperationsClientListResponse struct { - // List of possible operations for Microsoft.Security resource provider - OperationList + // A list of REST API operations supported by an Azure Resource Provider. It contains an URL link to get the next set of results. + OperationListResult } // OperatorsClientCreateOrUpdateResponse contains the response from method OperatorsClient.CreateOrUpdate. @@ -1047,7 +1016,7 @@ type OperatorsClientGetResponse struct { OperatorResource } -// OperatorsClientListResponse contains the response from method OperatorsClient.List. +// OperatorsClientListResponse contains the response from method OperatorsClient.NewListPager. type OperatorsClientListResponse struct { // List of SecurityOperator response. OperatorList @@ -1078,6 +1047,85 @@ type PricingsClientUpdateResponse struct { Pricing } +// PrivateEndpointConnectionsClientCreateOrUpdateResponse contains the response from method PrivateEndpointConnectionsClient.BeginCreateOrUpdate. +type PrivateEndpointConnectionsClientCreateOrUpdateResponse struct { + // The private endpoint connection resource. + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsClientDeleteResponse contains the response from method PrivateEndpointConnectionsClient.BeginDelete. +type PrivateEndpointConnectionsClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateEndpointConnectionsClientGetResponse contains the response from method PrivateEndpointConnectionsClient.Get. +type PrivateEndpointConnectionsClientGetResponse struct { + // The private endpoint connection resource. + PrivateEndpointConnection +} + +// PrivateEndpointConnectionsClientListResponse contains the response from method PrivateEndpointConnectionsClient.NewListPager. +type PrivateEndpointConnectionsClientListResponse struct { + // The response of a PrivateEndpointConnection list operation. + PrivateEndpointConnectionListResult +} + +// PrivateLinkResourcesClientGetResponse contains the response from method PrivateLinkResourcesClient.Get. +type PrivateLinkResourcesClientGetResponse struct { + // A private link group resource that describes a grouping for the private link. + PrivateLinkGroupResource +} + +// PrivateLinkResourcesClientListResponse contains the response from method PrivateLinkResourcesClient.NewListPager. +type PrivateLinkResourcesClientListResponse struct { + // The response of a PrivateLinkGroupResource list operation. + PrivateLinkGroupResourceListResult +} + +// PrivateLinksClientCreateResponse contains the response from method PrivateLinksClient.BeginCreate. +type PrivateLinksClientCreateResponse struct { + // A private link resource that enables secure, private connectivity to Microsoft Defender for Cloud services. This resource + // manages the lifecycle of private endpoint connections and provides the necessary infrastructure for private connectivity. + PrivateLinkResource +} + +// PrivateLinksClientDeleteResponse contains the response from method PrivateLinksClient.BeginDelete. +type PrivateLinksClientDeleteResponse struct { + // placeholder for future response values +} + +// PrivateLinksClientGetResponse contains the response from method PrivateLinksClient.Get. +type PrivateLinksClientGetResponse struct { + // A private link resource that enables secure, private connectivity to Microsoft Defender for Cloud services. This resource + // manages the lifecycle of private endpoint connections and provides the necessary infrastructure for private connectivity. + PrivateLinkResource +} + +// PrivateLinksClientHeadResponse contains the response from method PrivateLinksClient.Head. +type PrivateLinksClientHeadResponse struct { + // Success indicates if the operation succeeded or failed. + Success bool +} + +// PrivateLinksClientListBySubscriptionResponse contains the response from method PrivateLinksClient.NewListBySubscriptionPager. +type PrivateLinksClientListBySubscriptionResponse struct { + // Paginated list of private link resources. Contains an array of private links and optional pagination information. + PrivateLinksList +} + +// PrivateLinksClientListResponse contains the response from method PrivateLinksClient.NewListPager. +type PrivateLinksClientListResponse struct { + // Paginated list of private link resources. Contains an array of private links and optional pagination information. + PrivateLinksList +} + +// PrivateLinksClientUpdateResponse contains the response from method PrivateLinksClient.Update. +type PrivateLinksClientUpdateResponse struct { + // A private link resource that enables secure, private connectivity to Microsoft Defender for Cloud services. This resource + // manages the lifecycle of private endpoint connections and provides the necessary infrastructure for private connectivity. + PrivateLinkResource +} + // RegulatoryComplianceAssessmentsClientGetResponse contains the response from method RegulatoryComplianceAssessmentsClient.Get. type RegulatoryComplianceAssessmentsClientGetResponse struct { // Regulatory compliance assessment details and state @@ -1137,7 +1185,7 @@ type SQLVulnerabilityAssessmentBaselineRulesClientGetResponse struct { RuleResults } -// SQLVulnerabilityAssessmentBaselineRulesClientListResponse contains the response from method SQLVulnerabilityAssessmentBaselineRulesClient.List. +// SQLVulnerabilityAssessmentBaselineRulesClientListResponse contains the response from method SQLVulnerabilityAssessmentBaselineRulesClient.NewListPager. type SQLVulnerabilityAssessmentBaselineRulesClientListResponse struct { // A list of rules results. RulesResults @@ -1149,7 +1197,7 @@ type SQLVulnerabilityAssessmentScanResultsClientGetResponse struct { ScanResult } -// SQLVulnerabilityAssessmentScanResultsClientListResponse contains the response from method SQLVulnerabilityAssessmentScanResultsClient.List. +// SQLVulnerabilityAssessmentScanResultsClientListResponse contains the response from method SQLVulnerabilityAssessmentScanResultsClient.NewListPager. type SQLVulnerabilityAssessmentScanResultsClientListResponse struct { // A list of vulnerability assessment scan results. ScanResults @@ -1158,13 +1206,42 @@ type SQLVulnerabilityAssessmentScanResultsClientListResponse struct { // SQLVulnerabilityAssessmentScansClientGetResponse contains the response from method SQLVulnerabilityAssessmentScansClient.Get. type SQLVulnerabilityAssessmentScansClientGetResponse struct { // A vulnerability assessment scan record. - Scan + ScanV2 +} + +// SQLVulnerabilityAssessmentScansClientGetScanOperationResultResponse contains the response from method SQLVulnerabilityAssessmentScansClient.GetScanOperationResult. +type SQLVulnerabilityAssessmentScansClientGetScanOperationResultResponse struct { + // Represents the result of a SQL Vulnerability Assessment scan operation, wrapped in the ARM resource envelope. + SQLVulnerabilityAssessmentScanOperationResult +} + +// SQLVulnerabilityAssessmentScansClientInitiateScanResponse contains the response from method SQLVulnerabilityAssessmentScansClient.BeginInitiateScan. +type SQLVulnerabilityAssessmentScansClientInitiateScanResponse struct { + // Represents the result of a SQL Vulnerability Assessment scan operation, wrapped in the ARM resource envelope. + SQLVulnerabilityAssessmentScanOperationResult } -// SQLVulnerabilityAssessmentScansClientListResponse contains the response from method SQLVulnerabilityAssessmentScansClient.List. +// SQLVulnerabilityAssessmentScansClientListResponse contains the response from method SQLVulnerabilityAssessmentScansClient.NewListPager. type SQLVulnerabilityAssessmentScansClientListResponse struct { // A list of vulnerability assessment scan records. - Scans + ScansV2 +} + +// SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateResponse contains the response from method SQLVulnerabilityAssessmentSettingsClient.CreateOrUpdate. +type SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateResponse struct { + // SQL Vulnerability Assessment settings resource. + SQLVulnerabilityAssessmentSettings +} + +// SQLVulnerabilityAssessmentSettingsClientDeleteResponse contains the response from method SQLVulnerabilityAssessmentSettingsClient.Delete. +type SQLVulnerabilityAssessmentSettingsClientDeleteResponse struct { + // placeholder for future response values +} + +// SQLVulnerabilityAssessmentSettingsClientGetResponse contains the response from method SQLVulnerabilityAssessmentSettingsClient.Get. +type SQLVulnerabilityAssessmentSettingsClientGetResponse struct { + // SQL Vulnerability Assessment settings resource. + SQLVulnerabilityAssessmentSettings } // SecureScoreControlDefinitionsClientListBySubscriptionResponse contains the response from method SecureScoreControlDefinitionsClient.NewListBySubscriptionPager. @@ -1250,16 +1327,6 @@ type ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse struct { ServerVulnerabilityAssessmentsSettingClassification } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse. -func (s *ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse) UnmarshalJSON(data []byte) error { - res, err := unmarshalServerVulnerabilityAssessmentsSettingClassification(data) - if err != nil { - return err - } - s.ServerVulnerabilityAssessmentsSettingClassification = res - return nil -} - // ServerVulnerabilityAssessmentsSettingsClientDeleteResponse contains the response from method ServerVulnerabilityAssessmentsSettingsClient.Delete. type ServerVulnerabilityAssessmentsSettingsClientDeleteResponse struct { // placeholder for future response values @@ -1271,16 +1338,6 @@ type ServerVulnerabilityAssessmentsSettingsClientGetResponse struct { ServerVulnerabilityAssessmentsSettingClassification } -// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessmentsSettingsClientGetResponse. -func (s *ServerVulnerabilityAssessmentsSettingsClientGetResponse) UnmarshalJSON(data []byte) error { - res, err := unmarshalServerVulnerabilityAssessmentsSettingClassification(data) - if err != nil { - return err - } - s.ServerVulnerabilityAssessmentsSettingClassification = res - return nil -} - // ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionResponse contains the response from method ServerVulnerabilityAssessmentsSettingsClient.NewListBySubscriptionPager. type ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionResponse struct { // A page of a server vulnerability assessments settings list @@ -1293,16 +1350,6 @@ type SettingsClientGetResponse struct { SettingClassification } -// UnmarshalJSON implements the json.Unmarshaller interface for type SettingsClientGetResponse. -func (s *SettingsClientGetResponse) UnmarshalJSON(data []byte) error { - res, err := unmarshalSettingClassification(data) - if err != nil { - return err - } - s.SettingClassification = res - return nil -} - // SettingsClientListResponse contains the response from method SettingsClient.NewListPager. type SettingsClientListResponse struct { // Subscription settings list. @@ -1315,36 +1362,9 @@ type SettingsClientUpdateResponse struct { SettingClassification } -// UnmarshalJSON implements the json.Unmarshaller interface for type SettingsClientUpdateResponse. -func (s *SettingsClientUpdateResponse) UnmarshalJSON(data []byte) error { - res, err := unmarshalSettingClassification(data) - if err != nil { - return err - } - s.SettingClassification = res - return nil -} - -// SoftwareInventoriesClientGetResponse contains the response from method SoftwareInventoriesClient.Get. -type SoftwareInventoriesClientGetResponse struct { - // Represents a software data - Software -} - -// SoftwareInventoriesClientListByExtendedResourceResponse contains the response from method SoftwareInventoriesClient.NewListByExtendedResourcePager. -type SoftwareInventoriesClientListByExtendedResourceResponse struct { - // Represents the software inventory of the virtual machine. - SoftwaresList -} - -// SoftwareInventoriesClientListBySubscriptionResponse contains the response from method SoftwareInventoriesClient.NewListBySubscriptionPager. -type SoftwareInventoriesClientListBySubscriptionResponse struct { - // Represents the software inventory of the virtual machine. - SoftwaresList -} - // SolutionsClientGetResponse contains the response from method SolutionsClient.Get. type SolutionsClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. Solution } @@ -1363,6 +1383,81 @@ type SolutionsReferenceDataClientListResponse struct { SolutionsReferenceDataList } +// StandardAssignmentsClientCreateResponse contains the response from method StandardAssignmentsClient.Create. +type StandardAssignmentsClientCreateResponse struct { + // Security Assignment on a resource group over a given scope + StandardAssignment +} + +// StandardAssignmentsClientDeleteResponse contains the response from method StandardAssignmentsClient.Delete. +type StandardAssignmentsClientDeleteResponse struct { + // placeholder for future response values +} + +// StandardAssignmentsClientGetResponse contains the response from method StandardAssignmentsClient.Get. +type StandardAssignmentsClientGetResponse struct { + // Security Assignment on a resource group over a given scope + StandardAssignment +} + +// StandardAssignmentsClientListResponse contains the response from method StandardAssignmentsClient.NewListPager. +type StandardAssignmentsClientListResponse struct { + // Page of a standard assignment list + StandardAssignmentsList +} + +// StandardsClientCreateOrUpdateResponse contains the response from method StandardsClient.CreateOrUpdate. +type StandardsClientCreateOrUpdateResponse struct { + // Security Standard on a resource + ArmSecurityStandard +} + +// StandardsClientCreateOrUpdateResponse contains the response from method StandardsClient.CreateOrUpdate. +type StandardsClientCreateOrUpdateResponse struct { + // Security Standard on a resource + Standard +} + +// StandardsClientDeleteResponse contains the response from method StandardsClient.Delete. +type StandardsClientDeleteResponse struct { + // placeholder for future response values +} + +// StandardsClientDeleteResponse contains the response from method StandardsClient.Delete. +type StandardsClientDeleteResponse struct { + // placeholder for future response values +} + +// StandardsClientGetResponse contains the response from method StandardsClient.Get. +type StandardsClientGetResponse struct { + // Security Standard on a resource + ArmSecurityStandard +} + +// StandardsClientGetResponse contains the response from method StandardsClient.Get. +type StandardsClientGetResponse struct { + // Security Standard on a resource + Standard +} + +// StandardsClientListBySubscriptionResponse contains the response from method StandardsClient.NewListBySubscriptionPager. +type StandardsClientListBySubscriptionResponse struct { + // Page of a Standard list + StandardList +} + +// StandardsClientListResponse contains the response from method StandardsClient.NewListPager. +type StandardsClientListResponse struct { + // Page of a Standard list + StandardList +} + +// StandardsClientListResponse contains the response from method StandardsClient.NewListPager. +type StandardsClientListResponse struct { + // Page of a Standard list + StandardList +} + // SubAssessmentsClientGetResponse contains the response from method SubAssessmentsClient.Get. type SubAssessmentsClientGetResponse struct { // Security sub-assessment on a resource @@ -1423,6 +1518,7 @@ type TasksClientUpdateSubscriptionLevelTaskStateResponse struct { // TopologyClientGetResponse contains the response from method TopologyClient.Get. type TopologyClientGetResponse struct { + // Concrete proxy resource types can be created by aliasing this type using a specific property type. TopologyResource } diff --git a/sdk/resourcemanager/security/armsecurity/responses_serde.go b/sdk/resourcemanager/security/armsecurity/responses_serde.go new file mode 100644 index 000000000000..9bb488865b7f --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/responses_serde.go @@ -0,0 +1,55 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package armsecurity + +// UnmarshalJSON implements the json.Unmarshaller interface for type ExternalSecuritySolutionsClientGetResponse. +func (e *ExternalSecuritySolutionsClientGetResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalExternalSecuritySolutionClassification(data) + if err != nil { + return err + } + e.ExternalSecuritySolutionClassification = res + return nil +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse. +func (s *ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalServerVulnerabilityAssessmentsSettingClassification(data) + if err != nil { + return err + } + s.ServerVulnerabilityAssessmentsSettingClassification = res + return nil +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ServerVulnerabilityAssessmentsSettingsClientGetResponse. +func (s *ServerVulnerabilityAssessmentsSettingsClientGetResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalServerVulnerabilityAssessmentsSettingClassification(data) + if err != nil { + return err + } + s.ServerVulnerabilityAssessmentsSettingClassification = res + return nil +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SettingsClientGetResponse. +func (s *SettingsClientGetResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalSettingClassification(data) + if err != nil { + return err + } + s.SettingClassification = res + return nil +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SettingsClientUpdateResponse. +func (s *SettingsClientUpdateResponse) UnmarshalJSON(data []byte) error { + res, err := unmarshalSettingClassification(data) + if err != nil { + return err + } + s.SettingClassification = res + return nil +} diff --git a/sdk/resourcemanager/security/armsecurity/securescorecontroldefinitions_client.go b/sdk/resourcemanager/security/armsecurity/securescorecontroldefinitions_client.go index 0c24dfed48fa..852ee71986e6 100644 --- a/sdk/resourcemanager/security/armsecurity/securescorecontroldefinitions_client.go +++ b/sdk/resourcemanager/security/armsecurity/securescorecontroldefinitions_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type SecureScoreControlDefinitionsClient struct { } // NewSecureScoreControlDefinitionsClient creates a new instance of SecureScoreControlDefinitionsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewSecureScoreControlDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecureScoreControlDefinitionsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -69,7 +68,7 @@ func (client *SecureScoreControlDefinitionsClient) NewListPager(options *SecureS } // listCreateRequest creates the List request. -func (client *SecureScoreControlDefinitionsClient) listCreateRequest(ctx context.Context, options *SecureScoreControlDefinitionsClientListOptions) (*policy.Request, error) { +func (client *SecureScoreControlDefinitionsClient) listCreateRequest(ctx context.Context, _ *SecureScoreControlDefinitionsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Security/secureScoreControlDefinitions" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -121,7 +120,7 @@ func (client *SecureScoreControlDefinitionsClient) NewListBySubscriptionPager(op } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *SecureScoreControlDefinitionsClient) listBySubscriptionCreateRequest(ctx context.Context, options *SecureScoreControlDefinitionsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *SecureScoreControlDefinitionsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *SecureScoreControlDefinitionsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScoreControlDefinitions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/securescorecontrols_client.go b/sdk/resourcemanager/security/armsecurity/securescorecontrols_client.go index 1b4b6aa2e4af..09e52eb0909d 100644 --- a/sdk/resourcemanager/security/armsecurity/securescorecontrols_client.go +++ b/sdk/resourcemanager/security/armsecurity/securescorecontrols_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type SecureScoreControlsClient struct { } // NewSecureScoreControlsClient creates a new instance of SecureScoreControlsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewSecureScoreControlsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecureScoreControlsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { diff --git a/sdk/resourcemanager/security/armsecurity/securescores_client.go b/sdk/resourcemanager/security/armsecurity/securescores_client.go index 58292c0c28e7..459c0812299b 100644 --- a/sdk/resourcemanager/security/armsecurity/securescores_client.go +++ b/sdk/resourcemanager/security/armsecurity/securescores_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type SecureScoresClient struct { } // NewSecureScoresClient creates a new instance of SecureScoresClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewSecureScoresClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SecureScoresClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -70,7 +69,7 @@ func (client *SecureScoresClient) Get(ctx context.Context, secureScoreName strin } // getCreateRequest creates the Get request. -func (client *SecureScoresClient) getCreateRequest(ctx context.Context, secureScoreName string, options *SecureScoresClientGetOptions) (*policy.Request, error) { +func (client *SecureScoresClient) getCreateRequest(ctx context.Context, secureScoreName string, _ *SecureScoresClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores/{secureScoreName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -128,7 +127,7 @@ func (client *SecureScoresClient) NewListPager(options *SecureScoresClientListOp } // listCreateRequest creates the List request. -func (client *SecureScoresClient) listCreateRequest(ctx context.Context, options *SecureScoresClientListOptions) (*policy.Request, error) { +func (client *SecureScoresClient) listCreateRequest(ctx context.Context, _ *SecureScoresClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/secureScores" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/sensitivitysettings_client.go b/sdk/resourcemanager/security/armsecurity/sensitivitysettings_client.go index 5fc738cc34b3..a0cd15ee9215 100644 --- a/sdk/resourcemanager/security/armsecurity/sensitivitysettings_client.go +++ b/sdk/resourcemanager/security/armsecurity/sensitivitysettings_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -22,7 +21,7 @@ type SensitivitySettingsClient struct { // NewSensitivitySettingsClient creates a new instance of SensitivitySettingsClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewSensitivitySettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SensitivitySettingsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -64,7 +63,7 @@ func (client *SensitivitySettingsClient) CreateOrUpdate(ctx context.Context, sen } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *SensitivitySettingsClient) createOrUpdateCreateRequest(ctx context.Context, sensitivitySettings UpdateSensitivitySettingsRequest, options *SensitivitySettingsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *SensitivitySettingsClient) createOrUpdateCreateRequest(ctx context.Context, sensitivitySettings UpdateSensitivitySettingsRequest, _ *SensitivitySettingsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Security/sensitivitySettings/current" req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -74,6 +73,7 @@ func (client *SensitivitySettingsClient) createOrUpdateCreateRequest(ctx context reqQP.Set("api-version", "2023-02-15-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, sensitivitySettings); err != nil { return nil, err } @@ -117,7 +117,7 @@ func (client *SensitivitySettingsClient) Get(ctx context.Context, options *Sensi } // getCreateRequest creates the Get request. -func (client *SensitivitySettingsClient) getCreateRequest(ctx context.Context, options *SensitivitySettingsClientGetOptions) (*policy.Request, error) { +func (client *SensitivitySettingsClient) getCreateRequest(ctx context.Context, _ *SensitivitySettingsClientGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Security/sensitivitySettings/current" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { @@ -168,7 +168,7 @@ func (client *SensitivitySettingsClient) List(ctx context.Context, options *Sens } // listCreateRequest creates the List request. -func (client *SensitivitySettingsClient) listCreateRequest(ctx context.Context, options *SensitivitySettingsClientListOptions) (*policy.Request, error) { +func (client *SensitivitySettingsClient) listCreateRequest(ctx context.Context, _ *SensitivitySettingsClientListOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Security/sensitivitySettings" req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessment_client.go b/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessment_client.go index 3f64c77bd858..4bf5c39581f7 100644 --- a/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessment_client.go +++ b/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessment_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type ServerVulnerabilityAssessmentClient struct { } // NewServerVulnerabilityAssessmentClient creates a new instance of ServerVulnerabilityAssessmentClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewServerVulnerabilityAssessmentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerVulnerabilityAssessmentClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -45,10 +44,10 @@ func NewServerVulnerabilityAssessmentClient(subscriptionID string, credential az // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceNamespace - The parent resource provider namespace. // - resourceType - The type of the resource. -// - resourceName - Name of the resource. +// - resourceName - The name of the resource. // - options - ServerVulnerabilityAssessmentClientCreateOrUpdateOptions contains the optional parameters for the ServerVulnerabilityAssessmentClient.CreateOrUpdate // method. func (client *ServerVulnerabilityAssessmentClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *ServerVulnerabilityAssessmentClientCreateOrUpdateOptions) (ServerVulnerabilityAssessmentClientCreateOrUpdateResponse, error) { @@ -74,7 +73,7 @@ func (client *ServerVulnerabilityAssessmentClient) CreateOrUpdate(ctx context.Co } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ServerVulnerabilityAssessmentClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *ServerVulnerabilityAssessmentClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ServerVulnerabilityAssessmentClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, _ *ServerVulnerabilityAssessmentClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -121,10 +120,10 @@ func (client *ServerVulnerabilityAssessmentClient) createOrUpdateHandleResponse( // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceNamespace - The parent resource provider namespace. // - resourceType - The type of the resource. -// - resourceName - Name of the resource. +// - resourceName - The name of the resource. // - options - ServerVulnerabilityAssessmentClientBeginDeleteOptions contains the optional parameters for the ServerVulnerabilityAssessmentClient.BeginDelete // method. func (client *ServerVulnerabilityAssessmentClient) BeginDelete(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *ServerVulnerabilityAssessmentClientBeginDeleteOptions) (*runtime.Poller[ServerVulnerabilityAssessmentClientDeleteResponse], error) { @@ -134,8 +133,7 @@ func (client *ServerVulnerabilityAssessmentClient) BeginDelete(ctx context.Conte return nil, err } poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[ServerVulnerabilityAssessmentClientDeleteResponse]{ - FinalStateVia: runtime.FinalStateViaLocation, - Tracer: client.internal.Tracer(), + Tracer: client.internal.Tracer(), }) return poller, err } else { @@ -171,7 +169,7 @@ func (client *ServerVulnerabilityAssessmentClient) deleteOperation(ctx context.C } // deleteCreateRequest creates the Delete request. -func (client *ServerVulnerabilityAssessmentClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *ServerVulnerabilityAssessmentClientBeginDeleteOptions) (*policy.Request, error) { +func (client *ServerVulnerabilityAssessmentClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, _ *ServerVulnerabilityAssessmentClientBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -201,7 +199,6 @@ func (client *ServerVulnerabilityAssessmentClient) deleteCreateRequest(ctx conte reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2020-01-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -209,10 +206,10 @@ func (client *ServerVulnerabilityAssessmentClient) deleteCreateRequest(ctx conte // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceNamespace - The parent resource provider namespace. // - resourceType - The type of the resource. -// - resourceName - Name of the resource. +// - resourceName - The name of the resource. // - options - ServerVulnerabilityAssessmentClientGetOptions contains the optional parameters for the ServerVulnerabilityAssessmentClient.Get // method. func (client *ServerVulnerabilityAssessmentClient) Get(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *ServerVulnerabilityAssessmentClientGetOptions) (ServerVulnerabilityAssessmentClientGetResponse, error) { @@ -238,7 +235,7 @@ func (client *ServerVulnerabilityAssessmentClient) Get(ctx context.Context, reso } // getCreateRequest creates the Get request. -func (client *ServerVulnerabilityAssessmentClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *ServerVulnerabilityAssessmentClientGetOptions) (*policy.Request, error) { +func (client *ServerVulnerabilityAssessmentClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, _ *ServerVulnerabilityAssessmentClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments/{serverVulnerabilityAssessment}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -285,10 +282,10 @@ func (client *ServerVulnerabilityAssessmentClient) getHandleResponse(resp *http. // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - resourceNamespace - The parent resource provider namespace. // - resourceType - The type of the resource. -// - resourceName - Name of the resource. +// - resourceName - The name of the resource. // - options - ServerVulnerabilityAssessmentClientListByExtendedResourceOptions contains the optional parameters for the ServerVulnerabilityAssessmentClient.ListByExtendedResource // method. func (client *ServerVulnerabilityAssessmentClient) ListByExtendedResource(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *ServerVulnerabilityAssessmentClientListByExtendedResourceOptions) (ServerVulnerabilityAssessmentClientListByExtendedResourceResponse, error) { @@ -314,7 +311,7 @@ func (client *ServerVulnerabilityAssessmentClient) ListByExtendedResource(ctx co } // listByExtendedResourceCreateRequest creates the ListByExtendedResource request. -func (client *ServerVulnerabilityAssessmentClient) listByExtendedResourceCreateRequest(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *ServerVulnerabilityAssessmentClientListByExtendedResourceOptions) (*policy.Request, error) { +func (client *ServerVulnerabilityAssessmentClient) listByExtendedResourceCreateRequest(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, _ *ServerVulnerabilityAssessmentClientListByExtendedResourceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/serverVulnerabilityAssessments" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessmentssettings_client.go b/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessmentssettings_client.go index 237303967545..6b46329780f6 100644 --- a/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessmentssettings_client.go +++ b/sdk/resourcemanager/security/armsecurity/servervulnerabilityassessmentssettings_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type ServerVulnerabilityAssessmentsSettingsClient struct { } // NewServerVulnerabilityAssessmentsSettingsClient creates a new instance of ServerVulnerabilityAssessmentsSettingsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewServerVulnerabilityAssessmentsSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*ServerVulnerabilityAssessmentsSettingsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -71,7 +70,7 @@ func (client *ServerVulnerabilityAssessmentsSettingsClient) CreateOrUpdate(ctx c } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *ServerVulnerabilityAssessmentsSettingsClient) createOrUpdateCreateRequest(ctx context.Context, settingKind ServerVulnerabilityAssessmentsSettingKindName, serverVulnerabilityAssessmentsSetting ServerVulnerabilityAssessmentsSettingClassification, options *ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *ServerVulnerabilityAssessmentsSettingsClient) createOrUpdateCreateRequest(ctx context.Context, settingKind ServerVulnerabilityAssessmentsSettingKindName, serverVulnerabilityAssessmentsSetting ServerVulnerabilityAssessmentsSettingClassification, _ *ServerVulnerabilityAssessmentsSettingsClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/{settingKind}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -89,6 +88,7 @@ func (client *ServerVulnerabilityAssessmentsSettingsClient) createOrUpdateCreate reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, serverVulnerabilityAssessmentsSetting); err != nil { return nil, err } @@ -133,7 +133,7 @@ func (client *ServerVulnerabilityAssessmentsSettingsClient) Delete(ctx context.C } // deleteCreateRequest creates the Delete request. -func (client *ServerVulnerabilityAssessmentsSettingsClient) deleteCreateRequest(ctx context.Context, settingKind ServerVulnerabilityAssessmentsSettingKindName, options *ServerVulnerabilityAssessmentsSettingsClientDeleteOptions) (*policy.Request, error) { +func (client *ServerVulnerabilityAssessmentsSettingsClient) deleteCreateRequest(ctx context.Context, settingKind ServerVulnerabilityAssessmentsSettingKindName, _ *ServerVulnerabilityAssessmentsSettingsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/{settingKind}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -150,7 +150,6 @@ func (client *ServerVulnerabilityAssessmentsSettingsClient) deleteCreateRequest( reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2023-05-01") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -184,7 +183,7 @@ func (client *ServerVulnerabilityAssessmentsSettingsClient) Get(ctx context.Cont } // getCreateRequest creates the Get request. -func (client *ServerVulnerabilityAssessmentsSettingsClient) getCreateRequest(ctx context.Context, settingKind ServerVulnerabilityAssessmentsSettingKindName, options *ServerVulnerabilityAssessmentsSettingsClientGetOptions) (*policy.Request, error) { +func (client *ServerVulnerabilityAssessmentsSettingsClient) getCreateRequest(ctx context.Context, settingKind ServerVulnerabilityAssessmentsSettingKindName, _ *ServerVulnerabilityAssessmentsSettingsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings/{settingKind}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -244,7 +243,7 @@ func (client *ServerVulnerabilityAssessmentsSettingsClient) NewListBySubscriptio } // listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *ServerVulnerabilityAssessmentsSettingsClient) listBySubscriptionCreateRequest(ctx context.Context, options *ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionOptions) (*policy.Request, error) { +func (client *ServerVulnerabilityAssessmentsSettingsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *ServerVulnerabilityAssessmentsSettingsClientListBySubscriptionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/serverVulnerabilityAssessmentsSettings" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/settings_client.go b/sdk/resourcemanager/security/armsecurity/settings_client.go index b247ab42119e..010a0f35c676 100644 --- a/sdk/resourcemanager/security/armsecurity/settings_client.go +++ b/sdk/resourcemanager/security/armsecurity/settings_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type SettingsClient struct { } // NewSettingsClient creates a new instance of SettingsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SettingsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -46,7 +45,7 @@ func NewSettingsClient(subscriptionID string, credential azcore.TokenCredential, // 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 SettingNameAutoGenerated, options *SettingsClientGetOptions) (SettingsClientGetResponse, error) { +func (client *SettingsClient) Get(ctx context.Context, settingName SettingName, options *SettingsClientGetOptions) (SettingsClientGetResponse, error) { var err error const operationName = "SettingsClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) @@ -69,7 +68,7 @@ func (client *SettingsClient) Get(ctx context.Context, settingName SettingNameAu } // getCreateRequest creates the Get request. -func (client *SettingsClient) getCreateRequest(ctx context.Context, settingName SettingNameAutoGenerated, options *SettingsClientGetOptions) (*policy.Request, error) { +func (client *SettingsClient) getCreateRequest(ctx context.Context, settingName SettingName, _ *SettingsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -127,7 +126,7 @@ func (client *SettingsClient) NewListPager(options *SettingsClientListOptions) * } // listCreateRequest creates the List request. -func (client *SettingsClient) listCreateRequest(ctx context.Context, options *SettingsClientListOptions) (*policy.Request, error) { +func (client *SettingsClient) listCreateRequest(ctx context.Context, _ *SettingsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -160,7 +159,7 @@ func (client *SettingsClient) listHandleResponse(resp *http.Response) (SettingsC // - settingName - The name of the setting // - setting - Setting object // - options - SettingsClientUpdateOptions contains the optional parameters for the SettingsClient.Update method. -func (client *SettingsClient) Update(ctx context.Context, settingName SettingNameAutoGenerated, setting SettingClassification, options *SettingsClientUpdateOptions) (SettingsClientUpdateResponse, error) { +func (client *SettingsClient) Update(ctx context.Context, settingName SettingName, setting SettingClassification, options *SettingsClientUpdateOptions) (SettingsClientUpdateResponse, error) { var err error const operationName = "SettingsClient.Update" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) @@ -183,7 +182,7 @@ func (client *SettingsClient) Update(ctx context.Context, settingName SettingNam } // updateCreateRequest creates the Update request. -func (client *SettingsClient) updateCreateRequest(ctx context.Context, settingName SettingNameAutoGenerated, setting SettingClassification, options *SettingsClientUpdateOptions) (*policy.Request, error) { +func (client *SettingsClient) updateCreateRequest(ctx context.Context, settingName SettingName, setting SettingClassification, _ *SettingsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/settings/{settingName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -201,6 +200,7 @@ func (client *SettingsClient) updateCreateRequest(ctx context.Context, settingNa reqQP.Set("api-version", "2022-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, setting); err != nil { return nil, err } diff --git a/sdk/resourcemanager/security/armsecurity/softwareinventories_client.go b/sdk/resourcemanager/security/armsecurity/softwareinventories_client.go deleted file mode 100644 index 22b34c5d2f04..000000000000 --- a/sdk/resourcemanager/security/armsecurity/softwareinventories_client.go +++ /dev/null @@ -1,250 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurity - -import ( - "context" - "errors" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" - "net/http" - "net/url" - "strings" -) - -// SoftwareInventoriesClient contains the methods for the SoftwareInventories group. -// Don't use this type directly, use NewSoftwareInventoriesClient() instead. -type SoftwareInventoriesClient struct { - internal *arm.Client - subscriptionID string -} - -// NewSoftwareInventoriesClient creates a new instance of SoftwareInventoriesClient 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 NewSoftwareInventoriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SoftwareInventoriesClient, error) { - cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) - if err != nil { - return nil, err - } - client := &SoftwareInventoriesClient{ - subscriptionID: subscriptionID, - internal: cl, - } - return client, nil -} - -// Get - Gets a single software data 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. -// - resourceType - The type of the resource. -// - resourceName - Name of the resource. -// - softwareName - Name of the installed software. -// - options - SoftwareInventoriesClientGetOptions contains the optional parameters for the SoftwareInventoriesClient.Get method. -func (client *SoftwareInventoriesClient) Get(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, softwareName string, options *SoftwareInventoriesClientGetOptions) (SoftwareInventoriesClientGetResponse, error) { - var err error - const operationName = "SoftwareInventoriesClient.Get" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName, softwareName, options) - if err != nil { - return SoftwareInventoriesClientGetResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SoftwareInventoriesClientGetResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SoftwareInventoriesClientGetResponse{}, err - } - resp, err := client.getHandleResponse(httpResp) - return resp, err -} - -// getCreateRequest creates the Get request. -func (client *SoftwareInventoriesClient) getCreateRequest(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, softwareName string, options *SoftwareInventoriesClientGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories/{softwareName}" - 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 resourceNamespace == "" { - return nil, errors.New("parameter resourceNamespace cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceNamespace}", url.PathEscape(resourceNamespace)) - if resourceType == "" { - return nil, errors.New("parameter resourceType cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceType}", url.PathEscape(resourceType)) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - if softwareName == "" { - return nil, errors.New("parameter softwareName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{softwareName}", url.PathEscape(softwareName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-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 *SoftwareInventoriesClient) getHandleResponse(resp *http.Response) (SoftwareInventoriesClientGetResponse, error) { - result := SoftwareInventoriesClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Software); err != nil { - return SoftwareInventoriesClientGetResponse{}, err - } - return result, nil -} - -// NewListByExtendedResourcePager - Gets the software inventory of the virtual machine. -// -// 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. -// - resourceType - The type of the resource. -// - resourceName - Name of the resource. -// - options - SoftwareInventoriesClientListByExtendedResourceOptions contains the optional parameters for the SoftwareInventoriesClient.NewListByExtendedResourcePager -// method. -func (client *SoftwareInventoriesClient) NewListByExtendedResourcePager(resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *SoftwareInventoriesClientListByExtendedResourceOptions) *runtime.Pager[SoftwareInventoriesClientListByExtendedResourceResponse] { - return runtime.NewPager(runtime.PagingHandler[SoftwareInventoriesClientListByExtendedResourceResponse]{ - More: func(page SoftwareInventoriesClientListByExtendedResourceResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *SoftwareInventoriesClientListByExtendedResourceResponse) (SoftwareInventoriesClientListByExtendedResourceResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SoftwareInventoriesClient.NewListByExtendedResourcePager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listByExtendedResourceCreateRequest(ctx, resourceGroupName, resourceNamespace, resourceType, resourceName, options) - }, nil) - if err != nil { - return SoftwareInventoriesClientListByExtendedResourceResponse{}, err - } - return client.listByExtendedResourceHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listByExtendedResourceCreateRequest creates the ListByExtendedResource request. -func (client *SoftwareInventoriesClient) listByExtendedResourceCreateRequest(ctx context.Context, resourceGroupName string, resourceNamespace string, resourceType string, resourceName string, options *SoftwareInventoriesClientListByExtendedResourceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceNamespace}/{resourceType}/{resourceName}/providers/Microsoft.Security/softwareInventories" - 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 resourceNamespace == "" { - return nil, errors.New("parameter resourceNamespace cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceNamespace}", url.PathEscape(resourceNamespace)) - if resourceType == "" { - return nil, errors.New("parameter resourceType cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceType}", url.PathEscape(resourceType)) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceName}", url.PathEscape(resourceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listByExtendedResourceHandleResponse handles the ListByExtendedResource response. -func (client *SoftwareInventoriesClient) listByExtendedResourceHandleResponse(resp *http.Response) (SoftwareInventoriesClientListByExtendedResourceResponse, error) { - result := SoftwareInventoriesClientListByExtendedResourceResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SoftwaresList); err != nil { - return SoftwareInventoriesClientListByExtendedResourceResponse{}, err - } - return result, nil -} - -// NewListBySubscriptionPager - Gets the software inventory of all virtual machines in the subscriptions. -// -// Generated from API version 2021-05-01-preview -// - options - SoftwareInventoriesClientListBySubscriptionOptions contains the optional parameters for the SoftwareInventoriesClient.NewListBySubscriptionPager -// method. -func (client *SoftwareInventoriesClient) NewListBySubscriptionPager(options *SoftwareInventoriesClientListBySubscriptionOptions) *runtime.Pager[SoftwareInventoriesClientListBySubscriptionResponse] { - return runtime.NewPager(runtime.PagingHandler[SoftwareInventoriesClientListBySubscriptionResponse]{ - More: func(page SoftwareInventoriesClientListBySubscriptionResponse) bool { - return page.NextLink != nil && len(*page.NextLink) > 0 - }, - Fetcher: func(ctx context.Context, page *SoftwareInventoriesClientListBySubscriptionResponse) (SoftwareInventoriesClientListBySubscriptionResponse, error) { - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SoftwareInventoriesClient.NewListBySubscriptionPager") - nextLink := "" - if page != nil { - nextLink = *page.NextLink - } - resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) - }, nil) - if err != nil { - return SoftwareInventoriesClientListBySubscriptionResponse{}, err - } - return client.listBySubscriptionHandleResponse(resp) - }, - Tracer: client.internal.Tracer(), - }) -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *SoftwareInventoriesClient) listBySubscriptionCreateRequest(ctx context.Context, options *SoftwareInventoriesClientListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/softwareInventories" - 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.internal.Endpoint(), urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-05-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *SoftwareInventoriesClient) listBySubscriptionHandleResponse(resp *http.Response) (SoftwareInventoriesClientListBySubscriptionResponse, error) { - result := SoftwareInventoriesClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.SoftwaresList); err != nil { - return SoftwareInventoriesClientListBySubscriptionResponse{}, err - } - return result, nil -} diff --git a/sdk/resourcemanager/security/armsecurity/solutions_client.go b/sdk/resourcemanager/security/armsecurity/solutions_client.go index da42f950cac5..338826b0aa34 100644 --- a/sdk/resourcemanager/security/armsecurity/solutions_client.go +++ b/sdk/resourcemanager/security/armsecurity/solutions_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -17,7 +16,7 @@ import ( "strings" ) -// SolutionsClient contains the methods for the SecuritySolutions group. +// SolutionsClient contains the methods for the Solutions group. // Don't use this type directly, use NewSolutionsClient() instead. type SolutionsClient struct { internal *arm.Client @@ -25,9 +24,9 @@ type SolutionsClient struct { } // NewSolutionsClient creates a new instance of SolutionsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewSolutionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SolutionsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -44,7 +43,7 @@ func NewSolutionsClient(subscriptionID string, credential azcore.TokenCredential // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // - securitySolutionName - Name of security solution. // - options - SolutionsClientGetOptions contains the optional parameters for the SolutionsClient.Get method. @@ -71,7 +70,7 @@ func (client *SolutionsClient) Get(ctx context.Context, resourceGroupName string } // getCreateRequest creates the Get request. -func (client *SolutionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, securitySolutionName string, options *SolutionsClientGetOptions) (*policy.Request, error) { +func (client *SolutionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, securitySolutionName string, _ *SolutionsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutions/{securitySolutionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -137,7 +136,7 @@ func (client *SolutionsClient) NewListPager(options *SolutionsClientListOptions) } // listCreateRequest creates the List request. -func (client *SolutionsClient) listCreateRequest(ctx context.Context, options *SolutionsClientListOptions) (*policy.Request, error) { +func (client *SolutionsClient) listCreateRequest(ctx context.Context, _ *SolutionsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutions" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/solutionsreferencedata_client.go b/sdk/resourcemanager/security/armsecurity/solutionsreferencedata_client.go index 895dc86f09e0..2f3c1b700a9a 100644 --- a/sdk/resourcemanager/security/armsecurity/solutionsreferencedata_client.go +++ b/sdk/resourcemanager/security/armsecurity/solutionsreferencedata_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -17,7 +16,7 @@ import ( "strings" ) -// SolutionsReferenceDataClient contains the methods for the SecuritySolutionsReferenceData group. +// SolutionsReferenceDataClient contains the methods for the SolutionsReferenceData group. // Don't use this type directly, use NewSolutionsReferenceDataClient() instead. type SolutionsReferenceDataClient struct { internal *arm.Client @@ -25,9 +24,9 @@ type SolutionsReferenceDataClient struct { } // NewSolutionsReferenceDataClient creates a new instance of SolutionsReferenceDataClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewSolutionsReferenceDataClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*SolutionsReferenceDataClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -69,7 +68,7 @@ func (client *SolutionsReferenceDataClient) List(ctx context.Context, options *S } // listCreateRequest creates the List request. -func (client *SolutionsReferenceDataClient) listCreateRequest(ctx context.Context, options *SolutionsReferenceDataClientListOptions) (*policy.Request, error) { +func (client *SolutionsReferenceDataClient) listCreateRequest(ctx context.Context, _ *SolutionsReferenceDataClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securitySolutionsReferenceData" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -125,7 +124,7 @@ func (client *SolutionsReferenceDataClient) ListByHomeRegion(ctx context.Context } // listByHomeRegionCreateRequest creates the ListByHomeRegion request. -func (client *SolutionsReferenceDataClient) listByHomeRegionCreateRequest(ctx context.Context, ascLocation string, options *SolutionsReferenceDataClientListByHomeRegionOptions) (*policy.Request, error) { +func (client *SolutionsReferenceDataClient) listByHomeRegionCreateRequest(ctx context.Context, ascLocation string, _ *SolutionsReferenceDataClientListByHomeRegionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/securitySolutionsReferenceData" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentbaselinerules_client.go b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentbaselinerules_client.go index b5dbb3fd798c..74941bd7f575 100644 --- a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentbaselinerules_client.go +++ b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentbaselinerules_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,7 +24,7 @@ type SQLVulnerabilityAssessmentBaselineRulesClient struct { // NewSQLVulnerabilityAssessmentBaselineRulesClient creates a new instance of SQLVulnerabilityAssessmentBaselineRulesClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewSQLVulnerabilityAssessmentBaselineRulesClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLVulnerabilityAssessmentBaselineRulesClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -37,21 +36,22 @@ func NewSQLVulnerabilityAssessmentBaselineRulesClient(credential azcore.TokenCre return client, nil } -// Add - Add a list of baseline rules. Will overwrite any previously existing results (for all rules). +// Add - Set a list of baseline rules. Will overwrite any previously existing results (for all rules). +// +// Set a list of baseline rules. Will overwrite any previously existing results (for all rules). // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01-preview -// - workspaceID - The workspace Id. -// - resourceID - The identifier of the resource. +// Generated from API version 2026-04-01-preview +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. // - options - SQLVulnerabilityAssessmentBaselineRulesClientAddOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.Add // method. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) Add(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientAddOptions) (SQLVulnerabilityAssessmentBaselineRulesClientAddResponse, error) { +func (client *SQLVulnerabilityAssessmentBaselineRulesClient) Add(ctx context.Context, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientAddOptions) (SQLVulnerabilityAssessmentBaselineRulesClientAddResponse, error) { var err error const operationName = "SQLVulnerabilityAssessmentBaselineRulesClient.Add" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.addCreateRequest(ctx, workspaceID, resourceID, options) + req, err := client.addCreateRequest(ctx, resourceID, options) if err != nil { return SQLVulnerabilityAssessmentBaselineRulesClientAddResponse{}, err } @@ -68,19 +68,25 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) Add(ctx context.Con } // addCreateRequest creates the Add request. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) addCreateRequest(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientAddOptions) (*policy.Request, error) { +func (client *SQLVulnerabilityAssessmentBaselineRulesClient) addCreateRequest(ctx context.Context, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientAddOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01-preview") - reqQP.Set("workspaceId", workspaceID) + reqQP.Set("api-version", "2026-04-01-preview") + if options != nil && options.DatabaseName != nil { + reqQP.Set("databaseName", *options.DatabaseName) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} if options != nil && options.Body != nil { + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { return nil, err } @@ -99,21 +105,23 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) addHandleResponse(r } // CreateOrUpdate - Creates a Baseline for a rule in a database. Will overwrite any previously existing results. +// +// Creates a Baseline for a rule in a database. Will overwrite any previously existing results. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01-preview +// Generated from API version 2026-04-01-preview +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. // - ruleID - The rule Id. -// - workspaceID - The workspace Id. -// - resourceID - The identifier of the resource. +// - body - The baseline results for this rule. // - options - SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.CreateOrUpdate // method. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) CreateOrUpdate(ctx context.Context, ruleID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions) (SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateResponse, error) { +func (client *SQLVulnerabilityAssessmentBaselineRulesClient) CreateOrUpdate(ctx context.Context, resourceID string, ruleID string, body RuleResultsInput, options *SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions) (SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateResponse, error) { var err error const operationName = "SQLVulnerabilityAssessmentBaselineRulesClient.CreateOrUpdate" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.createOrUpdateCreateRequest(ctx, ruleID, workspaceID, resourceID, options) + req, err := client.createOrUpdateCreateRequest(ctx, resourceID, ruleID, body, options) if err != nil { return SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateResponse{}, err } @@ -121,7 +129,7 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) CreateOrUpdate(ctx if err != nil { return SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateResponse{}, err } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { err = runtime.NewResponseError(httpResp) return SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateResponse{}, err } @@ -130,27 +138,30 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) CreateOrUpdate(ctx } // createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) createOrUpdateCreateRequest(ctx context.Context, ruleID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions) (*policy.Request, error) { +func (client *SQLVulnerabilityAssessmentBaselineRulesClient) createOrUpdateCreateRequest(ctx context.Context, resourceID string, ruleID string, body RuleResultsInput, options *SQLVulnerabilityAssessmentBaselineRulesClientCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if ruleID == "" { return nil, errors.New("parameter ruleID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) - urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01-preview") - reqQP.Set("workspaceId", workspaceID) + reqQP.Set("api-version", "2026-04-01-preview") + if options != nil && options.DatabaseName != nil { + reqQP.Set("databaseName", *options.DatabaseName) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} - if options != nil && options.Body != nil { - if err := runtime.MarshalAsJSON(req, *options.Body); err != nil { - return nil, err - } - return req, nil + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err } return req, nil } @@ -165,21 +176,22 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) createOrUpdateHandl } // Delete - Deletes a rule from the Baseline of a given database. +// +// Deletes a rule from the Baseline of a given database. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01-preview +// Generated from API version 2026-04-01-preview +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. // - ruleID - The rule Id. -// - workspaceID - The workspace Id. -// - resourceID - The identifier of the resource. // - options - SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.Delete // method. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) Delete(ctx context.Context, ruleID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions) (SQLVulnerabilityAssessmentBaselineRulesClientDeleteResponse, error) { +func (client *SQLVulnerabilityAssessmentBaselineRulesClient) Delete(ctx context.Context, resourceID string, ruleID string, options *SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions) (SQLVulnerabilityAssessmentBaselineRulesClientDeleteResponse, error) { var err error const operationName = "SQLVulnerabilityAssessmentBaselineRulesClient.Delete" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.deleteCreateRequest(ctx, ruleID, workspaceID, resourceID, options) + req, err := client.deleteCreateRequest(ctx, resourceID, ruleID, options) if err != nil { return SQLVulnerabilityAssessmentBaselineRulesClientDeleteResponse{}, err } @@ -195,41 +207,46 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) Delete(ctx context. } // deleteCreateRequest creates the Delete request. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) deleteCreateRequest(ctx context.Context, ruleID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions) (*policy.Request, error) { +func (client *SQLVulnerabilityAssessmentBaselineRulesClient) deleteCreateRequest(ctx context.Context, resourceID string, ruleID string, options *SQLVulnerabilityAssessmentBaselineRulesClientDeleteOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if ruleID == "" { return nil, errors.New("parameter ruleID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) - urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01-preview") - reqQP.Set("workspaceId", workspaceID) + reqQP.Set("api-version", "2026-04-01-preview") + if options != nil && options.DatabaseName != nil { + reqQP.Set("databaseName", *options.DatabaseName) + } req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } // Get - Gets the results for a given rule in the Baseline. +// +// Gets the results for a given rule in the Baseline. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01-preview +// Generated from API version 2026-04-01-preview +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. // - ruleID - The rule Id. -// - workspaceID - The workspace Id. -// - resourceID - The identifier of the resource. // - options - SQLVulnerabilityAssessmentBaselineRulesClientGetOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.Get // method. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) Get(ctx context.Context, ruleID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientGetOptions) (SQLVulnerabilityAssessmentBaselineRulesClientGetResponse, error) { +func (client *SQLVulnerabilityAssessmentBaselineRulesClient) Get(ctx context.Context, resourceID string, ruleID string, options *SQLVulnerabilityAssessmentBaselineRulesClientGetOptions) (SQLVulnerabilityAssessmentBaselineRulesClientGetResponse, error) { var err error const operationName = "SQLVulnerabilityAssessmentBaselineRulesClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, ruleID, workspaceID, resourceID, options) + req, err := client.getCreateRequest(ctx, resourceID, ruleID, options) if err != nil { return SQLVulnerabilityAssessmentBaselineRulesClientGetResponse{}, err } @@ -246,20 +263,25 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) Get(ctx context.Con } // getCreateRequest creates the Get request. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) getCreateRequest(ctx context.Context, ruleID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientGetOptions) (*policy.Request, error) { +func (client *SQLVulnerabilityAssessmentBaselineRulesClient) getCreateRequest(ctx context.Context, resourceID string, ruleID string, options *SQLVulnerabilityAssessmentBaselineRulesClientGetOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules/{ruleId}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if ruleID == "" { return nil, errors.New("parameter ruleID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) - urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01-preview") - reqQP.Set("workspaceId", workspaceID) + reqQP.Set("api-version", "2026-04-01-preview") + if options != nil && options.DatabaseName != nil { + reqQP.Set("databaseName", *options.DatabaseName) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -274,47 +296,53 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) getHandleResponse(r return result, nil } -// List - Gets the results for all rules in the Baseline. -// If the operation fails it returns an *azcore.ResponseError type. +// NewListPager - Gets the results for all rules in the Baseline. +// +// Gets the results for all rules in the Baseline. // -// Generated from API version 2023-02-01-preview -// - workspaceID - The workspace Id. -// - resourceID - The identifier of the resource. -// - options - SQLVulnerabilityAssessmentBaselineRulesClientListOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.List +// Generated from API version 2026-04-01-preview +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. +// - options - SQLVulnerabilityAssessmentBaselineRulesClientListOptions contains the optional parameters for the SQLVulnerabilityAssessmentBaselineRulesClient.NewListPager // method. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) List(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientListOptions) (SQLVulnerabilityAssessmentBaselineRulesClientListResponse, error) { - var err error - const operationName = "SQLVulnerabilityAssessmentBaselineRulesClient.List" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listCreateRequest(ctx, workspaceID, resourceID, options) - if err != nil { - return SQLVulnerabilityAssessmentBaselineRulesClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SQLVulnerabilityAssessmentBaselineRulesClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SQLVulnerabilityAssessmentBaselineRulesClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err +func (client *SQLVulnerabilityAssessmentBaselineRulesClient) NewListPager(resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientListOptions) *runtime.Pager[SQLVulnerabilityAssessmentBaselineRulesClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLVulnerabilityAssessmentBaselineRulesClientListResponse]{ + More: func(page SQLVulnerabilityAssessmentBaselineRulesClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLVulnerabilityAssessmentBaselineRulesClientListResponse) (SQLVulnerabilityAssessmentBaselineRulesClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SQLVulnerabilityAssessmentBaselineRulesClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceID, options) + }, nil) + if err != nil { + return SQLVulnerabilityAssessmentBaselineRulesClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) } // listCreateRequest creates the List request. -func (client *SQLVulnerabilityAssessmentBaselineRulesClient) listCreateRequest(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientListOptions) (*policy.Request, error) { +func (client *SQLVulnerabilityAssessmentBaselineRulesClient) listCreateRequest(ctx context.Context, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientListOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01-preview") - reqQP.Set("workspaceId", workspaceID) + reqQP.Set("api-version", "2026-04-01-preview") + if options != nil && options.DatabaseName != nil { + reqQP.Set("databaseName", *options.DatabaseName) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscanresults_client.go b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscanresults_client.go index b682fa7e25c3..e256dff8ebf4 100644 --- a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscanresults_client.go +++ b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscanresults_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,7 +24,7 @@ type SQLVulnerabilityAssessmentScanResultsClient struct { // NewSQLVulnerabilityAssessmentScanResultsClient creates a new instance of SQLVulnerabilityAssessmentScanResultsClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewSQLVulnerabilityAssessmentScanResultsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLVulnerabilityAssessmentScanResultsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -38,22 +37,20 @@ func NewSQLVulnerabilityAssessmentScanResultsClient(credential azcore.TokenCrede } // Get - Gets the scan results of a single rule in a scan record. +// +// Gets the scan results of a single rule in a scan record. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01-preview -// - scanID - The scan Id. Type 'latest' to get the scan results for the latest scan. -// - scanResultID - The rule Id of the results. -// - workspaceID - The workspace Id. -// - resourceID - The identifier of the resource. +// Generated from API version 2026-04-01-preview // - options - SQLVulnerabilityAssessmentScanResultsClientGetOptions contains the optional parameters for the SQLVulnerabilityAssessmentScanResultsClient.Get // method. -func (client *SQLVulnerabilityAssessmentScanResultsClient) Get(ctx context.Context, scanID string, scanResultID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentScanResultsClientGetOptions) (SQLVulnerabilityAssessmentScanResultsClientGetResponse, error) { +func (client *SQLVulnerabilityAssessmentScanResultsClient) Get(ctx context.Context, scanID string, scanResultID string, resourceID string, options *SQLVulnerabilityAssessmentScanResultsClientGetOptions) (SQLVulnerabilityAssessmentScanResultsClientGetResponse, error) { var err error const operationName = "SQLVulnerabilityAssessmentScanResultsClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, scanID, scanResultID, workspaceID, resourceID, options) + req, err := client.getCreateRequest(ctx, scanID, scanResultID, resourceID, options) if err != nil { return SQLVulnerabilityAssessmentScanResultsClientGetResponse{}, err } @@ -70,7 +67,7 @@ func (client *SQLVulnerabilityAssessmentScanResultsClient) Get(ctx context.Conte } // getCreateRequest creates the Get request. -func (client *SQLVulnerabilityAssessmentScanResultsClient) getCreateRequest(ctx context.Context, scanID string, scanResultID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentScanResultsClientGetOptions) (*policy.Request, error) { +func (client *SQLVulnerabilityAssessmentScanResultsClient) getCreateRequest(ctx context.Context, scanID string, scanResultID string, resourceID string, options *SQLVulnerabilityAssessmentScanResultsClientGetOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults/{scanResultId}" if scanID == "" { return nil, errors.New("parameter scanID cannot be empty") @@ -80,14 +77,19 @@ func (client *SQLVulnerabilityAssessmentScanResultsClient) getCreateRequest(ctx return nil, errors.New("parameter scanResultID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{scanResultId}", url.PathEscape(scanResultID)) + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01-preview") - reqQP.Set("workspaceId", workspaceID) + reqQP.Set("api-version", "2026-04-01-preview") + if options != nil && options.DatabaseName != nil { + reqQP.Set("databaseName", *options.DatabaseName) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -102,52 +104,56 @@ func (client *SQLVulnerabilityAssessmentScanResultsClient) getHandleResponse(res return result, nil } -// List - Gets a list of scan results for a single scan record. -// If the operation fails it returns an *azcore.ResponseError type. +// NewListPager - Gets a list of scan results for a single scan record. +// +// Gets a list of scan results for a single scan record. // -// Generated from API version 2023-02-01-preview -// - scanID - The scan Id. Type 'latest' to get the scan results for the latest scan. -// - workspaceID - The workspace Id. -// - resourceID - The identifier of the resource. -// - options - SQLVulnerabilityAssessmentScanResultsClientListOptions contains the optional parameters for the SQLVulnerabilityAssessmentScanResultsClient.List +// Generated from API version 2026-04-01-preview +// - options - SQLVulnerabilityAssessmentScanResultsClientListOptions contains the optional parameters for the SQLVulnerabilityAssessmentScanResultsClient.NewListPager // method. -func (client *SQLVulnerabilityAssessmentScanResultsClient) List(ctx context.Context, scanID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentScanResultsClientListOptions) (SQLVulnerabilityAssessmentScanResultsClientListResponse, error) { - var err error - const operationName = "SQLVulnerabilityAssessmentScanResultsClient.List" - ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) - ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) - defer func() { endSpan(err) }() - req, err := client.listCreateRequest(ctx, scanID, workspaceID, resourceID, options) - if err != nil { - return SQLVulnerabilityAssessmentScanResultsClientListResponse{}, err - } - httpResp, err := client.internal.Pipeline().Do(req) - if err != nil { - return SQLVulnerabilityAssessmentScanResultsClientListResponse{}, err - } - if !runtime.HasStatusCode(httpResp, http.StatusOK) { - err = runtime.NewResponseError(httpResp) - return SQLVulnerabilityAssessmentScanResultsClientListResponse{}, err - } - resp, err := client.listHandleResponse(httpResp) - return resp, err +func (client *SQLVulnerabilityAssessmentScanResultsClient) NewListPager(scanID string, resourceID string, options *SQLVulnerabilityAssessmentScanResultsClientListOptions) *runtime.Pager[SQLVulnerabilityAssessmentScanResultsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLVulnerabilityAssessmentScanResultsClientListResponse]{ + More: func(page SQLVulnerabilityAssessmentScanResultsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLVulnerabilityAssessmentScanResultsClientListResponse) (SQLVulnerabilityAssessmentScanResultsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SQLVulnerabilityAssessmentScanResultsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, scanID, resourceID, options) + }, nil) + if err != nil { + return SQLVulnerabilityAssessmentScanResultsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) } // listCreateRequest creates the List request. -func (client *SQLVulnerabilityAssessmentScanResultsClient) listCreateRequest(ctx context.Context, scanID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentScanResultsClientListOptions) (*policy.Request, error) { +func (client *SQLVulnerabilityAssessmentScanResultsClient) listCreateRequest(ctx context.Context, scanID string, resourceID string, options *SQLVulnerabilityAssessmentScanResultsClientListOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}/scanResults" if scanID == "" { return nil, errors.New("parameter scanID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{scanId}", url.PathEscape(scanID)) + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01-preview") - reqQP.Set("workspaceId", workspaceID) + reqQP.Set("api-version", "2026-04-01-preview") + if options != nil && options.DatabaseName != nil { + reqQP.Set("databaseName", *options.DatabaseName) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil diff --git a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscans_client.go b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscans_client.go index f664e4f9ec52..1bcf246b7bfd 100644 --- a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscans_client.go +++ b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentscans_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,7 +24,7 @@ type SQLVulnerabilityAssessmentScansClient struct { // NewSQLVulnerabilityAssessmentScansClient creates a new instance of SQLVulnerabilityAssessmentScansClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewSQLVulnerabilityAssessmentScansClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLVulnerabilityAssessmentScansClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -38,21 +37,20 @@ func NewSQLVulnerabilityAssessmentScansClient(credential azcore.TokenCredential, } // Get - Gets the scan details of a single scan record. +// +// Gets the scan details of a single scan record. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01-preview -// - scanID - The scan Id. Type 'latest' to get the scan record for the latest scan. -// - workspaceID - The workspace Id. -// - resourceID - The identifier of the resource. +// Generated from API version 2026-04-01-preview // - options - SQLVulnerabilityAssessmentScansClientGetOptions contains the optional parameters for the SQLVulnerabilityAssessmentScansClient.Get // method. -func (client *SQLVulnerabilityAssessmentScansClient) Get(ctx context.Context, scanID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentScansClientGetOptions) (SQLVulnerabilityAssessmentScansClientGetResponse, error) { +func (client *SQLVulnerabilityAssessmentScansClient) Get(ctx context.Context, scanID string, resourceID string, options *SQLVulnerabilityAssessmentScansClientGetOptions) (SQLVulnerabilityAssessmentScansClientGetResponse, error) { var err error const operationName = "SQLVulnerabilityAssessmentScansClient.Get" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.getCreateRequest(ctx, scanID, workspaceID, resourceID, options) + req, err := client.getCreateRequest(ctx, scanID, resourceID, options) if err != nil { return SQLVulnerabilityAssessmentScansClientGetResponse{}, err } @@ -69,20 +67,25 @@ func (client *SQLVulnerabilityAssessmentScansClient) Get(ctx context.Context, sc } // getCreateRequest creates the Get request. -func (client *SQLVulnerabilityAssessmentScansClient) getCreateRequest(ctx context.Context, scanID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentScansClientGetOptions) (*policy.Request, error) { +func (client *SQLVulnerabilityAssessmentScansClient) getCreateRequest(ctx context.Context, scanID string, resourceID string, options *SQLVulnerabilityAssessmentScansClientGetOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/{scanId}" if scanID == "" { return nil, errors.New("parameter scanID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{scanId}", url.PathEscape(scanID)) + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01-preview") - reqQP.Set("workspaceId", workspaceID) + reqQP.Set("api-version", "2026-04-01-preview") + if options != nil && options.DatabaseName != nil { + reqQP.Set("databaseName", *options.DatabaseName) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -91,53 +94,196 @@ func (client *SQLVulnerabilityAssessmentScansClient) getCreateRequest(ctx contex // getHandleResponse handles the Get response. func (client *SQLVulnerabilityAssessmentScansClient) getHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentScansClientGetResponse, error) { result := SQLVulnerabilityAssessmentScansClientGetResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Scan); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ScanV2); err != nil { return SQLVulnerabilityAssessmentScansClientGetResponse{}, err } return result, nil } -// List - Gets a list of scan records. +// GetScanOperationResult - Gets the result of a scan operation initiated by the InitiateScan action. +// +// Gets the result of a scan operation initiated by the InitiateScan action. // If the operation fails it returns an *azcore.ResponseError type. // -// Generated from API version 2023-02-01-preview -// - workspaceID - The workspace Id. -// - resourceID - The identifier of the resource. -// - options - SQLVulnerabilityAssessmentScansClientListOptions contains the optional parameters for the SQLVulnerabilityAssessmentScansClient.List +// Generated from API version 2026-04-01-preview +// - options - SQLVulnerabilityAssessmentScansClientGetScanOperationResultOptions contains the optional parameters for the SQLVulnerabilityAssessmentScansClient.GetScanOperationResult // method. -func (client *SQLVulnerabilityAssessmentScansClient) List(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentScansClientListOptions) (SQLVulnerabilityAssessmentScansClientListResponse, error) { +func (client *SQLVulnerabilityAssessmentScansClient) GetScanOperationResult(ctx context.Context, resourceID string, operationID string, options *SQLVulnerabilityAssessmentScansClientGetScanOperationResultOptions) (SQLVulnerabilityAssessmentScansClientGetScanOperationResultResponse, error) { var err error - const operationName = "SQLVulnerabilityAssessmentScansClient.List" + const operationName = "SQLVulnerabilityAssessmentScansClient.GetScanOperationResult" ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) defer func() { endSpan(err) }() - req, err := client.listCreateRequest(ctx, workspaceID, resourceID, options) + req, err := client.getScanOperationResultCreateRequest(ctx, resourceID, operationID, options) if err != nil { - return SQLVulnerabilityAssessmentScansClientListResponse{}, err + return SQLVulnerabilityAssessmentScansClientGetScanOperationResultResponse{}, err } httpResp, err := client.internal.Pipeline().Do(req) if err != nil { - return SQLVulnerabilityAssessmentScansClientListResponse{}, err + return SQLVulnerabilityAssessmentScansClientGetScanOperationResultResponse{}, err } if !runtime.HasStatusCode(httpResp, http.StatusOK) { err = runtime.NewResponseError(httpResp) - return SQLVulnerabilityAssessmentScansClientListResponse{}, err + return SQLVulnerabilityAssessmentScansClientGetScanOperationResultResponse{}, err } - resp, err := client.listHandleResponse(httpResp) + resp, err := client.getScanOperationResultHandleResponse(httpResp) return resp, err } +// getScanOperationResultCreateRequest creates the GetScanOperationResult request. +func (client *SQLVulnerabilityAssessmentScansClient) getScanOperationResultCreateRequest(ctx context.Context, resourceID string, operationID string, options *SQLVulnerabilityAssessmentScansClientGetScanOperationResultOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/scanOperationResults/{operationId}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-04-01-preview") + if options != nil && options.DatabaseName != nil { + reqQP.Set("databaseName", *options.DatabaseName) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getScanOperationResultHandleResponse handles the GetScanOperationResult response. +func (client *SQLVulnerabilityAssessmentScansClient) getScanOperationResultHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentScansClientGetScanOperationResultResponse, error) { + result := SQLVulnerabilityAssessmentScansClientGetScanOperationResultResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLVulnerabilityAssessmentScanOperationResult); err != nil { + return SQLVulnerabilityAssessmentScansClientGetScanOperationResultResponse{}, err + } + return result, nil +} + +// BeginInitiateScan - Initiates a vulnerability assessment scan. +// +// Initiates a vulnerability assessment scan. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-04-01-preview +// - options - SQLVulnerabilityAssessmentScansClientBeginInitiateScanOptions contains the optional parameters for the SQLVulnerabilityAssessmentScansClient.BeginInitiateScan +// method. +func (client *SQLVulnerabilityAssessmentScansClient) BeginInitiateScan(ctx context.Context, resourceID string, options *SQLVulnerabilityAssessmentScansClientBeginInitiateScanOptions) (*runtime.Poller[SQLVulnerabilityAssessmentScansClientInitiateScanResponse], error) { + if options == nil || options.ResumeToken == "" { + resp, err := client.initiateScan(ctx, resourceID, options) + if err != nil { + return nil, err + } + poller, err := runtime.NewPoller(resp, client.internal.Pipeline(), &runtime.NewPollerOptions[SQLVulnerabilityAssessmentScansClientInitiateScanResponse]{ + Tracer: client.internal.Tracer(), + }) + return poller, err + } else { + return runtime.NewPollerFromResumeToken(options.ResumeToken, client.internal.Pipeline(), &runtime.NewPollerFromResumeTokenOptions[SQLVulnerabilityAssessmentScansClientInitiateScanResponse]{ + Tracer: client.internal.Tracer(), + }) + } +} + +// InitiateScan - Initiates a vulnerability assessment scan. +// +// Initiates a vulnerability assessment scan. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-04-01-preview +func (client *SQLVulnerabilityAssessmentScansClient) initiateScan(ctx context.Context, resourceID string, options *SQLVulnerabilityAssessmentScansClientBeginInitiateScanOptions) (*http.Response, error) { + var err error + const operationName = "SQLVulnerabilityAssessmentScansClient.BeginInitiateScan" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.initiateScanCreateRequest(ctx, resourceID, options) + if err != nil { + return nil, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusAccepted) { + err = runtime.NewResponseError(httpResp) + return nil, err + } + return httpResp, nil +} + +// initiateScanCreateRequest creates the InitiateScan request. +func (client *SQLVulnerabilityAssessmentScansClient) initiateScanCreateRequest(ctx context.Context, resourceID string, options *SQLVulnerabilityAssessmentScansClientBeginInitiateScanOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans/initiateScan" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-04-01-preview") + if options != nil && options.DatabaseName != nil { + reqQP.Set("databaseName", *options.DatabaseName) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// NewListPager - Gets a list of scan records. +// +// Gets a list of scan records. +// +// Generated from API version 2026-04-01-preview +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. +// - options - SQLVulnerabilityAssessmentScansClientListOptions contains the optional parameters for the SQLVulnerabilityAssessmentScansClient.NewListPager +// method. +func (client *SQLVulnerabilityAssessmentScansClient) NewListPager(resourceID string, options *SQLVulnerabilityAssessmentScansClientListOptions) *runtime.Pager[SQLVulnerabilityAssessmentScansClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[SQLVulnerabilityAssessmentScansClientListResponse]{ + More: func(page SQLVulnerabilityAssessmentScansClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *SQLVulnerabilityAssessmentScansClientListResponse) (SQLVulnerabilityAssessmentScansClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "SQLVulnerabilityAssessmentScansClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceID, options) + }, nil) + if err != nil { + return SQLVulnerabilityAssessmentScansClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + // listCreateRequest creates the List request. -func (client *SQLVulnerabilityAssessmentScansClient) listCreateRequest(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentScansClientListOptions) (*policy.Request, error) { +func (client *SQLVulnerabilityAssessmentScansClient) listCreateRequest(ctx context.Context, resourceID string, options *SQLVulnerabilityAssessmentScansClientListOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2023-02-01-preview") - reqQP.Set("workspaceId", workspaceID) + reqQP.Set("api-version", "2026-04-01-preview") + if options != nil && options.DatabaseName != nil { + reqQP.Set("databaseName", *options.DatabaseName) + } req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} return req, nil @@ -146,7 +292,7 @@ func (client *SQLVulnerabilityAssessmentScansClient) listCreateRequest(ctx conte // listHandleResponse handles the List response. func (client *SQLVulnerabilityAssessmentScansClient) listHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentScansClientListResponse, error) { result := SQLVulnerabilityAssessmentScansClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.Scans); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ScansV2); err != nil { return SQLVulnerabilityAssessmentScansClientListResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentsettings_client.go b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentsettings_client.go new file mode 100644 index 000000000000..9a34f9c496dc --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/sqlvulnerabilityassessmentsettings_client.go @@ -0,0 +1,204 @@ +// 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) Go Code Generator. 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" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" +) + +// SQLVulnerabilityAssessmentSettingsClient contains the methods for the SQLVulnerabilityAssessmentSettings group. +// Don't use this type directly, use NewSQLVulnerabilityAssessmentSettingsClient() instead. +type SQLVulnerabilityAssessmentSettingsClient struct { + internal *arm.Client +} + +// NewSQLVulnerabilityAssessmentSettingsClient creates a new instance of SQLVulnerabilityAssessmentSettingsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewSQLVulnerabilityAssessmentSettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SQLVulnerabilityAssessmentSettingsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &SQLVulnerabilityAssessmentSettingsClient{ + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates the SQL Vulnerability Assessment settings. +// +// Creates or updates the SQL Vulnerability Assessment settings. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-04-01-preview +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. +// - body - The SQL Vulnerability Assessment settings. +// - options - SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateOptions contains the optional parameters for the SQLVulnerabilityAssessmentSettingsClient.CreateOrUpdate +// method. +func (client *SQLVulnerabilityAssessmentSettingsClient) CreateOrUpdate(ctx context.Context, resourceID string, body SQLVulnerabilityAssessmentSettings, options *SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateOptions) (SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "SQLVulnerabilityAssessmentSettingsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceID, body, options) + if err != nil { + return SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SQLVulnerabilityAssessmentSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceID string, body SQLVulnerabilityAssessmentSettings, _ *SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, body); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *SQLVulnerabilityAssessmentSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateResponse, error) { + result := SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLVulnerabilityAssessmentSettings); err != nil { + return SQLVulnerabilityAssessmentSettingsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Deletes the SQL Vulnerability Assessment settings. +// +// Deletes the SQL Vulnerability Assessment settings. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-04-01-preview +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. +// - options - SQLVulnerabilityAssessmentSettingsClientDeleteOptions contains the optional parameters for the SQLVulnerabilityAssessmentSettingsClient.Delete +// method. +func (client *SQLVulnerabilityAssessmentSettingsClient) Delete(ctx context.Context, resourceID string, options *SQLVulnerabilityAssessmentSettingsClientDeleteOptions) (SQLVulnerabilityAssessmentSettingsClientDeleteResponse, error) { + var err error + const operationName = "SQLVulnerabilityAssessmentSettingsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceID, options) + if err != nil { + return SQLVulnerabilityAssessmentSettingsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLVulnerabilityAssessmentSettingsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return SQLVulnerabilityAssessmentSettingsClientDeleteResponse{}, err + } + return SQLVulnerabilityAssessmentSettingsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SQLVulnerabilityAssessmentSettingsClient) deleteCreateRequest(ctx context.Context, resourceID string, _ *SQLVulnerabilityAssessmentSettingsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-04-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Gets the SQL Vulnerability Assessment settings. +// +// Gets the SQL Vulnerability Assessment settings. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2026-04-01-preview +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. +// - options - SQLVulnerabilityAssessmentSettingsClientGetOptions contains the optional parameters for the SQLVulnerabilityAssessmentSettingsClient.Get +// method. +func (client *SQLVulnerabilityAssessmentSettingsClient) Get(ctx context.Context, resourceID string, options *SQLVulnerabilityAssessmentSettingsClientGetOptions) (SQLVulnerabilityAssessmentSettingsClientGetResponse, error) { + var err error + const operationName = "SQLVulnerabilityAssessmentSettingsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceID, options) + if err != nil { + return SQLVulnerabilityAssessmentSettingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return SQLVulnerabilityAssessmentSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return SQLVulnerabilityAssessmentSettingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *SQLVulnerabilityAssessmentSettingsClient) getCreateRequest(ctx context.Context, resourceID string, _ *SQLVulnerabilityAssessmentSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2026-04-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 *SQLVulnerabilityAssessmentSettingsClient) getHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentSettingsClientGetResponse, error) { + result := SQLVulnerabilityAssessmentSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.SQLVulnerabilityAssessmentSettings); err != nil { + return SQLVulnerabilityAssessmentSettingsClientGetResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/standardassignments_client.go b/sdk/resourcemanager/security/armsecurity/standardassignments_client.go new file mode 100644 index 000000000000..4782a252b389 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/standardassignments_client.go @@ -0,0 +1,278 @@ +// 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) Go Code Generator. 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" + "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" +) + +// StandardAssignmentsClient contains the methods for the StandardAssignments group. +// Don't use this type directly, use NewStandardAssignmentsClient() instead. +type StandardAssignmentsClient struct { + internal *arm.Client +} + +// NewStandardAssignmentsClient creates a new instance of StandardAssignmentsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewStandardAssignmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*StandardAssignmentsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &StandardAssignmentsClient{ + internal: cl, + } + return client, nil +} + +// Create - Creates or updates a standard assignment. +// +// This operation creates or updates a standard assignment with the given scope and name. standard assignments apply to all +// resources contained within their scope. For example, when you assign a policy at resource group scope, that policy applies +// to all resources in the group. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-01 +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. +// - standardAssignmentName - The standard assignments assignment key - unique key for the standard assignment +// - standardAssignment - Custom standard assignment over a pre-defined scope +// - options - StandardAssignmentsClientCreateOptions contains the optional parameters for the StandardAssignmentsClient.Create +// method. +func (client *StandardAssignmentsClient) Create(ctx context.Context, resourceID string, standardAssignmentName string, standardAssignment StandardAssignment, options *StandardAssignmentsClientCreateOptions) (StandardAssignmentsClientCreateResponse, error) { + var err error + const operationName = "StandardAssignmentsClient.Create" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createCreateRequest(ctx, resourceID, standardAssignmentName, standardAssignment, options) + if err != nil { + return StandardAssignmentsClientCreateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StandardAssignmentsClientCreateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return StandardAssignmentsClientCreateResponse{}, err + } + resp, err := client.createHandleResponse(httpResp) + return resp, err +} + +// createCreateRequest creates the Create request. +func (client *StandardAssignmentsClient) createCreateRequest(ctx context.Context, resourceID string, standardAssignmentName string, standardAssignment StandardAssignment, _ *StandardAssignmentsClientCreateOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + if standardAssignmentName == "" { + return nil, errors.New("parameter standardAssignmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{standardAssignmentName}", url.PathEscape(standardAssignmentName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, standardAssignment); err != nil { + return nil, err + } + return req, nil +} + +// createHandleResponse handles the Create response. +func (client *StandardAssignmentsClient) createHandleResponse(resp *http.Response) (StandardAssignmentsClientCreateResponse, error) { + result := StandardAssignmentsClientCreateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StandardAssignment); err != nil { + return StandardAssignmentsClientCreateResponse{}, err + } + return result, nil +} + +// Delete - Deletes a standard assignment. +// +// This operation deletes a standard assignment, given its name and the scope it was created in. The scope of a standard assignment +// is the part of its ID preceding '/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}'. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-01 +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. +// - standardAssignmentName - The standard assignments assignment key - unique key for the standard assignment +// - options - StandardAssignmentsClientDeleteOptions contains the optional parameters for the StandardAssignmentsClient.Delete +// method. +func (client *StandardAssignmentsClient) Delete(ctx context.Context, resourceID string, standardAssignmentName string, options *StandardAssignmentsClientDeleteOptions) (StandardAssignmentsClientDeleteResponse, error) { + var err error + const operationName = "StandardAssignmentsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceID, standardAssignmentName, options) + if err != nil { + return StandardAssignmentsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StandardAssignmentsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return StandardAssignmentsClientDeleteResponse{}, err + } + return StandardAssignmentsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *StandardAssignmentsClient) deleteCreateRequest(ctx context.Context, resourceID string, standardAssignmentName string, _ *StandardAssignmentsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + if standardAssignmentName == "" { + return nil, errors.New("parameter standardAssignmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{standardAssignmentName}", url.PathEscape(standardAssignmentName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Retrieves a standard assignment. +// +// This operation retrieves a single standard assignment, given its name and the scope it was created at. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-01 +// - resourceID - The fully qualified Azure Resource manager identifier of the resource. +// - standardAssignmentName - The standard assignments assignment key - unique key for the standard assignment +// - options - StandardAssignmentsClientGetOptions contains the optional parameters for the StandardAssignmentsClient.Get method. +func (client *StandardAssignmentsClient) Get(ctx context.Context, resourceID string, standardAssignmentName string, options *StandardAssignmentsClientGetOptions) (StandardAssignmentsClientGetResponse, error) { + var err error + const operationName = "StandardAssignmentsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceID, standardAssignmentName, options) + if err != nil { + return StandardAssignmentsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StandardAssignmentsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return StandardAssignmentsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *StandardAssignmentsClient) getCreateRequest(ctx context.Context, resourceID string, standardAssignmentName string, _ *StandardAssignmentsClientGetOptions) (*policy.Request, error) { + urlPath := "/{resourceId}/providers/Microsoft.Security/standardAssignments/{standardAssignmentName}" + if resourceID == "" { + return nil, errors.New("parameter resourceID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) + if standardAssignmentName == "" { + return nil, errors.New("parameter standardAssignmentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{standardAssignmentName}", url.PathEscape(standardAssignmentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *StandardAssignmentsClient) getHandleResponse(resp *http.Response) (StandardAssignmentsClientGetResponse, error) { + result := StandardAssignmentsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StandardAssignment); err != nil { + return StandardAssignmentsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get a list of all relevant standard assignments over a scope +// +// Generated from API version 2024-08-01 +// - scope - The fully qualified Azure Resource manager identifier of the resource. +// - options - StandardAssignmentsClientListOptions contains the optional parameters for the StandardAssignmentsClient.NewListPager +// method. +func (client *StandardAssignmentsClient) NewListPager(scope string, options *StandardAssignmentsClientListOptions) *runtime.Pager[StandardAssignmentsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[StandardAssignmentsClientListResponse]{ + More: func(page StandardAssignmentsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *StandardAssignmentsClientListResponse) (StandardAssignmentsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "StandardAssignmentsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, scope, options) + }, nil) + if err != nil { + return StandardAssignmentsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *StandardAssignmentsClient) listCreateRequest(ctx context.Context, scope string, _ *StandardAssignmentsClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Security/standardAssignments" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *StandardAssignmentsClient) listHandleResponse(resp *http.Response) (StandardAssignmentsClientListResponse, error) { + result := StandardAssignmentsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StandardAssignmentsList); err != nil { + return StandardAssignmentsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/standards_client.go b/sdk/resourcemanager/security/armsecurity/standards_client.go new file mode 100644 index 000000000000..4f016483b251 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/standards_client.go @@ -0,0 +1,342 @@ +// 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) Go Code Generator. 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" + "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" +) + +// StandardsClient contains the methods for the Standards group. +// Don't use this type directly, use NewStandardsClient() instead. +type StandardsClient struct { + internal *arm.Client + subscriptionID string +} + +// NewStandardsClient creates a new instance of StandardsClient with the specified values. +// - subscriptionID - The ID of the target subscription. The value must be an UUID. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewStandardsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*StandardsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &StandardsClient{ + subscriptionID: subscriptionID, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create a security standard on the given scope. Available only for custom standards. Will create/update +// the required standard definitions. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - standardID - The Security Standard key - unique key for the standard type +// - standard - Custom security standard over a pre-defined scope +// - options - StandardsClientCreateOrUpdateOptions contains the optional parameters for the StandardsClient.CreateOrUpdate +// method. +func (client *StandardsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, standardID string, standard Standard, options *StandardsClientCreateOrUpdateOptions) (StandardsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "StandardsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, standardID, standard, options) + if err != nil { + return StandardsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StandardsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return StandardsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *StandardsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, standardID string, standard Standard, _ *StandardsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/standards/{standardId}" + 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 standardID == "" { + return nil, errors.New("parameter standardID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{standardId}", url.PathEscape(standardID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, standard); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *StandardsClient) createOrUpdateHandleResponse(resp *http.Response) (StandardsClientCreateOrUpdateResponse, error) { + result := StandardsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Standard); err != nil { + return StandardsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a security standard on a scope. +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - standardID - The Security Standard key - unique key for the standard type +// - options - StandardsClientDeleteOptions contains the optional parameters for the StandardsClient.Delete method. +func (client *StandardsClient) Delete(ctx context.Context, resourceGroupName string, standardID string, options *StandardsClientDeleteOptions) (StandardsClientDeleteResponse, error) { + var err error + const operationName = "StandardsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, resourceGroupName, standardID, options) + if err != nil { + return StandardsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StandardsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return StandardsClientDeleteResponse{}, err + } + return StandardsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *StandardsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, standardID string, _ *StandardsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/standards/{standardId}" + 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 standardID == "" { + return nil, errors.New("parameter standardID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{standardId}", url.PathEscape(standardID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Get a specific security standard for the requested scope +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2021-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - standardID - The Security Standard key - unique key for the standard type +// - options - StandardsClientGetOptions contains the optional parameters for the StandardsClient.Get method. +func (client *StandardsClient) Get(ctx context.Context, resourceGroupName string, standardID string, options *StandardsClientGetOptions) (StandardsClientGetResponse, error) { + var err error + const operationName = "StandardsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, resourceGroupName, standardID, options) + if err != nil { + return StandardsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return StandardsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return StandardsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *StandardsClient) getCreateRequest(ctx context.Context, resourceGroupName string, standardID string, _ *StandardsClientGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/standards/{standardId}" + 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 standardID == "" { + return nil, errors.New("parameter standardID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{standardId}", url.PathEscape(standardID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-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 *StandardsClient) getHandleResponse(resp *http.Response) (StandardsClientGetResponse, error) { + result := StandardsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.Standard); err != nil { + return StandardsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get security standards on all your resources inside a scope +// +// Generated from API version 2021-08-01-preview +// - resourceGroupName - The name of the resource group. The name is case insensitive. +// - options - StandardsClientListOptions contains the optional parameters for the StandardsClient.NewListPager method. +func (client *StandardsClient) NewListPager(resourceGroupName string, options *StandardsClientListOptions) *runtime.Pager[StandardsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[StandardsClientListResponse]{ + More: func(page StandardsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *StandardsClientListResponse) (StandardsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "StandardsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, options) + }, nil) + if err != nil { + return StandardsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *StandardsClient) listCreateRequest(ctx context.Context, resourceGroupName string, _ *StandardsClientListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/standards" + 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)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-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 *StandardsClient) listHandleResponse(resp *http.Response) (StandardsClientListResponse, error) { + result := StandardsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StandardList); err != nil { + return StandardsClientListResponse{}, err + } + return result, nil +} + +// NewListBySubscriptionPager - Get a list of all relevant security standards over a subscription level scope. +// +// Generated from API version 2021-08-01-preview +// - options - StandardsClientListBySubscriptionOptions contains the optional parameters for the StandardsClient.NewListBySubscriptionPager +// method. +func (client *StandardsClient) NewListBySubscriptionPager(options *StandardsClientListBySubscriptionOptions) *runtime.Pager[StandardsClientListBySubscriptionResponse] { + return runtime.NewPager(runtime.PagingHandler[StandardsClientListBySubscriptionResponse]{ + More: func(page StandardsClientListBySubscriptionResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *StandardsClientListBySubscriptionResponse) (StandardsClientListBySubscriptionResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "StandardsClient.NewListBySubscriptionPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listBySubscriptionCreateRequest(ctx, options) + }, nil) + if err != nil { + return StandardsClientListBySubscriptionResponse{}, err + } + return client.listBySubscriptionHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listBySubscriptionCreateRequest creates the ListBySubscription request. +func (client *StandardsClient) listBySubscriptionCreateRequest(ctx context.Context, _ *StandardsClientListBySubscriptionOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/standards" + 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.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listBySubscriptionHandleResponse handles the ListBySubscription response. +func (client *StandardsClient) listBySubscriptionHandleResponse(resp *http.Response) (StandardsClientListBySubscriptionResponse, error) { + result := StandardsClientListBySubscriptionResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StandardList); err != nil { + return StandardsClientListBySubscriptionResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/subassessments_client.go b/sdk/resourcemanager/security/armsecurity/subassessments_client.go index e0841b3ec14d..44ca2a6a15b2 100644 --- a/sdk/resourcemanager/security/armsecurity/subassessments_client.go +++ b/sdk/resourcemanager/security/armsecurity/subassessments_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,7 +24,7 @@ type SubAssessmentsClient struct { // NewSubAssessmentsClient creates a new instance of SubAssessmentsClient with the specified values. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewSubAssessmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*SubAssessmentsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -41,9 +40,8 @@ func NewSubAssessmentsClient(credential azcore.TokenCredential, options *arm.Cli // 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). -// - assessmentName - The Assessment Key - Unique key for the assessment type +// - scope - The scope of the sub-assessment. +// - assessmentName - The security assessment key - unique key for the assessment type // - subAssessmentName - The Sub-Assessment Key - Unique key for the sub-assessment type // - options - SubAssessmentsClientGetOptions contains the optional parameters for the SubAssessmentsClient.Get method. func (client *SubAssessmentsClient) Get(ctx context.Context, scope string, assessmentName string, subAssessmentName string, options *SubAssessmentsClientGetOptions) (SubAssessmentsClientGetResponse, error) { @@ -69,8 +67,11 @@ func (client *SubAssessmentsClient) Get(ctx context.Context, scope string, asses } // getCreateRequest creates the Get request. -func (client *SubAssessmentsClient) getCreateRequest(ctx context.Context, scope string, assessmentName string, subAssessmentName string, options *SubAssessmentsClientGetOptions) (*policy.Request, error) { +func (client *SubAssessmentsClient) getCreateRequest(ctx context.Context, scope string, assessmentName string, subAssessmentName string, _ *SubAssessmentsClientGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if assessmentName == "" { return nil, errors.New("parameter assessmentName cannot be empty") @@ -103,9 +104,8 @@ func (client *SubAssessmentsClient) getHandleResponse(resp *http.Response) (SubA // NewListPager - Get security sub-assessments on all your scanned resources inside a scope // // 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). -// - assessmentName - The Assessment Key - Unique key for the assessment type +// - scope - The scope of the sub-assessment. +// - assessmentName - The security assessment key - unique key for the assessment type // - options - SubAssessmentsClientListOptions contains the optional parameters for the SubAssessmentsClient.NewListPager method. func (client *SubAssessmentsClient) NewListPager(scope string, assessmentName string, options *SubAssessmentsClientListOptions) *runtime.Pager[SubAssessmentsClientListResponse] { return runtime.NewPager(runtime.PagingHandler[SubAssessmentsClientListResponse]{ @@ -131,8 +131,11 @@ func (client *SubAssessmentsClient) NewListPager(scope string, assessmentName st } // listCreateRequest creates the List request. -func (client *SubAssessmentsClient) listCreateRequest(ctx context.Context, scope string, assessmentName string, options *SubAssessmentsClientListOptions) (*policy.Request, error) { +func (client *SubAssessmentsClient) listCreateRequest(ctx context.Context, scope string, assessmentName string, _ *SubAssessmentsClientListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if assessmentName == "" { return nil, errors.New("parameter assessmentName cannot be empty") @@ -161,8 +164,7 @@ func (client *SubAssessmentsClient) listHandleResponse(resp *http.Response) (Sub // NewListAllPager - Get security sub-assessments on all your scanned resources inside a subscription scope // // 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). +// - scope - The fully qualified Azure Resource manager identifier of the resource. // - options - SubAssessmentsClientListAllOptions contains the optional parameters for the SubAssessmentsClient.NewListAllPager // method. func (client *SubAssessmentsClient) NewListAllPager(scope string, options *SubAssessmentsClientListAllOptions) *runtime.Pager[SubAssessmentsClientListAllResponse] { @@ -189,8 +191,11 @@ func (client *SubAssessmentsClient) NewListAllPager(scope string, options *SubAs } // listAllCreateRequest creates the ListAll request. -func (client *SubAssessmentsClient) listAllCreateRequest(ctx context.Context, scope string, options *SubAssessmentsClientListAllOptions) (*policy.Request, error) { +func (client *SubAssessmentsClient) listAllCreateRequest(ctx context.Context, scope string, _ *SubAssessmentsClientListAllOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/subAssessments" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) if err != nil { diff --git a/sdk/resourcemanager/security/armsecurity/tasks_client.go b/sdk/resourcemanager/security/armsecurity/tasks_client.go index 390f96df3c52..d9d6c196c976 100644 --- a/sdk/resourcemanager/security/armsecurity/tasks_client.go +++ b/sdk/resourcemanager/security/armsecurity/tasks_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type TasksClient struct { } // NewTasksClient creates a new instance of TasksClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewTasksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TasksClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -44,7 +43,7 @@ func NewTasksClient(subscriptionID string, credential azcore.TokenCredential, op // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // - taskName - Name of the task object, will be a GUID // - options - TasksClientGetResourceGroupLevelTaskOptions contains the optional parameters for the TasksClient.GetResourceGroupLevelTask @@ -72,7 +71,7 @@ func (client *TasksClient) GetResourceGroupLevelTask(ctx context.Context, resour } // getResourceGroupLevelTaskCreateRequest creates the GetResourceGroupLevelTask request. -func (client *TasksClient) getResourceGroupLevelTaskCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, taskName string, options *TasksClientGetResourceGroupLevelTaskOptions) (*policy.Request, error) { +func (client *TasksClient) getResourceGroupLevelTaskCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, taskName string, _ *TasksClientGetResourceGroupLevelTaskOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -141,7 +140,7 @@ func (client *TasksClient) GetSubscriptionLevelTask(ctx context.Context, ascLoca } // getSubscriptionLevelTaskCreateRequest creates the GetSubscriptionLevelTask request. -func (client *TasksClient) getSubscriptionLevelTaskCreateRequest(ctx context.Context, ascLocation string, taskName string, options *TasksClientGetSubscriptionLevelTaskOptions) (*policy.Request, error) { +func (client *TasksClient) getSubscriptionLevelTaskCreateRequest(ctx context.Context, ascLocation string, taskName string, _ *TasksClientGetSubscriptionLevelTaskOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -298,7 +297,7 @@ func (client *TasksClient) listByHomeRegionHandleResponse(resp *http.Response) ( // NewListByResourceGroupPager - Recommended tasks that will help improve the security of the subscription proactively // // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // - options - TasksClientListByResourceGroupOptions contains the optional parameters for the TasksClient.NewListByResourceGroupPager // method. @@ -367,7 +366,7 @@ func (client *TasksClient) listByResourceGroupHandleResponse(resp *http.Response // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // - taskName - Name of the task object, will be a GUID // - taskUpdateActionType - Type of the action to do on the task @@ -395,7 +394,7 @@ func (client *TasksClient) UpdateResourceGroupLevelTaskState(ctx context.Context } // updateResourceGroupLevelTaskStateCreateRequest creates the UpdateResourceGroupLevelTaskState request. -func (client *TasksClient) updateResourceGroupLevelTaskStateCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, taskName string, taskUpdateActionType TaskUpdateActionType, options *TasksClientUpdateResourceGroupLevelTaskStateOptions) (*policy.Request, error) { +func (client *TasksClient) updateResourceGroupLevelTaskStateCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, taskName string, taskUpdateActionType TaskUpdateActionType, _ *TasksClientUpdateResourceGroupLevelTaskStateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -424,7 +423,6 @@ func (client *TasksClient) updateResourceGroupLevelTaskStateCreateRequest(ctx co reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2015-06-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header["Accept"] = []string{"application/json"} return req, nil } @@ -459,7 +457,7 @@ func (client *TasksClient) UpdateSubscriptionLevelTaskState(ctx context.Context, } // updateSubscriptionLevelTaskStateCreateRequest creates the UpdateSubscriptionLevelTaskState request. -func (client *TasksClient) updateSubscriptionLevelTaskStateCreateRequest(ctx context.Context, ascLocation string, taskName string, taskUpdateActionType TaskUpdateActionType, options *TasksClientUpdateSubscriptionLevelTaskStateOptions) (*policy.Request, error) { +func (client *TasksClient) updateSubscriptionLevelTaskStateCreateRequest(ctx context.Context, ascLocation string, taskName string, taskUpdateActionType TaskUpdateActionType, _ *TasksClientUpdateSubscriptionLevelTaskStateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/tasks/{taskName}/{taskUpdateActionType}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -484,6 +482,5 @@ func (client *TasksClient) updateSubscriptionLevelTaskStateCreateRequest(ctx con reqQP := req.Raw().URL.Query() reqQP.Set("api-version", "2015-06-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/testdata/_metadata.json b/sdk/resourcemanager/security/armsecurity/testdata/_metadata.json new file mode 100644 index 000000000000..3125fd016f9f --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/testdata/_metadata.json @@ -0,0 +1,37 @@ +{ + "apiVersions": { + "AlertsAPI": "2022-01-01", + "AlertsSuppressionRulesAPI": "2019-01-01-preview", + "ApiCollectionsAPI": "2023-11-15", + "ApplicationsAPI": "2022-07-01-preview", + "AssessmentAPI": "2025-05-04", + "ATPSettingsAPI": "2019-01-01", + "AutomationsAPI": "2023-12-01-preview", + "ComplianceResultsAPI": "2017-08-01", + "DefenderForStorageAPI": "2025-09-01-preview", + "GovernanceAPI": "2022-01-01-preview", + "HealthReportsAPI": "2023-05-01-preview", + "IoTSecurityAPI": "2019-08-01", + "LegacySettingsAPI": "2017-08-01-preview", + "LocationsAPI": "2015-06-01-preview", + "MdeOnboardingAPI": "2021-10-01-preview", + "OperationsAPI": "2025-10-01-preview", + "PricingsAPI": "2024-01-01", + "PrivateLinksAPI": "2026-01-01", + "RegulatoryComplianceAPI": "2019-01-01-preview", + "SecureScoreAPI": "2020-01-01", + "SecurityConnectorsAPI": "2024-08-01-preview", + "SecurityConnectorsDevOpsAPI": "2025-11-01-preview", + "SecurityOperatorsAPI": "2023-01-01-preview", + "SecuritySolutionsAPI": "2020-01-01", + "SecurityStandardsAPI": "2024-08-01", + "SensitivitySettingsAPI": "2023-02-15-preview", + "ServerVulnerabilityAssessmentsSettingsAPI": "2023-05-01", + "SettingsAPI": "2022-05-01", + "SqlVulnerabilityAssessmentsAPI": "2026-04-01-preview", + "StandardsAPI": "2021-08-01-preview", + "SubAssessmentsAPI": "2019-01-01-preview", + "TasksAPI": "2015-06-01-preview" + }, + "emitterVersion": "0.11.0" +} diff --git a/sdk/resourcemanager/security/armsecurity/time_rfc3339.go b/sdk/resourcemanager/security/armsecurity/time_rfc3339.go deleted file mode 100644 index 24671b94cb01..000000000000 --- a/sdk/resourcemanager/security/armsecurity/time_rfc3339.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -package armsecurity - -import ( - "encoding/json" - "fmt" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" - "reflect" - "regexp" - "strings" - "time" -) - -// Azure reports time in UTC but it doesn't include the 'Z' time zone suffix in some cases. -var tzOffsetRegex = regexp.MustCompile(`(?:Z|z|\+|-)(?:\d+:\d+)*"*$`) - -const ( - utcDateTime = "2006-01-02T15:04:05.999999999" - utcDateTimeJSON = `"` + utcDateTime + `"` - utcDateTimeNoT = "2006-01-02 15:04:05.999999999" - utcDateTimeJSONNoT = `"` + utcDateTimeNoT + `"` - dateTimeNoT = `2006-01-02 15:04:05.999999999Z07:00` - dateTimeJSON = `"` + time.RFC3339Nano + `"` - dateTimeJSONNoT = `"` + dateTimeNoT + `"` -) - -type dateTimeRFC3339 time.Time - -func (t dateTimeRFC3339) MarshalJSON() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalJSON() -} - -func (t dateTimeRFC3339) MarshalText() ([]byte, error) { - tt := time.Time(t) - return tt.MarshalText() -} - -func (t *dateTimeRFC3339) UnmarshalJSON(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = dateTimeJSON - } else if tzOffset { - layout = dateTimeJSONNoT - } else if hasT { - layout = utcDateTimeJSON - } else { - layout = utcDateTimeJSONNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) UnmarshalText(data []byte) error { - tzOffset := tzOffsetRegex.Match(data) - hasT := strings.Contains(string(data), "T") || strings.Contains(string(data), "t") - var layout string - if tzOffset && hasT { - layout = time.RFC3339Nano - } else if tzOffset { - layout = dateTimeNoT - } else if hasT { - layout = utcDateTime - } else { - layout = utcDateTimeNoT - } - return t.Parse(layout, string(data)) -} - -func (t *dateTimeRFC3339) Parse(layout, value string) error { - p, err := time.Parse(layout, strings.ToUpper(value)) - *t = dateTimeRFC3339(p) - return err -} - -func (t dateTimeRFC3339) String() string { - return time.Time(t).Format(time.RFC3339Nano) -} - -func populateDateTimeRFC3339(m map[string]any, k string, t *time.Time) { - if t == nil { - return - } else if azcore.IsNullValue(t) { - m[k] = nil - return - } else if reflect.ValueOf(t).IsNil() { - return - } - m[k] = (*dateTimeRFC3339)(t) -} - -func unpopulateDateTimeRFC3339(data json.RawMessage, fn string, t **time.Time) error { - if data == nil || string(data) == "null" { - return nil - } - var aux dateTimeRFC3339 - if err := json.Unmarshal(data, &aux); err != nil { - return fmt.Errorf("struct field %s: %v", fn, err) - } - *t = (*time.Time)(&aux) - return nil -} diff --git a/sdk/resourcemanager/security/armsecurity/topology_client.go b/sdk/resourcemanager/security/armsecurity/topology_client.go index 74324cadc001..91b3163fbc25 100644 --- a/sdk/resourcemanager/security/armsecurity/topology_client.go +++ b/sdk/resourcemanager/security/armsecurity/topology_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type TopologyClient struct { } // NewTopologyClient creates a new instance of TopologyClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewTopologyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TopologyClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -44,7 +43,7 @@ func NewTopologyClient(subscriptionID string, credential azcore.TokenCredential, // 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. +// - resourceGroupName - The name of the resource group. The name is case insensitive. // - ascLocation - The location where ASC stores the data of the subscription. can be retrieved from Get locations // - topologyResourceName - Name of a topology resources collection. // - options - TopologyClientGetOptions contains the optional parameters for the TopologyClient.Get method. @@ -71,7 +70,7 @@ func (client *TopologyClient) Get(ctx context.Context, resourceGroupName string, } // getCreateRequest creates the Get request. -func (client *TopologyClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, topologyResourceName string, options *TopologyClientGetOptions) (*policy.Request, error) { +func (client *TopologyClient) getCreateRequest(ctx context.Context, resourceGroupName string, ascLocation string, topologyResourceName string, _ *TopologyClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/locations/{ascLocation}/topologies/{topologyResourceName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -137,7 +136,7 @@ func (client *TopologyClient) NewListPager(options *TopologyClientListOptions) * } // listCreateRequest creates the List request. -func (client *TopologyClient) listCreateRequest(ctx context.Context, options *TopologyClientListOptions) (*policy.Request, error) { +func (client *TopologyClient) listCreateRequest(ctx context.Context, _ *TopologyClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/topologies" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -193,7 +192,7 @@ func (client *TopologyClient) NewListByHomeRegionPager(ascLocation string, optio } // listByHomeRegionCreateRequest creates the ListByHomeRegion request. -func (client *TopologyClient) listByHomeRegionCreateRequest(ctx context.Context, ascLocation string, options *TopologyClientListByHomeRegionOptions) (*policy.Request, error) { +func (client *TopologyClient) listByHomeRegionCreateRequest(ctx context.Context, ascLocation string, _ *TopologyClientListByHomeRegionOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/locations/{ascLocation}/topologies" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") diff --git a/sdk/resourcemanager/security/armsecurity/tsp-location.yaml b/sdk/resourcemanager/security/armsecurity/tsp-location.yaml new file mode 100644 index 000000000000..e3c989fc535e --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/security/resource-manager/Microsoft.Security/Security +commit: f127e37c800e7ba895f4de2cc4b3e9cb6b75ff94 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/security/armsecurity/version.go b/sdk/resourcemanager/security/armsecurity/version.go new file mode 100644 index 000000000000..974a1be4f861 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/version.go @@ -0,0 +1,10 @@ +// 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) Go Code Generator. + +package armsecurity + +const ( + moduleName = "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" + moduleVersion = "v0.15.0" +) diff --git a/sdk/resourcemanager/security/armsecurity/workspacesettings_client.go b/sdk/resourcemanager/security/armsecurity/workspacesettings_client.go index f20dd9538653..e1be6609a14e 100644 --- a/sdk/resourcemanager/security/armsecurity/workspacesettings_client.go +++ b/sdk/resourcemanager/security/armsecurity/workspacesettings_client.go @@ -1,7 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. See License.txt in the project root for license information. -// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. +// Code generated by Microsoft (R) Go Code Generator. DO NOT EDIT. package armsecurity @@ -25,9 +24,9 @@ type WorkspaceSettingsClient struct { } // NewWorkspaceSettingsClient creates a new instance of WorkspaceSettingsClient with the specified values. -// - subscriptionID - Azure subscription ID +// - subscriptionID - The ID of the target subscription. The value must be an UUID. // - credential - used to authorize requests. Usually a credential from azidentity. -// - options - pass nil to accept the default values. +// - options - Contains optional client configuration. Pass nil to accept the default values. func NewWorkspaceSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*WorkspaceSettingsClient, error) { cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) if err != nil { @@ -71,7 +70,7 @@ func (client *WorkspaceSettingsClient) Create(ctx context.Context, workspaceSett } // createCreateRequest creates the Create request. -func (client *WorkspaceSettingsClient) createCreateRequest(ctx context.Context, workspaceSettingName string, workspaceSetting WorkspaceSetting, options *WorkspaceSettingsClientCreateOptions) (*policy.Request, error) { +func (client *WorkspaceSettingsClient) createCreateRequest(ctx context.Context, workspaceSettingName string, workspaceSetting WorkspaceSetting, _ *WorkspaceSettingsClientCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -89,6 +88,7 @@ func (client *WorkspaceSettingsClient) createCreateRequest(ctx context.Context, reqQP.Set("api-version", "2017-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, workspaceSetting); err != nil { return nil, err } @@ -133,7 +133,7 @@ func (client *WorkspaceSettingsClient) Delete(ctx context.Context, workspaceSett } // deleteCreateRequest creates the Delete request. -func (client *WorkspaceSettingsClient) deleteCreateRequest(ctx context.Context, workspaceSettingName string, options *WorkspaceSettingsClientDeleteOptions) (*policy.Request, error) { +func (client *WorkspaceSettingsClient) deleteCreateRequest(ctx context.Context, workspaceSettingName string, _ *WorkspaceSettingsClientDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -150,7 +150,6 @@ func (client *WorkspaceSettingsClient) deleteCreateRequest(ctx context.Context, 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, nil } @@ -184,7 +183,7 @@ func (client *WorkspaceSettingsClient) Get(ctx context.Context, workspaceSetting } // getCreateRequest creates the Get request. -func (client *WorkspaceSettingsClient) getCreateRequest(ctx context.Context, workspaceSettingName string, options *WorkspaceSettingsClientGetOptions) (*policy.Request, error) { +func (client *WorkspaceSettingsClient) getCreateRequest(ctx context.Context, workspaceSettingName string, _ *WorkspaceSettingsClientGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -244,7 +243,7 @@ func (client *WorkspaceSettingsClient) NewListPager(options *WorkspaceSettingsCl } // listCreateRequest creates the List request. -func (client *WorkspaceSettingsClient) listCreateRequest(ctx context.Context, options *WorkspaceSettingsClientListOptions) (*policy.Request, error) { +func (client *WorkspaceSettingsClient) listCreateRequest(ctx context.Context, _ *WorkspaceSettingsClientListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -301,7 +300,7 @@ func (client *WorkspaceSettingsClient) Update(ctx context.Context, workspaceSett } // updateCreateRequest creates the Update request. -func (client *WorkspaceSettingsClient) updateCreateRequest(ctx context.Context, workspaceSettingName string, workspaceSetting WorkspaceSetting, options *WorkspaceSettingsClientUpdateOptions) (*policy.Request, error) { +func (client *WorkspaceSettingsClient) updateCreateRequest(ctx context.Context, workspaceSettingName string, workspaceSetting WorkspaceSetting, _ *WorkspaceSettingsClientUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/workspaceSettings/{workspaceSettingName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -319,6 +318,7 @@ func (client *WorkspaceSettingsClient) updateCreateRequest(ctx context.Context, reqQP.Set("api-version", "2017-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} if err := runtime.MarshalAsJSON(req, workspaceSetting); err != nil { return nil, err } From 7f3749f0366ee62f28efdba108891dae3b106e97 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Thu, 7 May 2026 08:39:51 +0000 Subject: [PATCH 2/5] Configurations: 'specification/security/resource-manager/Microsoft.Security/Security/tspconfig.yaml', and CommitSHA: 'd01a896e740fde162718aa4416b50cb2994375c2' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6263509 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../security/armsecurity/CHANGELOG.md | 20 +- .../armsecuritystandards_client.go | 270 ++++++++++++++++++ .../security/armsecurity/client_factory.go | 14 +- .../security/armsecurity/constants.go | 39 +-- .../fake/armsecuritystandards_server.go | 247 ++++++++++++++++ .../armsecurity/fake/server_factory.go | 16 +- .../security/armsecurity/interfaces.go | 20 +- .../security/armsecurity/models.go | 118 +++----- .../security/armsecurity/models_serde.go | 154 ++++------ .../security/armsecurity/options.go | 42 +-- .../armsecurity/polymorphic_helpers.go | 50 ++-- .../security/armsecurity/responses.go | 50 ++-- .../security/armsecurity/standards_client.go | 4 +- .../security/armsecurity/tsp-location.yaml | 2 +- 14 files changed, 757 insertions(+), 289 deletions(-) create mode 100644 sdk/resourcemanager/security/armsecurity/armsecuritystandards_client.go create mode 100644 sdk/resourcemanager/security/armsecurity/fake/armsecuritystandards_server.go diff --git a/sdk/resourcemanager/security/armsecurity/CHANGELOG.md b/sdk/resourcemanager/security/armsecurity/CHANGELOG.md index f1cc444993b0..6f2afbc1cc1f 100644 --- a/sdk/resourcemanager/security/armsecurity/CHANGELOG.md +++ b/sdk/resourcemanager/security/armsecurity/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 0.15.0 (2026-05-06) +## 0.15.0 (2026-05-07) ### Breaking Changes - Function `*SQLVulnerabilityAssessmentBaselineRulesClient.Add` parameter(s) have been changed from `(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientAddOptions)` to `(ctx context.Context, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientAddOptions)` @@ -11,6 +11,8 @@ - Function `*SQLVulnerabilityAssessmentScansClient.Get` parameter(s) have been changed from `(ctx context.Context, scanID string, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentScansClientGetOptions)` to `(ctx context.Context, scanID string, resourceID string, options *SQLVulnerabilityAssessmentScansClientGetOptions)` - Function `*SettingsClient.Get` parameter(s) have been changed from `(ctx context.Context, settingName SettingNameAutoGenerated, options *SettingsClientGetOptions)` to `(ctx context.Context, settingName SettingName, options *SettingsClientGetOptions)` - Function `*SettingsClient.Update` parameter(s) have been changed from `(ctx context.Context, settingName SettingNameAutoGenerated, setting SettingClassification, options *SettingsClientUpdateOptions)` to `(ctx context.Context, settingName SettingName, setting SettingClassification, options *SettingsClientUpdateOptions)` +- Type of `AssessmentProperties.ResourceDetails` has been changed from `ResourceDetailsClassification` to `CommonResourceDetailsClassification` +- Type of `AssessmentPropertiesResponse.ResourceDetails` has been changed from `ResourceDetailsClassification` to `CommonResourceDetailsClassification` - Type of `Extension.OperationStatus` has been changed from `*OperationStatusAutoGenerated` to `*OperationStatus` - Type of `HealthReportProperties.ResourceDetails` has been changed from `*ResourceDetailsAutoGenerated` to `*ResourceDetails` - Type of `HealthReportProperties.Status` has been changed from `*StatusAutoGenerated` to `*Status` @@ -18,6 +20,7 @@ - Type of `Operation.Origin` has been changed from `*string` to `*Origin` - Type of `OperationStatusResult.Error` has been changed from `*ErrorDetailAutoGenerated` to `*ErrorDetail` - Type of `OperationStatusResult.PercentComplete` has been changed from `*float32` to `*float64` +- Type of `SubAssessmentProperties.ResourceDetails` has been changed from `ResourceDetailsClassification` to `CommonResourceDetailsClassification` - `AuthenticationTypeAwsAssumeRole`, `AuthenticationTypeAwsCreds`, `AuthenticationTypeGcpCredentials` from enum `AuthenticationType` has been removed - Enum `AdaptiveApplicationControlIssue` has been removed - Enum `ApplicationConditionOperator` has been removed @@ -58,6 +61,7 @@ - Function `*AuthenticationDetailsProperties.GetAuthenticationDetailsProperties` has been removed - Function `*AwAssumeRoleAuthenticationDetailsProperties.GetAuthenticationDetailsProperties` has been removed - Function `*AwsCredsAuthenticationDetailsProperties.GetAuthenticationDetailsProperties` has been removed +- Function `*AzureResourceDetails.GetResourceDetails` has been removed - Function `*ClientFactory.NewAccountConnectorsClient` has been removed - Function `*ClientFactory.NewAdaptiveApplicationControlsClient` has been removed - Function `*ClientFactory.NewAdaptiveNetworkHardeningsClient` has been removed @@ -77,6 +81,8 @@ - Function `*CustomEntityStoreAssignmentsClient.NewListByResourceGroupPager` has been removed - Function `*CustomEntityStoreAssignmentsClient.NewListBySubscriptionPager` has been removed - Function `*GcpCredentialsDetailsProperties.GetAuthenticationDetailsProperties` has been removed +- Function `*OnPremiseResourceDetails.GetResourceDetails` has been removed +- Function `*OnPremiseSQLResourceDetails.GetResourceDetails` has been removed - Function `*ResourceDetails.GetResourceDetails` has been removed - Function `NewSoftwareInventoriesClient` has been removed - Function `*SoftwareInventoriesClient.Get` has been removed @@ -185,6 +191,7 @@ - New value `SourceAws`, `SourceGcp`, `SourceOnPremiseResourceDetails` added to enum type `Source` - New value `StateOff`, `StateOn` added to enum type `State` - New enum type `AgentlessEnablement` with values `AgentlessEnablementDisabled`, `AgentlessEnablementEnabled`, `AgentlessEnablementNotApplicable` +- New enum type `ArmActionType` with values `ArmActionTypeInternal` - New enum type `AttestationComplianceState` with values `AttestationComplianceStateCompliant`, `AttestationComplianceStateNonCompliant`, `AttestationComplianceStateUnknown` - New enum type `AutomatedResponseType` with values `AutomatedResponseTypeBlobSoftDelete`, `AutomatedResponseTypeNone` - New enum type `BlobScanResultsOptions` with values `BlobScanResultsOptionsBlobIndexTags`, `BlobScanResultsOptionsNone` @@ -207,6 +214,11 @@ - New enum type `StandardType` with values `StandardTypeCompliance`, `StandardTypeCustom`, `StandardTypeDefault` - New enum type `StatusEnum` with values `StatusEnumInitiated`, `StatusEnumRevoked` - New function `*AccessTokenAuthentication.GetAuthentication() *Authentication` +- New function `NewArmSecurityStandardsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ArmSecurityStandardsClient, error)` +- New function `*ArmSecurityStandardsClient.CreateOrUpdate(ctx context.Context, scope string, standardID string, standard ArmSecurityStandard, options *ArmSecurityStandardsClientCreateOrUpdateOptions) (ArmSecurityStandardsClientCreateOrUpdateResponse, error)` +- New function `*ArmSecurityStandardsClient.Delete(ctx context.Context, scope string, standardID string, options *ArmSecurityStandardsClientDeleteOptions) (ArmSecurityStandardsClientDeleteResponse, error)` +- New function `*ArmSecurityStandardsClient.Get(ctx context.Context, scope string, standardID string, options *ArmSecurityStandardsClientGetOptions) (ArmSecurityStandardsClientGetResponse, error)` +- New function `*ArmSecurityStandardsClient.NewListPager(scope string, options *ArmSecurityStandardsClientListOptions) *runtime.Pager[ArmSecurityStandardsClientListResponse]` - New function `NewAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*AssignmentsClient, error)` - New function `*AssignmentsClient.CreateOrUpdate(ctx context.Context, resourceGroupName string, assignmentID string, assignment Assignment, options *AssignmentsClientCreateOrUpdateOptions) (AssignmentsClientCreateOrUpdateResponse, error)` - New function `*AssignmentsClient.Delete(ctx context.Context, resourceGroupName string, assignmentID string, options *AssignmentsClientDeleteOptions) (AssignmentsClientDeleteResponse, error)` @@ -214,6 +226,8 @@ - New function `*AssignmentsClient.NewListBySubscriptionPager(options *AssignmentsClientListBySubscriptionOptions) *runtime.Pager[AssignmentsClientListBySubscriptionResponse]` - New function `*AssignmentsClient.NewListPager(resourceGroupName string, options *AssignmentsClientListOptions) *runtime.Pager[AssignmentsClientListResponse]` - New function `*Authentication.GetAuthentication() *Authentication` +- New function `*AzureResourceDetails.GetCommonResourceDetails() *CommonResourceDetails` +- New function `*ClientFactory.NewArmSecurityStandardsClient() *ArmSecurityStandardsClient` - New function `*ClientFactory.NewAssignmentsClient() *AssignmentsClient` - New function `*ClientFactory.NewCustomRecommendationsClient() *CustomRecommendationsClient` - New function `*ClientFactory.NewGitHubIssuesClient() *GitHubIssuesClient` @@ -225,6 +239,7 @@ - New function `*ClientFactory.NewSQLVulnerabilityAssessmentSettingsClient() *SQLVulnerabilityAssessmentSettingsClient` - New function `*ClientFactory.NewStandardAssignmentsClient() *StandardAssignmentsClient` - New function `*ClientFactory.NewStandardsClient() *StandardsClient` +- New function `*CommonResourceDetails.GetCommonResourceDetails() *CommonResourceDetails` - New function `*CspmMonitorDockerHubOffering.GetCloudOffering() *CloudOffering` - New function `*CspmMonitorJFrogOffering.GetCloudOffering() *CloudOffering` - New function `NewCustomRecommendationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*CustomRecommendationsClient, error)` @@ -244,6 +259,8 @@ - New function `NewGitHubIssuesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*GitHubIssuesClient, error)` - New function `*GitHubIssuesClient.BeginCreate(ctx context.Context, resourceGroupName string, securityConnectorName string, ownerName string, repoName string, options *GitHubIssuesClientBeginCreateOptions) (*runtime.Poller[GitHubIssuesClientCreateResponse], error)` - New function `*JFrogEnvironmentData.GetEnvironmentData() *EnvironmentData` +- New function `*OnPremiseResourceDetails.GetCommonResourceDetails() *CommonResourceDetails` +- New function `*OnPremiseSQLResourceDetails.GetCommonResourceDetails() *CommonResourceDetails` - New function `NewOperationResultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationResultsClient, error)` - New function `*OperationResultsClient.Get(ctx context.Context, location string, operationID string, options *OperationResultsClientGetOptions) (OperationResultsClientGetResponse, error)` - New function `NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusesClient, error)` @@ -286,6 +303,7 @@ - New struct `AgentlessConfiguration` - New struct `ArmPrivateEndpointConnection` - New struct `ArmSecurityStandard` +- New struct `ArmSecurityStandardList` - New struct `ArmSecurityStandardProperties` - New struct `AssessmentPropertiesBaseRisk` - New struct `AssessmentPropertiesBaseRiskPathsItem` diff --git a/sdk/resourcemanager/security/armsecurity/armsecuritystandards_client.go b/sdk/resourcemanager/security/armsecurity/armsecuritystandards_client.go new file mode 100644 index 000000000000..1e1292d8b89b --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/armsecuritystandards_client.go @@ -0,0 +1,270 @@ +// 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) Go Code Generator. 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" + "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" +) + +// ArmSecurityStandardsClient contains the methods for the ArmSecurityStandards group. +// Don't use this type directly, use NewArmSecurityStandardsClient() instead. +type ArmSecurityStandardsClient struct { + internal *arm.Client +} + +// NewArmSecurityStandardsClient creates a new instance of ArmSecurityStandardsClient with the specified values. +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - Contains optional client configuration. Pass nil to accept the default values. +func NewArmSecurityStandardsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ArmSecurityStandardsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &ArmSecurityStandardsClient{ + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Creates or updates a security standard over a given scope +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-01 +// - scope - The fully qualified Azure Resource manager identifier of the resource. +// - standardID - The Security Standard key - unique key for the standard type +// - standard - Custom security standard over a pre-defined scope +// - options - ArmSecurityStandardsClientCreateOrUpdateOptions contains the optional parameters for the ArmSecurityStandardsClient.CreateOrUpdate +// method. +func (client *ArmSecurityStandardsClient) CreateOrUpdate(ctx context.Context, scope string, standardID string, standard ArmSecurityStandard, options *ArmSecurityStandardsClientCreateOrUpdateOptions) (ArmSecurityStandardsClientCreateOrUpdateResponse, error) { + var err error + const operationName = "ArmSecurityStandardsClient.CreateOrUpdate" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, scope, standardID, standard, options) + if err != nil { + return ArmSecurityStandardsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArmSecurityStandardsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return ArmSecurityStandardsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *ArmSecurityStandardsClient) createOrUpdateCreateRequest(ctx context.Context, scope string, standardID string, standard ArmSecurityStandard, _ *ArmSecurityStandardsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Security/securityStandards/{standardId}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if standardID == "" { + return nil, errors.New("parameter standardID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{standardId}", url.PathEscape(standardID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + req.Raw().Header["Content-Type"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, standard); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *ArmSecurityStandardsClient) createOrUpdateHandleResponse(resp *http.Response) (ArmSecurityStandardsClientCreateOrUpdateResponse, error) { + result := ArmSecurityStandardsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArmSecurityStandard); err != nil { + return ArmSecurityStandardsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a security standard over a given scope +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-01 +// - scope - The fully qualified Azure Resource manager identifier of the resource. +// - standardID - The Security Standard key - unique key for the standard type +// - options - ArmSecurityStandardsClientDeleteOptions contains the optional parameters for the ArmSecurityStandardsClient.Delete +// method. +func (client *ArmSecurityStandardsClient) Delete(ctx context.Context, scope string, standardID string, options *ArmSecurityStandardsClientDeleteOptions) (ArmSecurityStandardsClientDeleteResponse, error) { + var err error + const operationName = "ArmSecurityStandardsClient.Delete" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, scope, standardID, options) + if err != nil { + return ArmSecurityStandardsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArmSecurityStandardsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return ArmSecurityStandardsClientDeleteResponse{}, err + } + return ArmSecurityStandardsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *ArmSecurityStandardsClient) deleteCreateRequest(ctx context.Context, scope string, standardID string, _ *ArmSecurityStandardsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Security/securityStandards/{standardId}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if standardID == "" { + return nil, errors.New("parameter standardID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{standardId}", url.PathEscape(standardID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + return req, nil +} + +// Get - Get a specific security standard for the requested scope by standardId +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2024-08-01 +// - scope - The fully qualified Azure Resource manager identifier of the resource. +// - standardID - The Security Standard key - unique key for the standard type +// - options - ArmSecurityStandardsClientGetOptions contains the optional parameters for the ArmSecurityStandardsClient.Get +// method. +func (client *ArmSecurityStandardsClient) Get(ctx context.Context, scope string, standardID string, options *ArmSecurityStandardsClientGetOptions) (ArmSecurityStandardsClientGetResponse, error) { + var err error + const operationName = "ArmSecurityStandardsClient.Get" + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, operationName) + ctx, endSpan := runtime.StartSpan(ctx, operationName, client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, scope, standardID, options) + if err != nil { + return ArmSecurityStandardsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return ArmSecurityStandardsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return ArmSecurityStandardsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *ArmSecurityStandardsClient) getCreateRequest(ctx context.Context, scope string, standardID string, _ *ArmSecurityStandardsClientGetOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Security/securityStandards/{standardId}" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + if standardID == "" { + return nil, errors.New("parameter standardID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{standardId}", url.PathEscape(standardID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *ArmSecurityStandardsClient) getHandleResponse(resp *http.Response) (ArmSecurityStandardsClientGetResponse, error) { + result := ArmSecurityStandardsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.ArmSecurityStandard); err != nil { + return ArmSecurityStandardsClientGetResponse{}, err + } + return result, nil +} + +// NewListPager - Get a list of all relevant security standards over a scope +// +// Generated from API version 2024-08-01 +// - scope - The fully qualified Azure Resource manager identifier of the resource. +// - options - ArmSecurityStandardsClientListOptions contains the optional parameters for the ArmSecurityStandardsClient.NewListPager +// method. +func (client *ArmSecurityStandardsClient) NewListPager(scope string, options *ArmSecurityStandardsClientListOptions) *runtime.Pager[ArmSecurityStandardsClientListResponse] { + return runtime.NewPager(runtime.PagingHandler[ArmSecurityStandardsClientListResponse]{ + More: func(page ArmSecurityStandardsClientListResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *ArmSecurityStandardsClientListResponse) (ArmSecurityStandardsClientListResponse, error) { + ctx = context.WithValue(ctx, runtime.CtxAPINameKey{}, "ArmSecurityStandardsClient.NewListPager") + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, scope, options) + }, nil) + if err != nil { + return ArmSecurityStandardsClientListResponse{}, err + } + return client.listHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listCreateRequest creates the List request. +func (client *ArmSecurityStandardsClient) listCreateRequest(ctx context.Context, scope string, _ *ArmSecurityStandardsClientListOptions) (*policy.Request, error) { + urlPath := "/{scope}/providers/Microsoft.Security/securityStandards" + if scope == "" { + return nil, errors.New("parameter scope cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2024-08-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listHandleResponse handles the List response. +func (client *ArmSecurityStandardsClient) listHandleResponse(resp *http.Response) (ArmSecurityStandardsClientListResponse, error) { + result := ArmSecurityStandardsClientListResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.StandardList); err != nil { + return ArmSecurityStandardsClientListResponse{}, err + } + return result, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/client_factory.go b/sdk/resourcemanager/security/armsecurity/client_factory.go index d82142ce65f5..28ff4927568a 100644 --- a/sdk/resourcemanager/security/armsecurity/client_factory.go +++ b/sdk/resourcemanager/security/armsecurity/client_factory.go @@ -87,6 +87,13 @@ func (c *ClientFactory) NewApplicationsClient() *ApplicationsClient { } } +// NewArmSecurityStandardsClient creates a new instance of ArmSecurityStandardsClient. +func (c *ClientFactory) NewArmSecurityStandardsClient() *ArmSecurityStandardsClient { + return &ArmSecurityStandardsClient{ + internal: c.internal, + } +} + // NewAssessmentsClient creates a new instance of AssessmentsClient. func (c *ClientFactory) NewAssessmentsClient() *AssessmentsClient { return &AssessmentsClient{ @@ -573,13 +580,6 @@ func (c *ClientFactory) NewStandardAssignmentsClient() *StandardAssignmentsClien } } -// NewStandardsClient creates a new instance of StandardsClient. -func (c *ClientFactory) NewStandardsClient() *StandardsClient { - return &StandardsClient{ - internal: c.internal, - } -} - // NewStandardsClient creates a new instance of StandardsClient. func (c *ClientFactory) NewStandardsClient() *StandardsClient { return &StandardsClient{ diff --git a/sdk/resourcemanager/security/armsecurity/constants.go b/sdk/resourcemanager/security/armsecurity/constants.go index 984c7f1bf767..f71a85c22cf8 100644 --- a/sdk/resourcemanager/security/armsecurity/constants.go +++ b/sdk/resourcemanager/security/armsecurity/constants.go @@ -49,30 +49,6 @@ func PossibleActionTypeValues() []ActionType { } } -// ActionType - Enum. Indicates the action type. -type ActionType string - -const ( - // ActionTypeEventHub - EventHub - ActionTypeEventHub ActionType = "EventHub" - // ActionTypeInternal - Internal - ActionTypeInternal ActionType = "Internal" - // ActionTypeLogicApp - LogicApp - ActionTypeLogicApp ActionType = "LogicApp" - // ActionTypeWorkspace - Workspace - ActionTypeWorkspace ActionType = "Workspace" -) - -// PossibleActionTypeValues returns the possible values for the ActionType const type. -func PossibleActionTypeValues() []ActionType { - return []ActionType{ - ActionTypeEventHub, - ActionTypeInternal, - ActionTypeLogicApp, - ActionTypeWorkspace, - } -} - // ActionableRemediationState - ActionableRemediation Setting. // None - the setting was never set. // Enabled - ActionableRemediation is enabled. @@ -234,6 +210,21 @@ func PossibleApplicationSourceResourceTypeValues() []ApplicationSourceResourceTy } } +// ArmActionType - Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. +type ArmActionType string + +const ( + // ArmActionTypeInternal - Actions are for internal-only APIs. + ArmActionTypeInternal ArmActionType = "Internal" +) + +// PossibleArmActionTypeValues returns the possible values for the ArmActionType const type. +func PossibleArmActionTypeValues() []ArmActionType { + return []ArmActionType{ + ArmActionTypeInternal, + } +} + // AssessedResourceType - Sub-assessment resource type type AssessedResourceType string diff --git a/sdk/resourcemanager/security/armsecurity/fake/armsecuritystandards_server.go b/sdk/resourcemanager/security/armsecurity/fake/armsecuritystandards_server.go new file mode 100644 index 000000000000..60da0bde7b6d --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/fake/armsecuritystandards_server.go @@ -0,0 +1,247 @@ +// 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) Go Code Generator. DO NOT EDIT. + +package fake + +import ( + "context" + "errors" + "fmt" + azfake "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/fake/server" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" + "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurity" + "net/http" + "net/url" + "regexp" + "slices" +) + +// ArmSecurityStandardsServer is a fake server for instances of the armsecurity.ArmSecurityStandardsClient type. +type ArmSecurityStandardsServer struct { + // CreateOrUpdate is the fake for method ArmSecurityStandardsClient.CreateOrUpdate + // HTTP status codes to indicate success: http.StatusOK, http.StatusCreated + CreateOrUpdate func(ctx context.Context, scope string, standardID string, standard armsecurity.ArmSecurityStandard, options *armsecurity.ArmSecurityStandardsClientCreateOrUpdateOptions) (resp azfake.Responder[armsecurity.ArmSecurityStandardsClientCreateOrUpdateResponse], errResp azfake.ErrorResponder) + + // Delete is the fake for method ArmSecurityStandardsClient.Delete + // HTTP status codes to indicate success: http.StatusOK, http.StatusNoContent + Delete func(ctx context.Context, scope string, standardID string, options *armsecurity.ArmSecurityStandardsClientDeleteOptions) (resp azfake.Responder[armsecurity.ArmSecurityStandardsClientDeleteResponse], errResp azfake.ErrorResponder) + + // Get is the fake for method ArmSecurityStandardsClient.Get + // HTTP status codes to indicate success: http.StatusOK + Get func(ctx context.Context, scope string, standardID string, options *armsecurity.ArmSecurityStandardsClientGetOptions) (resp azfake.Responder[armsecurity.ArmSecurityStandardsClientGetResponse], errResp azfake.ErrorResponder) + + // NewListPager is the fake for method ArmSecurityStandardsClient.NewListPager + // HTTP status codes to indicate success: http.StatusOK + NewListPager func(scope string, options *armsecurity.ArmSecurityStandardsClientListOptions) (resp azfake.PagerResponder[armsecurity.ArmSecurityStandardsClientListResponse]) +} + +// NewArmSecurityStandardsServerTransport creates a new instance of ArmSecurityStandardsServerTransport with the provided implementation. +// The returned ArmSecurityStandardsServerTransport instance is connected to an instance of armsecurity.ArmSecurityStandardsClient via the +// azcore.ClientOptions.Transporter field in the client's constructor parameters. +func NewArmSecurityStandardsServerTransport(srv *ArmSecurityStandardsServer) *ArmSecurityStandardsServerTransport { + return &ArmSecurityStandardsServerTransport{ + srv: srv, + newListPager: newTracker[azfake.PagerResponder[armsecurity.ArmSecurityStandardsClientListResponse]](), + } +} + +// ArmSecurityStandardsServerTransport connects instances of armsecurity.ArmSecurityStandardsClient to instances of ArmSecurityStandardsServer. +// Don't use this type directly, use NewArmSecurityStandardsServerTransport instead. +type ArmSecurityStandardsServerTransport struct { + srv *ArmSecurityStandardsServer + newListPager *tracker[azfake.PagerResponder[armsecurity.ArmSecurityStandardsClientListResponse]] +} + +// Do implements the policy.Transporter interface for ArmSecurityStandardsServerTransport. +func (a *ArmSecurityStandardsServerTransport) Do(req *http.Request) (*http.Response, error) { + rawMethod := req.Context().Value(runtime.CtxAPINameKey{}) + method, ok := rawMethod.(string) + if !ok { + return nil, nonRetriableError{errors.New("unable to dispatch request, missing value for CtxAPINameKey")} + } + + return a.dispatchToMethodFake(req, method) +} + +func (a *ArmSecurityStandardsServerTransport) dispatchToMethodFake(req *http.Request, method string) (*http.Response, error) { + resultChan := make(chan result, 1) + go func() { + var intercepted bool + var res result + if armSecurityStandardsServerTransportInterceptor != nil { + res.resp, res.err, intercepted = armSecurityStandardsServerTransportInterceptor.Do(req) + } + if !intercepted { + switch method { + case "ArmSecurityStandardsClient.CreateOrUpdate": + res.resp, res.err = a.dispatchCreateOrUpdate(req) + case "ArmSecurityStandardsClient.Delete": + res.resp, res.err = a.dispatchDelete(req) + case "ArmSecurityStandardsClient.Get": + res.resp, res.err = a.dispatchGet(req) + case "ArmSecurityStandardsClient.NewListPager": + res.resp, res.err = a.dispatchNewListPager(req) + default: + res.err = fmt.Errorf("unhandled API %s", method) + } + + } + resultChan <- res + }() + + select { + case <-req.Context().Done(): + return nil, req.Context().Err() + case res := <-resultChan: + return res.resp, res.err + } +} + +func (a *ArmSecurityStandardsServerTransport) dispatchCreateOrUpdate(req *http.Request) (*http.Response, error) { + if a.srv.CreateOrUpdate == nil { + return nil, &nonRetriableError{errors.New("fake for method CreateOrUpdate not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityStandards/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + body, err := server.UnmarshalRequestAsJSON[armsecurity.ArmSecurityStandard](req) + if err != nil { + return nil, err + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + standardIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("standardId")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.CreateOrUpdate(req.Context(), scopeParam, standardIDParam, body, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK, http.StatusCreated}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusCreated", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ArmSecurityStandard, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ArmSecurityStandardsServerTransport) dispatchDelete(req *http.Request) (*http.Response, error) { + if a.srv.Delete == nil { + return nil, &nonRetriableError{errors.New("fake for method Delete not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityStandards/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + standardIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("standardId")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Delete(req.Context(), scopeParam, standardIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK, http.StatusNoContent}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK, http.StatusNoContent", respContent.HTTPStatus)} + } + resp, err := server.NewResponse(respContent, req, nil) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ArmSecurityStandardsServerTransport) dispatchGet(req *http.Request) (*http.Response, error) { + if a.srv.Get == nil { + return nil, &nonRetriableError{errors.New("fake for method Get not implemented")} + } + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityStandards/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 3 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + standardIDParam, err := url.PathUnescape(matches[regex.SubexpIndex("standardId")]) + if err != nil { + return nil, err + } + respr, errRespr := a.srv.Get(req.Context(), scopeParam, standardIDParam, nil) + if respErr := server.GetError(errRespr, req); respErr != nil { + return nil, respErr + } + respContent := server.GetResponseContent(respr) + if !slices.Contains([]int{http.StatusOK}, respContent.HTTPStatus) { + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", respContent.HTTPStatus)} + } + resp, err := server.MarshalResponseAsJSON(respContent, server.GetResponse(respr).ArmSecurityStandard, req) + if err != nil { + return nil, err + } + return resp, nil +} + +func (a *ArmSecurityStandardsServerTransport) dispatchNewListPager(req *http.Request) (*http.Response, error) { + if a.srv.NewListPager == nil { + return nil, &nonRetriableError{errors.New("fake for method NewListPager not implemented")} + } + newListPager := a.newListPager.get(req) + if newListPager == nil { + const regexStr = `/(?P[!#&$-;=?-\[\]_a-zA-Z0-9~%@]+)/providers/Microsoft\.Security/securityStandards` + regex := regexp.MustCompile(regexStr) + matches := regex.FindStringSubmatch(req.URL.EscapedPath()) + if len(matches) < 2 { + return nil, fmt.Errorf("failed to parse path %s", req.URL.Path) + } + scopeParam, err := url.PathUnescape(matches[regex.SubexpIndex("scope")]) + if err != nil { + return nil, err + } + resp := a.srv.NewListPager(scopeParam, nil) + newListPager = &resp + a.newListPager.add(req, newListPager) + server.PagerResponderInjectNextLinks(newListPager, req, func(page *armsecurity.ArmSecurityStandardsClientListResponse, createLink func() string) { + page.NextLink = to.Ptr(createLink()) + }) + } + resp, err := server.PagerResponderNext(newListPager, req) + if err != nil { + return nil, err + } + if !slices.Contains([]int{http.StatusOK}, resp.StatusCode) { + a.newListPager.remove(req) + return nil, &nonRetriableError{fmt.Errorf("unexpected status code %d. acceptable values are http.StatusOK", resp.StatusCode)} + } + if !server.PagerResponderMore(newListPager) { + a.newListPager.remove(req) + } + return resp, nil +} + +// set this to conditionally intercept incoming requests to ArmSecurityStandardsServerTransport +var armSecurityStandardsServerTransportInterceptor interface { + // Do returns true if the server transport should use the returned response/error + Do(*http.Request) (*http.Response, error, bool) +} diff --git a/sdk/resourcemanager/security/armsecurity/fake/server_factory.go b/sdk/resourcemanager/security/armsecurity/fake/server_factory.go index d30e36a90176..17a45298623e 100644 --- a/sdk/resourcemanager/security/armsecurity/fake/server_factory.go +++ b/sdk/resourcemanager/security/armsecurity/fake/server_factory.go @@ -36,6 +36,9 @@ type ServerFactory struct { // ApplicationsServer contains the fakes for client ApplicationsClient ApplicationsServer ApplicationsServer + // ArmSecurityStandardsServer contains the fakes for client ArmSecurityStandardsClient + ArmSecurityStandardsServer ArmSecurityStandardsServer + // AssessmentsServer contains the fakes for client AssessmentsClient AssessmentsServer AssessmentsServer @@ -228,9 +231,6 @@ type ServerFactory struct { // StandardsServer contains the fakes for client StandardsClient StandardsServer StandardsServer - // StandardsServer contains the fakes for client StandardsClient - StandardsServer StandardsServer - // SubAssessmentsServer contains the fakes for client SubAssessmentsClient SubAssessmentsServer SubAssessmentsServer @@ -265,6 +265,7 @@ type ServerFactoryTransport struct { trAllowedConnectionsServer *AllowedConnectionsServerTransport trApplicationServer *ApplicationServerTransport trApplicationsServer *ApplicationsServerTransport + trArmSecurityStandardsServer *ArmSecurityStandardsServerTransport trAssessmentsServer *AssessmentsServerTransport trAssessmentsMetadataServer *AssessmentsMetadataServerTransport trAssignmentsServer *AssignmentsServerTransport @@ -329,7 +330,6 @@ type ServerFactoryTransport struct { trSolutionsReferenceDataServer *SolutionsReferenceDataServerTransport trStandardAssignmentsServer *StandardAssignmentsServerTransport trStandardsServer *StandardsServerTransport - trStandardsServer *StandardsServerTransport trSubAssessmentsServer *SubAssessmentsServerTransport trTasksServer *TasksServerTransport trTopologyServer *TopologyServerTransport @@ -378,6 +378,11 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "ApplicationsClient": initServer(&s.trMu, &s.trApplicationsServer, func() *ApplicationsServerTransport { return NewApplicationsServerTransport(&s.srv.ApplicationsServer) }) resp, err = s.trApplicationsServer.Do(req) + case "ArmSecurityStandardsClient": + initServer(&s.trMu, &s.trArmSecurityStandardsServer, func() *ArmSecurityStandardsServerTransport { + return NewArmSecurityStandardsServerTransport(&s.srv.ArmSecurityStandardsServer) + }) + resp, err = s.trArmSecurityStandardsServer.Do(req) case "AssessmentsClient": initServer(&s.trMu, &s.trAssessmentsServer, func() *AssessmentsServerTransport { return NewAssessmentsServerTransport(&s.srv.AssessmentsServer) }) resp, err = s.trAssessmentsServer.Do(req) @@ -660,9 +665,6 @@ func (s *ServerFactoryTransport) Do(req *http.Request) (*http.Response, error) { case "StandardsClient": initServer(&s.trMu, &s.trStandardsServer, func() *StandardsServerTransport { return NewStandardsServerTransport(&s.srv.StandardsServer) }) resp, err = s.trStandardsServer.Do(req) - case "StandardsClient": - initServer(&s.trMu, &s.trStandardsServer, func() *StandardsServerTransport { return NewStandardsServerTransport(&s.srv.StandardsServer) }) - resp, err = s.trStandardsServer.Do(req) case "SubAssessmentsClient": initServer(&s.trMu, &s.trSubAssessmentsServer, func() *SubAssessmentsServerTransport { return NewSubAssessmentsServerTransport(&s.srv.SubAssessmentsServer) diff --git a/sdk/resourcemanager/security/armsecurity/interfaces.go b/sdk/resourcemanager/security/armsecurity/interfaces.go index d4e4555a1134..7d4ea418ef1d 100644 --- a/sdk/resourcemanager/security/armsecurity/interfaces.go +++ b/sdk/resourcemanager/security/armsecurity/interfaces.go @@ -72,6 +72,15 @@ type CloudOfferingClassification interface { GetCloudOffering() *CloudOffering } +// CommonResourceDetailsClassification provides polymorphic access to related types. +// Call the interface's GetCommonResourceDetails() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureResourceDetails, *CommonResourceDetails, *OnPremiseResourceDetails, *OnPremiseSQLResourceDetails +type CommonResourceDetailsClassification interface { + // GetCommonResourceDetails returns the CommonResourceDetails content of the underlying type. + GetCommonResourceDetails() *CommonResourceDetails +} + // 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: @@ -140,20 +149,11 @@ type NotificationsSourceClassification interface { // Use a type switch to determine the concrete type. The possible types are: // - *OnPremiseResourceDetails, *OnPremiseSQLResourceDetails type OnPremiseResourceDetailsClassification interface { - ResourceDetailsClassification + CommonResourceDetailsClassification // GetOnPremiseResourceDetails returns the OnPremiseResourceDetails content of the underlying type. GetOnPremiseResourceDetails() *OnPremiseResourceDetails } -// ResourceDetailsClassification provides polymorphic access to related types. -// Call the interface's GetResourceDetails() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *AzureResourceDetails, *OnPremiseResourceDetails, *OnPremiseSQLResourceDetails, *ResourceDetails -type ResourceDetailsClassification interface { - // GetResourceDetails returns the ResourceDetails content of the underlying type. - GetResourceDetails() *ResourceDetails -} - // ResourceIdentifierClassification provides polymorphic access to related types. // Call the interface's GetResourceIdentifier() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: diff --git a/sdk/resourcemanager/security/armsecurity/models.go b/sdk/resourcemanager/security/armsecurity/models.go index 30b5b9c8016e..d69879c48b62 100644 --- a/sdk/resourcemanager/security/armsecurity/models.go +++ b/sdk/resourcemanager/security/armsecurity/models.go @@ -892,6 +892,15 @@ type ArmSecurityStandard struct { Type *string } +// ArmSecurityStandardList - Page of a Standard list +type ArmSecurityStandardList struct { + // READ-ONLY; The URI to fetch the next page + NextLink *string + + // READ-ONLY; Collection of standards in this page + Value []*Standard +} + // ArmSecurityStandardProperties - Describes properties of a standard. type ArmSecurityStandardProperties struct { // List of assessment keys to apply to standard scope. @@ -1109,7 +1118,7 @@ type AssessmentPartnerData struct { // AssessmentProperties - Describes properties of an assessment. type AssessmentProperties struct { // REQUIRED; Details of the resource that was assessed - ResourceDetails ResourceDetailsClassification + ResourceDetails CommonResourceDetailsClassification // REQUIRED; The result of the assessment Status *AssessmentStatus @@ -1180,7 +1189,7 @@ type AssessmentPropertiesBaseRiskPathsItemNodesItem struct { // AssessmentPropertiesResponse - Describes properties of an assessment. type AssessmentPropertiesResponse struct { // REQUIRED; Details of the resource that was assessed - ResourceDetails ResourceDetailsClassification + ResourceDetails CommonResourceDetailsClassification // REQUIRED; The result of the assessment Status *AssessmentStatusResponse @@ -1939,13 +1948,10 @@ type AzureResourceDetails struct { ID *string } -// GetResourceDetails implements the ResourceDetailsClassification interface for type AzureResourceDetails. -func (a *AzureResourceDetails) GetResourceDetails() *ResourceDetails { - return &ResourceDetails{ - ConnectorID: a.ConnectorID, - ID: a.ID, - Source: a.Source, - Source: a.Source, +// GetCommonResourceDetails implements the CommonResourceDetailsClassification interface for type AzureResourceDetails. +func (a *AzureResourceDetails) GetCommonResourceDetails() *CommonResourceDetails { + return &CommonResourceDetails{ + Source: a.Source, } } @@ -2161,6 +2167,15 @@ type CloudOffering struct { // GetCloudOffering implements the CloudOfferingClassification interface for type CloudOffering. func (c *CloudOffering) GetCloudOffering() *CloudOffering { return c } +// CommonResourceDetails - Details of the resource that was assessed +type CommonResourceDetails struct { + // REQUIRED; The platform where the assessed resource resides + Source *Source +} + +// GetCommonResourceDetails implements the CommonResourceDetailsClassification interface for type CommonResourceDetails. +func (c *CommonResourceDetails) GetCommonResourceDetails() *CommonResourceDetails { return c } + // Compliance of a scope type Compliance struct { // Compliance data @@ -6098,19 +6113,16 @@ type OnPremiseResourceDetails struct { WorkspaceID *string } -// GetOnPremiseResourceDetails implements the OnPremiseResourceDetailsClassification interface for type OnPremiseResourceDetails. -func (o *OnPremiseResourceDetails) GetOnPremiseResourceDetails() *OnPremiseResourceDetails { return o } - -// GetResourceDetails implements the ResourceDetailsClassification interface for type OnPremiseResourceDetails. -func (o *OnPremiseResourceDetails) GetResourceDetails() *ResourceDetails { - return &ResourceDetails{ - ConnectorID: o.ConnectorID, - ID: o.ID, - Source: o.Source, - Source: o.Source, +// GetCommonResourceDetails implements the CommonResourceDetailsClassification interface for type OnPremiseResourceDetails. +func (o *OnPremiseResourceDetails) GetCommonResourceDetails() *CommonResourceDetails { + return &CommonResourceDetails{ + Source: o.Source, } } +// GetOnPremiseResourceDetails implements the OnPremiseResourceDetailsClassification interface for type OnPremiseResourceDetails. +func (o *OnPremiseResourceDetails) GetOnPremiseResourceDetails() *OnPremiseResourceDetails { return o } + // OnPremiseSQLResourceDetails - Details of the On Premise Sql resource that was assessed type OnPremiseSQLResourceDetails struct { // REQUIRED; The Sql database name installed on the machine @@ -6136,6 +6148,13 @@ type OnPremiseSQLResourceDetails struct { WorkspaceID *string } +// GetCommonResourceDetails implements the CommonResourceDetailsClassification interface for type OnPremiseSQLResourceDetails. +func (o *OnPremiseSQLResourceDetails) GetCommonResourceDetails() *CommonResourceDetails { + return &CommonResourceDetails{ + Source: o.Source, + } +} + // GetOnPremiseResourceDetails implements the OnPremiseResourceDetailsClassification interface for type OnPremiseSQLResourceDetails. func (o *OnPremiseSQLResourceDetails) GetOnPremiseResourceDetails() *OnPremiseResourceDetails { return &OnPremiseResourceDetails{ @@ -6147,16 +6166,6 @@ func (o *OnPremiseSQLResourceDetails) GetOnPremiseResourceDetails() *OnPremiseRe } } -// GetResourceDetails implements the ResourceDetailsClassification interface for type OnPremiseSQLResourceDetails. -func (o *OnPremiseSQLResourceDetails) GetResourceDetails() *ResourceDetails { - return &ResourceDetails{ - ConnectorID: o.ConnectorID, - ID: o.ID, - Source: o.Source, - Source: o.Source, - } -} - // OnUploadFilters - Optional. Determine which blobs get scanned by On Upload malware scanning. An Or operation is performed // between each filter type. type OnUploadFilters struct { @@ -6197,7 +6206,7 @@ type Operation struct { Display *OperationDisplay // READ-ONLY; Extensible enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. - ActionType *ActionType + ActionType *ArmActionType // READ-ONLY; Whether the operation applies to data-plane. This is "true" for data-plane operations and "false" for Azure // Resource Manager/control-plane operations. @@ -6860,31 +6869,13 @@ type RemediationEta struct { // ResourceDetails - The resource details of the health report type ResourceDetails struct { - // REQUIRED; REQUIRED; The platform where the assessed resource resides - Source *Source - // The status of the health report Source *Source - // READ-ONLY; READ-ONLY; The id of the connector + // READ-ONLY; The id of the connector ConnectorID *string - // READ-ONLY; READ-ONLY; The azure id of the resource - ID *string -} - -// ResourceDetails - The resource details of the health report -type ResourceDetails struct { - // REQUIRED; REQUIRED; The platform where the assessed resource resides - Source *Source - - // The status of the health report - Source *Source - - // READ-ONLY; READ-ONLY; The id of the connector - ConnectorID *string - - // READ-ONLY; READ-ONLY; The azure id of the resource + // READ-ONLY; The azure id of the resource ID *string } @@ -7720,32 +7711,11 @@ type StandardComponentProperties struct { // StandardList - Page of a Standard list type StandardList struct { - // READ-ONLY; READ-ONLY; Collection of standards in this page - Value []*ArmSecurityStandard - - // READ-ONLY; READ-ONLY; The URI to fetch the next page - NextLink *string - - // READ-ONLY; READ-ONLY; The URI to fetch the next page - NextLink *string - - // READ-ONLY; READ-ONLY; Collection of standards in this page - Value []*Standard -} - -// StandardList - Page of a Standard list -type StandardList struct { - // READ-ONLY; READ-ONLY; Collection of standards in this page + // READ-ONLY; Collection of standards in this page Value []*ArmSecurityStandard - // READ-ONLY; READ-ONLY; The URI to fetch the next page - NextLink *string - - // READ-ONLY; READ-ONLY; The URI to fetch the next page + // READ-ONLY; The URI to fetch the next page NextLink *string - - // READ-ONLY; READ-ONLY; Collection of standards in this page - Value []*Standard } // StandardMetadata - The standard metadata @@ -7836,7 +7806,7 @@ type SubAssessmentProperties struct { AdditionalData AdditionalDataClassification // Details of the resource that was assessed - ResourceDetails ResourceDetailsClassification + ResourceDetails CommonResourceDetailsClassification // Status of the sub-assessment Status *SubAssessmentStatus diff --git a/sdk/resourcemanager/security/armsecurity/models_serde.go b/sdk/resourcemanager/security/armsecurity/models_serde.go index 8b89c7746204..c48c4df33409 100644 --- a/sdk/resourcemanager/security/armsecurity/models_serde.go +++ b/sdk/resourcemanager/security/armsecurity/models_serde.go @@ -1698,6 +1698,37 @@ func (a *ArmSecurityStandard) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type ArmSecurityStandardList. +func (a ArmSecurityStandardList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", a.NextLink) + populate(objectMap, "value", a.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ArmSecurityStandardList. +func (a *ArmSecurityStandardList) UnmarshalJSON(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 ArmSecurityStandardProperties. func (a ArmSecurityStandardProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -2292,7 +2323,7 @@ func (a *AssessmentProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "PartnersData", &a.PartnersData) delete(rawMsg, key) case "resourceDetails": - a.ResourceDetails, err = unmarshalResourceDetailsClassification(val) + a.ResourceDetails, err = unmarshalCommonResourceDetailsClassification(val) delete(rawMsg, key) case "risk": err = unpopulate(val, "Risk", &a.Risk) @@ -2491,7 +2522,7 @@ func (a *AssessmentPropertiesResponse) UnmarshalJSON(data []byte) error { err = unpopulate(val, "PartnersData", &a.PartnersData) delete(rawMsg, key) case "resourceDetails": - a.ResourceDetails, err = unmarshalResourceDetailsClassification(val) + a.ResourceDetails, err = unmarshalCommonResourceDetailsClassification(val) delete(rawMsg, key) case "risk": err = unpopulate(val, "Risk", &a.Risk) @@ -4725,6 +4756,33 @@ func (c *CloudOffering) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type CommonResourceDetails. +func (c CommonResourceDetails) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "source", c.Source) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommonResourceDetails. +func (c *CommonResourceDetails) UnmarshalJSON(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 "source": + err = unpopulate(val, "Source", &c.Source) + 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]any) @@ -14610,46 +14668,6 @@ func (r ResourceDetails) MarshalJSON() ([]byte, error) { populate(objectMap, "connectorId", r.ConnectorID) populate(objectMap, "id", r.ID) populate(objectMap, "source", r.Source) - populate(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 "connectorId": - err = unpopulate(val, "ConnectorID", &r.ConnectorID) - delete(rawMsg, key) - case "id": - err = unpopulate(val, "ID", &r.ID) - delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &r.Source) - delete(rawMsg, 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 ResourceDetails. -func (r ResourceDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "connectorId", r.ConnectorID) - populate(objectMap, "id", r.ID) - populate(objectMap, "source", r.Source) - populate(objectMap, "source", r.Source) return json.Marshal(objectMap) } @@ -14671,9 +14689,6 @@ func (r *ResourceDetails) UnmarshalJSON(data []byte) error { case "source": err = unpopulate(val, "Source", &r.Source) delete(rawMsg, key) - case "source": - err = unpopulate(val, "Source", &r.Source) - delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", r, err) @@ -16814,8 +16829,6 @@ func (s *StandardComponentProperties) UnmarshalJSON(data []byte) error { func (s StandardList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } @@ -16832,51 +16845,6 @@ func (s *StandardList) UnmarshalJSON(data []byte) error { case "nextLink": err = unpopulate(val, "NextLink", &s.NextLink) delete(rawMsg, key) - case "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - 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 StandardList. -func (s StandardList) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "nextLink", s.NextLink) - populate(objectMap, "value", s.Value) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StandardList. -func (s *StandardList) UnmarshalJSON(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 "nextLink": - err = unpopulate(val, "NextLink", &s.NextLink) - delete(rawMsg, key) - case "value": - err = unpopulate(val, "Value", &s.Value) - delete(rawMsg, key) case "value": err = unpopulate(val, "Value", &s.Value) delete(rawMsg, key) @@ -17138,7 +17106,7 @@ func (s *SubAssessmentProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, "Remediation", &s.Remediation) delete(rawMsg, key) case "resourceDetails": - s.ResourceDetails, err = unmarshalResourceDetailsClassification(val) + s.ResourceDetails, err = unmarshalCommonResourceDetailsClassification(val) delete(rawMsg, key) case "status": err = unpopulate(val, "Status", &s.Status) diff --git a/sdk/resourcemanager/security/armsecurity/options.go b/sdk/resourcemanager/security/armsecurity/options.go index f7013e654e90..b6eafdf578f0 100644 --- a/sdk/resourcemanager/security/armsecurity/options.go +++ b/sdk/resourcemanager/security/armsecurity/options.go @@ -199,6 +199,28 @@ type ApplicationsClientListOptions struct { // placeholder for future optional parameters } +// ArmSecurityStandardsClientCreateOrUpdateOptions contains the optional parameters for the ArmSecurityStandardsClient.CreateOrUpdate +// method. +type ArmSecurityStandardsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// ArmSecurityStandardsClientDeleteOptions contains the optional parameters for the ArmSecurityStandardsClient.Delete method. +type ArmSecurityStandardsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// ArmSecurityStandardsClientGetOptions contains the optional parameters for the ArmSecurityStandardsClient.Get method. +type ArmSecurityStandardsClientGetOptions struct { + // placeholder for future optional parameters +} + +// ArmSecurityStandardsClientListOptions contains the optional parameters for the ArmSecurityStandardsClient.NewListPager +// method. +type ArmSecurityStandardsClientListOptions struct { + // placeholder for future optional parameters +} + // AssessmentsClientCreateOrUpdateOptions contains the optional parameters for the AssessmentsClient.CreateOrUpdate method. type AssessmentsClientCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -1394,16 +1416,6 @@ type StandardsClientCreateOrUpdateOptions struct { // placeholder for future optional parameters } -// StandardsClientCreateOrUpdateOptions contains the optional parameters for the StandardsClient.CreateOrUpdate method. -type StandardsClientCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// StandardsClientDeleteOptions contains the optional parameters for the StandardsClient.Delete method. -type StandardsClientDeleteOptions struct { - // placeholder for future optional parameters -} - // StandardsClientDeleteOptions contains the optional parameters for the StandardsClient.Delete method. type StandardsClientDeleteOptions struct { // placeholder for future optional parameters @@ -1414,11 +1426,6 @@ type StandardsClientGetOptions struct { // placeholder for future optional parameters } -// StandardsClientGetOptions contains the optional parameters for the StandardsClient.Get method. -type StandardsClientGetOptions struct { - // placeholder for future optional parameters -} - // StandardsClientListBySubscriptionOptions contains the optional parameters for the StandardsClient.NewListBySubscriptionPager // method. type StandardsClientListBySubscriptionOptions struct { @@ -1430,11 +1437,6 @@ type StandardsClientListOptions struct { // placeholder for future optional parameters } -// StandardsClientListOptions contains the optional parameters for the StandardsClient.NewListPager method. -type StandardsClientListOptions struct { - // placeholder for future optional parameters -} - // SubAssessmentsClientGetOptions contains the optional parameters for the SubAssessmentsClient.Get method. type SubAssessmentsClientGetOptions struct { // placeholder for future optional parameters diff --git a/sdk/resourcemanager/security/armsecurity/polymorphic_helpers.go b/sdk/resourcemanager/security/armsecurity/polymorphic_helpers.go index d1f2e6f8044b..d46598020c59 100644 --- a/sdk/resourcemanager/security/armsecurity/polymorphic_helpers.go +++ b/sdk/resourcemanager/security/armsecurity/polymorphic_helpers.go @@ -262,6 +262,31 @@ func unmarshalCloudOfferingClassificationArray(rawMsg json.RawMessage) ([]CloudO return fArray, nil } +func unmarshalCommonResourceDetailsClassification(rawMsg json.RawMessage) (CommonResourceDetailsClassification, error) { + if rawMsg == nil || string(rawMsg) == "null" { + return nil, nil + } + var m map[string]any + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b CommonResourceDetailsClassification + switch m["source"] { + case string(SourceAzure): + b = &AzureResourceDetails{} + case string(SourceOnPremiseResourceDetails): + b = &OnPremiseResourceDetails{} + case string(SourceOnPremiseSQL): + b = &OnPremiseSQLResourceDetails{} + default: + b = &CommonResourceDetails{} + } + if err := json.Unmarshal(rawMsg, b); err != nil { + return nil, err + } + return b, nil +} + func unmarshalEnvironmentDataClassification(rawMsg json.RawMessage) (EnvironmentDataClassification, error) { if rawMsg == nil || string(rawMsg) == "null" { return nil, nil @@ -404,31 +429,6 @@ func unmarshalNotificationsSourceClassificationArray(rawMsg json.RawMessage) ([] return fArray, nil } -func unmarshalResourceDetailsClassification(rawMsg json.RawMessage) (ResourceDetailsClassification, error) { - if rawMsg == nil || string(rawMsg) == "null" { - return nil, nil - } - var m map[string]any - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b ResourceDetailsClassification - switch m["source"] { - case string(SourceAzure): - b = &AzureResourceDetails{} - case string(SourceOnPremiseResourceDetails): - b = &OnPremiseResourceDetails{} - case string(SourceOnPremiseSQL): - b = &OnPremiseSQLResourceDetails{} - default: - b = &ResourceDetails{} - } - if err := json.Unmarshal(rawMsg, b); err != nil { - return nil, err - } - return b, nil -} - func unmarshalResourceIdentifierClassification(rawMsg json.RawMessage) (ResourceIdentifierClassification, error) { if rawMsg == nil || string(rawMsg) == "null" { return nil, nil diff --git a/sdk/resourcemanager/security/armsecurity/responses.go b/sdk/resourcemanager/security/armsecurity/responses.go index af2be3887ac7..46dc5e49f058 100644 --- a/sdk/resourcemanager/security/armsecurity/responses.go +++ b/sdk/resourcemanager/security/armsecurity/responses.go @@ -196,6 +196,29 @@ type ApplicationsClientListResponse struct { ApplicationsList } +// ArmSecurityStandardsClientCreateOrUpdateResponse contains the response from method ArmSecurityStandardsClient.CreateOrUpdate. +type ArmSecurityStandardsClientCreateOrUpdateResponse struct { + // Security Standard on a resource + ArmSecurityStandard +} + +// ArmSecurityStandardsClientDeleteResponse contains the response from method ArmSecurityStandardsClient.Delete. +type ArmSecurityStandardsClientDeleteResponse struct { + // placeholder for future response values +} + +// ArmSecurityStandardsClientGetResponse contains the response from method ArmSecurityStandardsClient.Get. +type ArmSecurityStandardsClientGetResponse struct { + // Security Standard on a resource + ArmSecurityStandard +} + +// ArmSecurityStandardsClientListResponse contains the response from method ArmSecurityStandardsClient.NewListPager. +type ArmSecurityStandardsClientListResponse struct { + // Page of a Standard list + StandardList +} + // AssessmentsClientCreateOrUpdateResponse contains the response from method AssessmentsClient.CreateOrUpdate. type AssessmentsClientCreateOrUpdateResponse struct { // Security assessment on a resource - response format @@ -1406,12 +1429,6 @@ type StandardAssignmentsClientListResponse struct { StandardAssignmentsList } -// StandardsClientCreateOrUpdateResponse contains the response from method StandardsClient.CreateOrUpdate. -type StandardsClientCreateOrUpdateResponse struct { - // Security Standard on a resource - ArmSecurityStandard -} - // StandardsClientCreateOrUpdateResponse contains the response from method StandardsClient.CreateOrUpdate. type StandardsClientCreateOrUpdateResponse struct { // Security Standard on a resource @@ -1423,17 +1440,6 @@ type StandardsClientDeleteResponse struct { // placeholder for future response values } -// StandardsClientDeleteResponse contains the response from method StandardsClient.Delete. -type StandardsClientDeleteResponse struct { - // placeholder for future response values -} - -// StandardsClientGetResponse contains the response from method StandardsClient.Get. -type StandardsClientGetResponse struct { - // Security Standard on a resource - ArmSecurityStandard -} - // StandardsClientGetResponse contains the response from method StandardsClient.Get. type StandardsClientGetResponse struct { // Security Standard on a resource @@ -1443,19 +1449,13 @@ type StandardsClientGetResponse struct { // StandardsClientListBySubscriptionResponse contains the response from method StandardsClient.NewListBySubscriptionPager. type StandardsClientListBySubscriptionResponse struct { // Page of a Standard list - StandardList -} - -// StandardsClientListResponse contains the response from method StandardsClient.NewListPager. -type StandardsClientListResponse struct { - // Page of a Standard list - StandardList + ArmSecurityStandardList } // StandardsClientListResponse contains the response from method StandardsClient.NewListPager. type StandardsClientListResponse struct { // Page of a Standard list - StandardList + ArmSecurityStandardList } // SubAssessmentsClientGetResponse contains the response from method SubAssessmentsClient.Get. diff --git a/sdk/resourcemanager/security/armsecurity/standards_client.go b/sdk/resourcemanager/security/armsecurity/standards_client.go index 4f016483b251..406de8aaee00 100644 --- a/sdk/resourcemanager/security/armsecurity/standards_client.go +++ b/sdk/resourcemanager/security/armsecurity/standards_client.go @@ -280,7 +280,7 @@ func (client *StandardsClient) listCreateRequest(ctx context.Context, resourceGr // listHandleResponse handles the List response. func (client *StandardsClient) listHandleResponse(resp *http.Response) (StandardsClientListResponse, error) { result := StandardsClientListResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.StandardList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ArmSecurityStandardList); err != nil { return StandardsClientListResponse{}, err } return result, nil @@ -335,7 +335,7 @@ func (client *StandardsClient) listBySubscriptionCreateRequest(ctx context.Conte // listBySubscriptionHandleResponse handles the ListBySubscription response. func (client *StandardsClient) listBySubscriptionHandleResponse(resp *http.Response) (StandardsClientListBySubscriptionResponse, error) { result := StandardsClientListBySubscriptionResponse{} - if err := runtime.UnmarshalAsJSON(resp, &result.StandardList); err != nil { + if err := runtime.UnmarshalAsJSON(resp, &result.ArmSecurityStandardList); err != nil { return StandardsClientListBySubscriptionResponse{}, err } return result, nil diff --git a/sdk/resourcemanager/security/armsecurity/tsp-location.yaml b/sdk/resourcemanager/security/armsecurity/tsp-location.yaml index e3c989fc535e..7836829f8bb1 100644 --- a/sdk/resourcemanager/security/armsecurity/tsp-location.yaml +++ b/sdk/resourcemanager/security/armsecurity/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/security/resource-manager/Microsoft.Security/Security -commit: f127e37c800e7ba895f4de2cc4b3e9cb6b75ff94 +commit: d01a896e740fde162718aa4416b50cb2994375c2 repo: Azure/azure-rest-api-specs additionalDirectories: From 90eb34bd0d64a83dc9d8a830861a3338607bb961 Mon Sep 17 00:00:00 2001 From: judy <1002946066@qq.com> Date: Thu, 7 May 2026 17:58:18 +0800 Subject: [PATCH 3/5] update test --- .../accountconnectors_client_example_test.go | 418 ------ ...applicationcontrols_client_example_test.go | 1318 ----------------- ...venetworkhardenings_client_example_test.go | 191 --- ...sessmentautomations_client_example_test.go | 270 ---- ...itystoreassignments_client_example_test.go | 227 --- ...tworkaccesspolicies_client_example_test.go | 2 +- .../operators_client_example_test.go | 13 +- 7 files changed, 9 insertions(+), 2430 deletions(-) delete mode 100644 sdk/resourcemanager/security/armsecurity/accountconnectors_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/customassessmentautomations_client_example_test.go delete mode 100644 sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client_example_test.go diff --git a/sdk/resourcemanager/security/armsecurity/accountconnectors_client_example_test.go b/sdk/resourcemanager/security/armsecurity/accountconnectors_client_example_test.go deleted file mode 100644 index 5689389e11a6..000000000000 --- a/sdk/resourcemanager/security/armsecurity/accountconnectors_client_example_test.go +++ /dev/null @@ -1,418 +0,0 @@ -// 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_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/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAccountConnectorsClient().NewListPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.ConnectorSettingList = armsecurity.ConnectorSettingList{ - // Value: []*armsecurity.ConnectorSetting{ - // { - // Name: to.Ptr("aws_dev1"), - // Type: to.Ptr("Microsoft.Security/connectors"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/connectors/aws_dev1"), - // Properties: &armsecurity.ConnectorSettingProperties{ - // AuthenticationDetails: &armsecurity.AwsCredsAuthenticationDetailsProperties{ - // AuthenticationProvisioningState: to.Ptr(armsecurity.AuthenticationProvisioningStateValid), - // AuthenticationType: to.Ptr(armsecurity.AuthenticationTypeAwsCreds), - // GrantedPermissions: []*armsecurity.PermissionProperty{ - // to.Ptr(armsecurity.PermissionPropertyAWSAWSSecurityHubReadOnlyAccess), - // to.Ptr(armsecurity.PermissionPropertyAWSSecurityAudit), - // to.Ptr(armsecurity.PermissionPropertyAWSAmazonSSMAutomationRole)}, - // AccountID: to.Ptr("922315681122"), - // AwsAccessKeyID: to.Ptr(""), - // AwsSecretAccessKey: to.Ptr(""), - // }, - // HybridComputeSettings: &armsecurity.HybridComputeSettingsProperties{ - // AutoProvision: to.Ptr(armsecurity.AutoProvisionOn), - // HybridComputeProvisioningState: to.Ptr(armsecurity.HybridComputeProvisioningStateValid), - // ProxyServer: &armsecurity.ProxyServerProperties{ - // IP: to.Ptr("287.221.107.152"), - // 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"), - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("aws_dev2"), - // Type: to.Ptr("Microsoft.Security/connectors"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/connectors/aws_dev2"), - // Properties: &armsecurity.ConnectorSettingProperties{ - // AuthenticationDetails: &armsecurity.AwAssumeRoleAuthenticationDetailsProperties{ - // AuthenticationProvisioningState: to.Ptr(armsecurity.AuthenticationProvisioningStateValid), - // AuthenticationType: to.Ptr(armsecurity.AuthenticationTypeAwsAssumeRole), - // GrantedPermissions: []*armsecurity.PermissionProperty{ - // to.Ptr(armsecurity.PermissionPropertyAWSAWSSecurityHubReadOnlyAccess), - // to.Ptr(armsecurity.PermissionPropertyAWSSecurityAudit), - // to.Ptr(armsecurity.PermissionPropertyAWSAmazonSSMAutomationRole)}, - // AccountID: to.Ptr("81231569658"), - // 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), - // HybridComputeProvisioningState: to.Ptr(armsecurity.HybridComputeProvisioningStateValid), - // ProxyServer: &armsecurity.ProxyServerProperties{ - // IP: to.Ptr("167.210.187.160"), - // 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"), - // }, - // }, - // }, - // }, - // { - // Name: to.Ptr("gcp_dev"), - // Type: to.Ptr("Microsoft.Security/connectors"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/connectors/gcp_dev"), - // Properties: &armsecurity.ConnectorSettingProperties{ - // AuthenticationDetails: &armsecurity.GcpCredentialsDetailsProperties{ - // AuthenticationProvisioningState: to.Ptr(armsecurity.AuthenticationProvisioningStateValid), - // AuthenticationType: to.Ptr(armsecurity.AuthenticationTypeGcpCredentials), - // GrantedPermissions: []*armsecurity.PermissionProperty{ - // to.Ptr(armsecurity.PermissionPropertyGCPSecurityCenterAdminViewer)}, - // Type: to.Ptr(""), - // AuthProviderX509CertURL: to.Ptr(""), - // AuthURI: to.Ptr(""), - // ClientEmail: to.Ptr(""), - // ClientID: to.Ptr(""), - // ClientX509CertURL: to.Ptr(""), - // OrganizationID: to.Ptr("AscDemoOrg"), - // PrivateKey: to.Ptr(""), - // PrivateKeyID: to.Ptr(""), - // ProjectID: to.Ptr(""), - // TokenURI: to.Ptr(""), - // }, - // HybridComputeSettings: &armsecurity.HybridComputeSettingsProperties{ - // AutoProvision: to.Ptr(armsecurity.AutoProvisionOff), - // HybridComputeProvisioningState: to.Ptr(armsecurity.HybridComputeProvisioningStateInvalid), - // Region: to.Ptr(""), - // ResourceGroupName: to.Ptr(""), - // }, - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountConnectorsClient().Get(ctx, "aws_dev1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectorSetting = armsecurity.ConnectorSetting{ - // Name: to.Ptr("aws_dev1"), - // Type: to.Ptr("Microsoft.Security/connectors"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/connectors/aws_dev1"), - // Properties: &armsecurity.ConnectorSettingProperties{ - // AuthenticationDetails: &armsecurity.AwsCredsAuthenticationDetailsProperties{ - // AuthenticationProvisioningState: to.Ptr(armsecurity.AuthenticationProvisioningStateValid), - // AuthenticationType: to.Ptr(armsecurity.AuthenticationTypeAwsCreds), - // GrantedPermissions: []*armsecurity.PermissionProperty{ - // to.Ptr(armsecurity.PermissionPropertyAWSAWSSecurityHubReadOnlyAccess), - // to.Ptr(armsecurity.PermissionPropertyAWSSecurityAudit), - // to.Ptr(armsecurity.PermissionPropertyAWSAmazonSSMAutomationRole)}, - // AccountID: to.Ptr("922315681122"), - // AwsAccessKeyID: to.Ptr(""), - // AwsSecretAccessKey: to.Ptr(""), - // }, - // HybridComputeSettings: &armsecurity.HybridComputeSettingsProperties{ - // AutoProvision: to.Ptr(armsecurity.AutoProvisionOn), - // HybridComputeProvisioningState: to.Ptr(armsecurity.HybridComputeProvisioningStateValid), - // ProxyServer: &armsecurity.ProxyServerProperties{ - // IP: to.Ptr("287.221.107.152"), - // 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"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/CreateUpdateAwsAssumeRoleConnectorSubscription_example.json -func ExampleAccountConnectorsClient_CreateOrUpdate_awsAssumeRoleCreateACloudAccountConnectorForASubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountConnectorsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectorSetting = armsecurity.ConnectorSetting{ - // Name: to.Ptr("aws_dev2"), - // Type: to.Ptr("Microsoft.Security/connectors"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/connectors/aws_dev2"), - // Properties: &armsecurity.ConnectorSettingProperties{ - // AuthenticationDetails: &armsecurity.AwAssumeRoleAuthenticationDetailsProperties{ - // AuthenticationProvisioningState: to.Ptr(armsecurity.AuthenticationProvisioningStateValid), - // AuthenticationType: to.Ptr(armsecurity.AuthenticationTypeAwsAssumeRole), - // GrantedPermissions: []*armsecurity.PermissionProperty{ - // to.Ptr(armsecurity.PermissionPropertyAWSAWSSecurityHubReadOnlyAccess), - // to.Ptr(armsecurity.PermissionPropertyAWSSecurityAudit), - // to.Ptr(armsecurity.PermissionPropertyAWSAmazonSSMAutomationRole)}, - // AccountID: to.Ptr("81231569658"), - // 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), - // HybridComputeProvisioningState: to.Ptr(armsecurity.HybridComputeProvisioningStateValid), - // 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"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/CreateUpdateAwsCredConnectorSubscription_example.json -func ExampleAccountConnectorsClient_CreateOrUpdate_awsCredCreateACloudAccountConnectorForASubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountConnectorsClient().CreateOrUpdate(ctx, "aws_dev1", armsecurity.ConnectorSetting{ - Properties: &armsecurity.ConnectorSettingProperties{ - AuthenticationDetails: &armsecurity.AwsCredsAuthenticationDetailsProperties{ - AuthenticationType: to.Ptr(armsecurity.AuthenticationTypeAwsCreds), - AwsAccessKeyID: to.Ptr(""), - AwsSecretAccessKey: to.Ptr(""), - }, - 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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectorSetting = armsecurity.ConnectorSetting{ - // Name: to.Ptr("aws_dev1"), - // Type: to.Ptr("Microsoft.Security/connectors"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/connectors/aws_dev1"), - // Properties: &armsecurity.ConnectorSettingProperties{ - // AuthenticationDetails: &armsecurity.AwsCredsAuthenticationDetailsProperties{ - // AuthenticationProvisioningState: to.Ptr(armsecurity.AuthenticationProvisioningStateValid), - // AuthenticationType: to.Ptr(armsecurity.AuthenticationTypeAwsCreds), - // GrantedPermissions: []*armsecurity.PermissionProperty{ - // to.Ptr(armsecurity.PermissionPropertyAWSAWSSecurityHubReadOnlyAccess), - // to.Ptr(armsecurity.PermissionPropertyAWSSecurityAudit), - // to.Ptr(armsecurity.PermissionPropertyAWSAmazonSSMAutomationRole)}, - // AccountID: to.Ptr("922315681122"), - // AwsAccessKeyID: to.Ptr(""), - // AwsSecretAccessKey: to.Ptr(""), - // }, - // HybridComputeSettings: &armsecurity.HybridComputeSettingsProperties{ - // AutoProvision: to.Ptr(armsecurity.AutoProvisionOn), - // HybridComputeProvisioningState: to.Ptr(armsecurity.HybridComputeProvisioningStateValid), - // ProxyServer: &armsecurity.ProxyServerProperties{ - // IP: to.Ptr("287.221.107.152"), - // 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"), - // }, - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/specification/security/resource-manager/Microsoft.Security/preview/2020-01-01-preview/examples/Connectors/CreateUpdateGcpCredentialsConnectorSubscription_example.json -func ExampleAccountConnectorsClient_CreateOrUpdate_gcpCredentialsCreateACloudAccountConnectorForASubscription() { - cred, err := azidentity.NewDefaultAzureCredential(nil) - if err != nil { - log.Fatalf("failed to obtain a credential: %v", err) - } - ctx := context.Background() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAccountConnectorsClient().CreateOrUpdate(ctx, "gcp_dev", armsecurity.ConnectorSetting{ - Properties: &armsecurity.ConnectorSettingProperties{ - AuthenticationDetails: &armsecurity.GcpCredentialsDetailsProperties{ - AuthenticationType: to.Ptr(armsecurity.AuthenticationTypeGcpCredentials), - Type: to.Ptr("service_account"), - AuthProviderX509CertURL: to.Ptr("https://www.googleapis.com/oauth2/v1/certs"), - AuthURI: to.Ptr("https://accounts.google.com/o/oauth2/auth"), - ClientEmail: to.Ptr("asc-135@asc-project-1234.iam.gserviceaccount.com"), - ClientID: to.Ptr("105889053725632919854"), - ClientX509CertURL: to.Ptr("https://www.googleapis.com/robot/v1/metadata/x509/asc-135%40asc-project-1234.iam.gserviceaccount.com"), - OrganizationID: to.Ptr("AscDemoOrg"), - PrivateKey: to.Ptr("******"), - PrivateKeyID: to.Ptr("6efg587hra2568as34d22326b044cc20dc2af"), - ProjectID: to.Ptr("asc-project-1234"), - TokenURI: to.Ptr("https://oauth2.googleapis.com/token"), - }, - HybridComputeSettings: &armsecurity.HybridComputeSettingsProperties{ - AutoProvision: to.Ptr(armsecurity.AutoProvisionOff), - }, - }, - }, nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.ConnectorSetting = armsecurity.ConnectorSetting{ - // Name: to.Ptr("gcp_dev"), - // Type: to.Ptr("Microsoft.Security/connectors"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/connectors/gcp_dev"), - // Properties: &armsecurity.ConnectorSettingProperties{ - // AuthenticationDetails: &armsecurity.GcpCredentialsDetailsProperties{ - // AuthenticationProvisioningState: to.Ptr(armsecurity.AuthenticationProvisioningStateValid), - // AuthenticationType: to.Ptr(armsecurity.AuthenticationTypeGcpCredentials), - // GrantedPermissions: []*armsecurity.PermissionProperty{ - // to.Ptr(armsecurity.PermissionPropertyGCPSecurityCenterAdminViewer)}, - // Type: to.Ptr(""), - // AuthProviderX509CertURL: to.Ptr(""), - // AuthURI: to.Ptr(""), - // ClientEmail: to.Ptr(""), - // ClientID: to.Ptr(""), - // ClientX509CertURL: to.Ptr(""), - // OrganizationID: to.Ptr("AscDemoOrg"), - // PrivateKey: to.Ptr(""), - // PrivateKeyID: to.Ptr(""), - // ProjectID: to.Ptr(""), - // TokenURI: to.Ptr(""), - // }, - // HybridComputeSettings: &armsecurity.HybridComputeSettingsProperties{ - // AutoProvision: to.Ptr(armsecurity.AutoProvisionOff), - // HybridComputeProvisioningState: to.Ptr(armsecurity.HybridComputeProvisioningStateInvalid), - // Region: to.Ptr(""), - // ResourceGroupName: to.Ptr(""), - // }, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAccountConnectorsClient().Delete(ctx, "aws_dev1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client_example_test.go b/sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client_example_test.go deleted file mode 100644 index 19d651175894..000000000000 --- a/sdk/resourcemanager/security/armsecurity/adaptiveapplicationcontrols_client_example_test.go +++ /dev/null @@ -1,1318 +0,0 @@ -// 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_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/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAdaptiveApplicationControlsClient().List(ctx, &armsecurity.AdaptiveApplicationControlsClientListOptions{IncludePathRecommendations: to.Ptr(true), - Summary: to.Ptr(false), - }) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AdaptiveApplicationControlGroups = armsecurity.AdaptiveApplicationControlGroups{ - // Value: []*armsecurity.AdaptiveApplicationControlGroup{ - // { - // Location: to.Ptr("centralus"), - // Name: to.Ptr("AMIT-VA"), - // Type: to.Ptr("Microsoft.Security/applicationWhitelistings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/centralus/applicationWhitelistings/AMIT-VA"), - // Properties: &armsecurity.AdaptiveApplicationControlGroupData{ - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // EnforcementMode: to.Ptr(armsecurity.EnforcementModeAudit), - // Issues: []*armsecurity.AdaptiveApplicationControlIssueSummary{ - // }, - // PathRecommendations: []*armsecurity.PathRecommendation{ - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("C:\\Windows\\SoftwareDistribution\\Download\\Install\\Windows-KB890830-x64-V5.53-delta.exe"), - // Action: to.Ptr(armsecurity.RecommendationActionRemove), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusNoStatus), - // FileType: to.Ptr(armsecurity.FileTypeExe), - // UserSids: []*string{ - // to.Ptr("S-1-5-18")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("LOCAL SYSTEM"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("C:\\WindowsAzure\\GuestAgent_2.7.1198.822\\CollectGuestLogs.exe"), - // Action: to.Ptr(armsecurity.RecommendationActionRemove), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusNoStatus), - // FileType: to.Ptr(armsecurity.FileTypeExe), - // UserSids: []*string{ - // to.Ptr("S-1-5-18")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("LOCAL SYSTEM"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("PublisherSignature")), - // Path: to.Ptr("C:\\Windows\\System32\\wbem\\WmiPrvSE.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("O=MICROSOFT CORPORATION, L=REDMOND, S=WASHINGTON, C=US"), - // Version: to.Ptr("0.0.0.0"), - // }, - // UserSids: []*string{ - // to.Ptr("S-1-5-18"), - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("Everyone"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // 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), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("Everyone"), - // }}, - // }}, - // ProtectionMode: &armsecurity.ProtectionMode{ - // Exe: to.Ptr(armsecurity.EnforcementModeAudit), - // Msi: to.Ptr(armsecurity.EnforcementModeAudit), - // Script: to.Ptr(armsecurity.EnforcementModeNone), - // }, - // RecommendationStatus: to.Ptr(armsecurity.RecommendationStatusRecommended), - // SourceSystem: to.Ptr(armsecurity.SourceSystemAzureAppLocker), - // 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-dsc/providers/microsoft.compute/virtualmachines/erelh-14011"), - // }, - // { - // 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/amit-va/providers/microsoft.compute/virtualmachines/ream-test"), - // }, - // { - // 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/v-arrikl-scheduledapps/providers/microsoft.compute/virtualmachines/v-arrikl-14060"), - // }}, - // }, - // }, - // { - // Location: to.Ptr("centralus"), - // Name: to.Ptr("ERELGROUP1"), - // Type: to.Ptr("Microsoft.Security/applicationWhitelistings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/centralus/applicationWhitelistings/ERELGROUP1"), - // Properties: &armsecurity.AdaptiveApplicationControlGroupData{ - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // EnforcementMode: to.Ptr(armsecurity.EnforcementModeAudit), - // Issues: []*armsecurity.AdaptiveApplicationControlIssueSummary{ - // }, - // 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"), - // }}, - // }}, - // ProtectionMode: &armsecurity.ProtectionMode{ - // Exe: to.Ptr(armsecurity.EnforcementModeAudit), - // Msi: to.Ptr(armsecurity.EnforcementModeNone), - // Script: to.Ptr(armsecurity.EnforcementModeNone), - // }, - // RecommendationStatus: to.Ptr(armsecurity.RecommendationStatusRecommended), - // SourceSystem: to.Ptr(armsecurity.SourceSystemAzureAppLocker), - // VMRecommendations: []*armsecurity.VMRecommendation{ - // { - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // EnforcementSupport: to.Ptr(armsecurity.EnforcementSupportNotSupported), - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // ResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/erelh-stable/providers/microsoft.compute/virtualmachines/erelh-16090"), - // }}, - // }, - // }, - // { - // Location: to.Ptr("centralus"), - // Name: to.Ptr("GROUP1"), - // Type: to.Ptr("Microsoft.Security/applicationWhitelistings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/centralus/applicationWhitelistings/GROUP1"), - // Properties: &armsecurity.AdaptiveApplicationControlGroupData{ - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // EnforcementMode: to.Ptr(armsecurity.EnforcementModeAudit), - // Issues: []*armsecurity.AdaptiveApplicationControlIssueSummary{ - // }, - // 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("%PROGRAMFILES%\\RAPID7\\INSIGHT AGENT\\COMPONENTS\\INSIGHT_AGENT\\2.6.7.9\\GET_PROXY.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("O=RAPID7 LLC, L=BOSTON, S=MASSACHUSETTS, 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("NT AUTHORITY\\SYSTEM"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("ProductSignature")), - // Path: to.Ptr("%PROGRAMFILES%\\GOOGLE\\CHROME\\APPLICATION\\CHROME.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("GOOGLE CHROME"), - // PublisherName: to.Ptr("O=GOOGLE LLC, L=MOUNTAIN VIEW, S=CA, 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("NT AUTHORITY\\SYSTEM"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("ProductSignature")), - // Path: to.Ptr("O=GOOGLE INC, L=MOUNTAIN VIEW, S=CALIFORNIA, C=US\\GOOGLE UPDATE\\*\\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("GOOGLE UPDATE"), - // PublisherName: to.Ptr("O=GOOGLE INC, L=MOUNTAIN VIEW, S=CALIFORNIA, 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("NT AUTHORITY\\SYSTEM"), - // }}, - // }}, - // ProtectionMode: &armsecurity.ProtectionMode{ - // Exe: to.Ptr(armsecurity.EnforcementModeAudit), - // Msi: to.Ptr(armsecurity.EnforcementModeNone), - // Script: to.Ptr(armsecurity.EnforcementModeNone), - // }, - // RecommendationStatus: to.Ptr(armsecurity.RecommendationStatusRecommended), - // SourceSystem: to.Ptr(armsecurity.SourceSystemAzureAppLocker), - // 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/talk-va/providers/microsoft.compute/virtualmachines/tal-win-vm"), - // }, - // { - // 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/talk-va/providers/microsoft.compute/virtualmachines/tal-win-vm-jit"), - // }, - // { - // 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/myresourcegroup/providers/microsoft.compute/virtualmachines/myvmweb"), - // }, - // { - // 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/v-arrikl-scheduledapps/providers/microsoft.compute/virtualmachines/v-arrikl-14061"), - // }}, - // }, - // }, - // { - // Location: to.Ptr("westeurope"), - // Name: to.Ptr("GROUP1"), - // Type: to.Ptr("Microsoft.Security/applicationWhitelistings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/westeurope/applicationWhitelistings/GROUP1"), - // Properties: &armsecurity.AdaptiveApplicationControlGroupData{ - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // EnforcementMode: to.Ptr(armsecurity.EnforcementModeAudit), - // Issues: []*armsecurity.AdaptiveApplicationControlIssueSummary{ - // { - // Issue: to.Ptr(armsecurity.AdaptiveApplicationControlIssueExecutableViolationsAudited), - // NumberOfVMs: to.Ptr[float32](1), - // }}, - // PathRecommendations: []*armsecurity.PathRecommendation{ - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/sbin/init"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/sbin/upstart-udev-bridge"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/lib/systemd/systemd-udevd"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/sbin/upstart-socket-bridge"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/sbin/dhclient"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/bin/python3.4"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/sbin/upstart-file-bridge"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/bin/dbus-daemon"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("messagebus"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/lib/systemd/systemd-logind"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/sbin/getty"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/sbin/atd"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/sbin/cron"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/sbin/acpid"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/sbin/sshd"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/lib/linux-lts-xenial-tools-4.4.0-103/hv_vss_daemon"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/lib/linux-lts-xenial-tools-4.4.0-103/hv_kvp_daemon"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/sbin/nscd"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("unscd"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/sbin/ntpd"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("ntp"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/opt/microsoft/auoms/bin/auomscollect"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/opt/omi/bin/omiserver"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/opt/omi/bin/omiengine"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("omi"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/opt/omi/bin/omiagent"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/sbin/rsyslogd"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("syslog"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/bin/python2.7"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }, - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("omsagent"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/opt/microsoft/omsagent/ruby/bin/ruby"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("omsagent"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/opt/microsoft/auoms/bin/auoms"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/local/qualys/cloud-agent/bin/qualys-cloud-agent"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/bin/dash"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("omsagent"), - // }, - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/bin/sleep"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("omsagent"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/opt/dsc/bin/dsc_host"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(false), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("omsagent"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/bin/sudo"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(false), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/bin/bash"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(false), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/bin/apt-get"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(false), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/lib/apt/methods/http"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(false), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/lib/apt/methods/gpgv"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(false), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/lib/apt/methods/copy"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(false), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("root"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/usr/bin/pgrep"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(true), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("omsagent"), - // }}, - // }, - // { - // Type: to.Ptr(armsecurity.RecommendationType("File")), - // Path: to.Ptr("/opt/microsoft/omsconfig/bin/omsconsistencyinvoker"), - // Action: to.Ptr(armsecurity.RecommendationActionRecommended), - // Common: to.Ptr(false), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExecutable), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("omsagent"), - // }}, - // }}, - // ProtectionMode: &armsecurity.ProtectionMode{ - // Executable: to.Ptr(armsecurity.EnforcementModeAudit), - // }, - // RecommendationStatus: to.Ptr(armsecurity.RecommendationStatusRecommended), - // SourceSystem: to.Ptr(armsecurity.SourceSystemAzureAuditD), - // VMRecommendations: []*armsecurity.VMRecommendation{ - // { - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // EnforcementSupport: to.Ptr(armsecurity.EnforcementSupportUnknown), - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // ResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/nic-no-pip/providers/microsoft.compute/virtualmachines/nic-no-pip-vm"), - // }}, - // }, - // }}, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAdaptiveApplicationControlsClient().Get(ctx, "centralus", "ERELGROUP1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AdaptiveApplicationControlGroup = armsecurity.AdaptiveApplicationControlGroup{ - // Location: to.Ptr("centralus"), - // Name: to.Ptr("ERELGROUP1"), - // Type: to.Ptr("Microsoft.Security/applicationWhitelistings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/centralus/applicationWhitelistings/ERELGROUP1"), - // Properties: &armsecurity.AdaptiveApplicationControlGroupData{ - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // EnforcementMode: to.Ptr(armsecurity.EnforcementModeAudit), - // Issues: []*armsecurity.AdaptiveApplicationControlIssueSummary{ - // }, - // 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), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExe), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("Everyone"), - // }}, - // }}, - // ProtectionMode: &armsecurity.ProtectionMode{ - // Exe: to.Ptr(armsecurity.EnforcementModeAudit), - // Msi: to.Ptr(armsecurity.EnforcementModeAudit), - // Script: to.Ptr(armsecurity.EnforcementModeNone), - // }, - // RecommendationStatus: to.Ptr(armsecurity.RecommendationStatusRecommended), - // SourceSystem: to.Ptr(armsecurity.SourceSystemAzureAppLocker), - // 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"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAdaptiveApplicationControlsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AdaptiveApplicationControlGroup = armsecurity.AdaptiveApplicationControlGroup{ - // Location: to.Ptr("centralus"), - // Name: to.Ptr("ERELGROUP1"), - // Type: to.Ptr("Microsoft.Security/applicationWhitelistings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/providers/Microsoft.Security/locations/centralus/applicationWhitelistings/ERELGROUP1"), - // Properties: &armsecurity.AdaptiveApplicationControlGroupData{ - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusInProgress), - // EnforcementMode: to.Ptr(armsecurity.EnforcementModeAudit), - // Issues: []*armsecurity.AdaptiveApplicationControlIssueSummary{ - // }, - // 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), - // ConfigurationStatus: to.Ptr(armsecurity.ConfigurationStatusNotConfigured), - // FileType: to.Ptr(armsecurity.FileTypeExe), - // UserSids: []*string{ - // to.Ptr("S-1-1-0")}, - // Usernames: []*armsecurity.UserRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // Username: to.Ptr("Everyone"), - // }}, - // }}, - // ProtectionMode: &armsecurity.ProtectionMode{ - // Exe: to.Ptr(armsecurity.EnforcementModeAudit), - // Msi: to.Ptr(armsecurity.EnforcementModeNone), - // Script: to.Ptr(armsecurity.EnforcementModeNone), - // }, - // RecommendationStatus: to.Ptr(armsecurity.RecommendationStatusRecommended), - // SourceSystem: to.Ptr(armsecurity.SourceSystemAzureAppLocker), - // VMRecommendations: []*armsecurity.VMRecommendation{ - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // ResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/erelh-stable/providers/microsoft.compute/virtualmachines/erelh-16090"), - // }, - // { - // RecommendationAction: to.Ptr(armsecurity.RecommendationActionRecommended), - // ResourceID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/matanvs/providers/microsoft.compute/virtualmachines/matanvs19"), - // }}, - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewAdaptiveApplicationControlsClient().Delete(ctx, "centralus", "GROUP1", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } -} diff --git a/sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client_example_test.go b/sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client_example_test.go deleted file mode 100644 index 14d768da4fb4..000000000000 --- a/sdk/resourcemanager/security/armsecurity/adaptivenetworkhardenings_client_example_test.go +++ /dev/null @@ -1,191 +0,0 @@ -// 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_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/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewAdaptiveNetworkHardeningsClient().NewListByExtendedResourcePager("rg1", "Microsoft.Compute", "virtualMachines", "vm1", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.AdaptiveNetworkHardeningsList = armsecurity.AdaptiveNetworkHardeningsList{ - // Value: []*armsecurity.AdaptiveNetworkHardening{ - // { - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/adaptiveNetworkHardenings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.Security/adaptiveNetworkHardenings/default"), - // Properties: &armsecurity.AdaptiveNetworkHardeningProperties{ - // EffectiveNetworkSecurityGroups: []*armsecurity.EffectiveNetworkSecurityGroups{ - // { - // NetworkInterface: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/rg1/providers/Microsoft.Network/networkInterfaces/nic1"), - // NetworkSecurityGroups: []*string{ - // to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nicNsg"), - // to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/subnetNsg")}, - // }, - // { - // NetworkInterface: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/rg1/providers/Microsoft.Network/networkInterfaces/nic2"), - // NetworkSecurityGroups: []*string{ - // to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nicNsg2")}, - // }}, - // 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)}, - // }}, - // RulesCalculationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-15T00:00:00.000Z"); return t}()), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewAdaptiveNetworkHardeningsClient().Get(ctx, "rg1", "Microsoft.Compute", "virtualMachines", "vm1", "default", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.AdaptiveNetworkHardening = armsecurity.AdaptiveNetworkHardening{ - // Name: to.Ptr("default"), - // Type: to.Ptr("Microsoft.Security/adaptiveNetworkHardenings"), - // ID: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/rg1/providers/Microsoft.Compute/virtualMachines/vm1/providers/Microsoft.Security/adaptiveNetworkHardenings/default"), - // Properties: &armsecurity.AdaptiveNetworkHardeningProperties{ - // EffectiveNetworkSecurityGroups: []*armsecurity.EffectiveNetworkSecurityGroups{ - // { - // NetworkInterface: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/rg1/providers/Microsoft.Network/networkInterfaces/nic1"), - // NetworkSecurityGroups: []*string{ - // to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/nicNsg"), - // to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/rg1/providers/Microsoft.Network/networkSecurityGroups/subnetNsg")}, - // }, - // { - // NetworkInterface: to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourcegroups/rg2/providers/Microsoft.Network/networkInterfaces/nic2"), - // NetworkSecurityGroups: []*string{ - // to.Ptr("/subscriptions/20ff7fc3-e762-44dd-bd96-b71116dcdc23/resourceGroups/rg2/providers/Microsoft.Network/networkSecurityGroups/nicNsg")}, - // }}, - // 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)}, - // }}, - // RulesCalculationTime: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-08-15T00:00:00.000Z"); return t}()), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - poller, err := clientFactory.NewAdaptiveNetworkHardeningsClient().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/customassessmentautomations_client_example_test.go b/sdk/resourcemanager/security/armsecurity/customassessmentautomations_client_example_test.go deleted file mode 100644 index 0e6907e9edee..000000000000 --- a/sdk/resourcemanager/security/armsecurity/customassessmentautomations_client_example_test.go +++ /dev/null @@ -1,270 +0,0 @@ -// 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_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/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCustomAssessmentAutomationsClient().Get(ctx, "TestResourceGroup", "MyCustomAssessmentAutomation", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CustomAssessmentAutomation = armsecurity.CustomAssessmentAutomation{ - // Name: to.Ptr("MyCustomAssessmentAutomation"), - // Type: to.Ptr("Microsoft.Security/customAssessmentAutomations"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/TestResourceGroup/providers/Microsoft.Security/customAssessmentAutomations/MyCustomAssessmentAutomation"), - // Properties: &armsecurity.CustomAssessmentAutomationProperties{ - // Description: to.Ptr("organization passwords policy"), - // AssessmentKey: to.Ptr("d5f442f7-7e77-4bcf-a450-a9c1b9a94eeb"), - // CompressedQuery: to.Ptr("DQAKAEkAYQBtAF8ARwByAG8AdQBwAA0ACgB8ACAAZQB4AHQAZQBuAGQAIABIAGUAYQBsAHQAaABTAHQAYQB0AHUAcwAgAD0AIABpAGYAZgAoAHQAbwBzAHQAcgBpAG4AZwAoAFIAZQBjAG8AcgBkAC4AVQBzAGUAcgBOAGEAbQBlACkAIABjAG8AbgB0AGEAaQBuAHMAIAAnAHUAcwBlAHIAJwAsACAAJwBVAE4ASABFAEEATABUAEgAWQAnACwAIAAnAEgARQBBAEwAVABIAFkAJwApAA0ACgA="), - // DisplayName: to.Ptr("Password Policy"), - // RemediationDescription: to.Ptr("Change password policy to..."), - // Severity: to.Ptr(armsecurity.SeverityEnumLow), - // SupportedCloud: to.Ptr(armsecurity.SupportedCloudEnumAWS), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:47:50.328Z"); return t}()), - // CreatedBy: to.Ptr("user@contoso.com"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:47:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCustomAssessmentAutomationsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CustomAssessmentAutomation = armsecurity.CustomAssessmentAutomation{ - // Name: to.Ptr("33e7cc6e-a139-4723-a0e5-76993aee0771"), - // Type: to.Ptr("Microsoft.Security/customAssessmentAutomations"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/TestResourceGroup/providers/Microsoft.Security/customAssessmentAutomations/33e7cc6e-a139-4723-a0e5-76993aee0771"), - // Properties: &armsecurity.CustomAssessmentAutomationProperties{ - // Description: to.Ptr("organization passwords policy"), - // AssessmentKey: to.Ptr("d5f442f7-7e77-4bcf-a450-a9c1b9a94eeb"), - // CompressedQuery: to.Ptr("DQAKAEkAYQBtAF8ARwByAG8AdQBwAA0ACgB8ACAAZQB4AHQAZQBuAGQAIABIAGUAYQBsAHQAaABTAHQAYQB0AHUAcwAgAD0AIABpAGYAZgAoAHQAbwBzAHQAcgBpAG4AZwAoAFIAZQBjAG8AcgBkAC4AVQBzAGUAcgBOAGEAbQBlACkAIABjAG8AbgB0AGEAaQBuAHMAIAAnAHUAcwBlAHIAJwAsACAAJwBVAE4ASABFAEEATABUAEgAWQAnACwAIAAnAEgARQBBAEwAVABIAFkAJwApAA0ACgA="), - // DisplayName: to.Ptr("Password Policy"), - // RemediationDescription: to.Ptr("Change password policy to..."), - // Severity: to.Ptr(armsecurity.SeverityEnumMedium), - // SupportedCloud: to.Ptr(armsecurity.SupportedCloudEnumAWS), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:47:50.328Z"); return t}()), - // CreatedBy: to.Ptr("user@contoso.com"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:47:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCustomAssessmentAutomationsClient().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/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCustomAssessmentAutomationsClient().NewListByResourceGroupPager("TestResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CustomAssessmentAutomationsListResult = armsecurity.CustomAssessmentAutomationsListResult{ - // Value: []*armsecurity.CustomAssessmentAutomation{ - // { - // Name: to.Ptr("MyCustomAssessmentAutomation1"), - // Type: to.Ptr("Microsoft.Security/customAssessmentAutomations"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/TestResourceGroup/providers/Microsoft.Security/customAssessmentAutomations/MyCustomAssessmentAutomation1"), - // Properties: &armsecurity.CustomAssessmentAutomationProperties{ - // Description: to.Ptr("organization passwords policy"), - // AssessmentKey: to.Ptr("d5f442f7-7e77-4bcf-a450-a9c1b9a94eeb"), - // CompressedQuery: to.Ptr("DQAKAEkAYQBtAF8ARwByAG8AdQBwAA0ACgB8ACAAZQB4AHQAZQBuAGQAIABIAGUAYQBsAHQAaABTAHQAYQB0AHUAcwAgAD0AIABpAGYAZgAoAHQAbwBzAHQAcgBpAG4AZwAoAFIAZQBjAG8AcgBkAC4AVQBzAGUAcgBOAGEAbQBlACkAIABjAG8AbgB0AGEAaQBuAHMAIAAnAHUAcwBlAHIAJwAsACAAJwBVAE4ASABFAEEATABUAEgAWQAnACwAIAAnAEgARQBBAEwAVABIAFkAJwApAA0ACgA="), - // DisplayName: to.Ptr("Password Policy"), - // RemediationDescription: to.Ptr("Change password policy to..."), - // Severity: to.Ptr(armsecurity.SeverityEnumMedium), - // SupportedCloud: to.Ptr(armsecurity.SupportedCloudEnumAWS), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:47:50.328Z"); return t}()), - // CreatedBy: to.Ptr("user@contoso.com"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:47:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("MyCustomAssessmentAutomation2"), - // Type: to.Ptr("Microsoft.Security/customAssessmentAutomations"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/TestResourceGroup/providers/Microsoft.Security/customAssessmentAutomations/MyCustomAssessmentAutomation2"), - // Properties: &armsecurity.CustomAssessmentAutomationProperties{ - // Description: to.Ptr("organization passwords policy"), - // AssessmentKey: to.Ptr("fc1dbcd0-502c-4eab-9312-4014cfc8ea56"), - // CompressedQuery: to.Ptr("DQAKAEkAYQBtAF8AUABhAHMAcwB3AG8AcgBkAFAAbwBsAGkAYwB5ACAADQAKAHwAIABlAHgAdABlAG4AZAAgAEgAZQBhAGwAdABoAFMAdABhAHQAdQBzACAAPQAgAGkAZgBmACgAdABvAGkAbgB0ACgAUgBlAGMAbwByAGQALgBNAGkAbgBpAG0AdQBtAFAAYQBzAHMAdwBvAHIAZABMAGUAbgBnAHQAaAApACAAPAAgADgALAAgACcAVQBOAEgARQBBAEwAVABIAFkAJwAsACAAJwBIAEUAQQBMAFQASABZACcAKQANAAoA"), - // DisplayName: to.Ptr("Password Policy"), - // RemediationDescription: to.Ptr("Change password policy to..."), - // Severity: to.Ptr(armsecurity.SeverityEnumLow), - // SupportedCloud: to.Ptr(armsecurity.SupportedCloudEnumAWS), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:01:50.328Z"); return t}()), - // CreatedBy: to.Ptr("user@contoso.com"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:01:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCustomAssessmentAutomationsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CustomAssessmentAutomationsListResult = armsecurity.CustomAssessmentAutomationsListResult{ - // Value: []*armsecurity.CustomAssessmentAutomation{ - // { - // Name: to.Ptr("MyCustomAssessmentAutomation1"), - // Type: to.Ptr("Microsoft.Security/customAssessmentAutomations"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/TestResourceGroup/providers/Microsoft.Security/customAssessmentAutomations/MyCustomAssessmentAutomation1"), - // Properties: &armsecurity.CustomAssessmentAutomationProperties{ - // Description: to.Ptr("organization passwords policy"), - // AssessmentKey: to.Ptr("d5f442f7-7e77-4bcf-a450-a9c1b9a94eeb"), - // CompressedQuery: to.Ptr("DQAKAEkAYQBtAF8ARwByAG8AdQBwAA0ACgB8ACAAZQB4AHQAZQBuAGQAIABIAGUAYQBsAHQAaABTAHQAYQB0AHUAcwAgAD0AIABpAGYAZgAoAHQAbwBzAHQAcgBpAG4AZwAoAFIAZQBjAG8AcgBkAC4AVQBzAGUAcgBOAGEAbQBlACkAIABjAG8AbgB0AGEAaQBuAHMAIAAnAHUAcwBlAHIAJwAsACAAJwBVAE4ASABFAEEATABUAEgAWQAnACwAIAAnAEgARQBBAEwAVABIAFkAJwApAA0ACgA="), - // DisplayName: to.Ptr("Password Policy"), - // RemediationDescription: to.Ptr("Change password policy to..."), - // Severity: to.Ptr(armsecurity.SeverityEnumMedium), - // SupportedCloud: to.Ptr(armsecurity.SupportedCloudEnumAWS), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:47:50.328Z"); return t}()), - // CreatedBy: to.Ptr("user@contoso.com"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:47:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("MyCustomAssessmentAutomation2"), - // Type: to.Ptr("Microsoft.Security/customAssessmentAutomations"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/TestResourceGroup/providers/Microsoft.Security/customAssessmentAutomations/MyCustomAssessmentAutomation2"), - // Properties: &armsecurity.CustomAssessmentAutomationProperties{ - // Description: to.Ptr("organization passwords policy"), - // AssessmentKey: to.Ptr("fc1dbcd0-502c-4eab-9312-4014cfc8ea56"), - // CompressedQuery: to.Ptr("Q29tcHV0ZV9OZXR3b3JrCnwgZXh0ZW5kIEhlYWx0aFN0YXR1cyA9ICdVTkhFQUxUSFkn"), - // DisplayName: to.Ptr("Password Policy"), - // RemediationDescription: to.Ptr("Change password policy to..."), - // Severity: to.Ptr(armsecurity.SeverityEnumLow), - // SupportedCloud: to.Ptr(armsecurity.SupportedCloudEnumGCP), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:01:50.328Z"); return t}()), - // CreatedBy: to.Ptr("user@contoso.com"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:01:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client_example_test.go b/sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client_example_test.go deleted file mode 100644 index 9d8f055c143c..000000000000 --- a/sdk/resourcemanager/security/armsecurity/customentitystoreassignments_client_example_test.go +++ /dev/null @@ -1,227 +0,0 @@ -// 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_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/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCustomEntityStoreAssignmentsClient().Get(ctx, "TestResourceGroup", "33e7cc6e-a139-4723-a0e5-76993aee0771", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CustomEntityStoreAssignment = armsecurity.CustomEntityStoreAssignment{ - // Name: to.Ptr("33e7cc6e-a139-4723-a0e5-76993aee0771"), - // Type: to.Ptr("Microsoft.Security/customEntityStoreAssignments"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/TestResourceGroup/providers/Microsoft.Security/customEntityStoreAssignments/33e7cc6e-a139-4723-a0e5-76993aee0771"), - // Properties: &armsecurity.CustomEntityStoreAssignmentProperties{ - // EntityStoreDatabaseLink: to.Ptr("https://dataexplorer.azure.com/clusters/securitydatastore.centralus/databases/DiscoveryAwsKedamari?query=H4sIAAAAAAAAAwtILC4uzy9KCcjPyUyu5OWqUShJzE5VMAQAlMJzABgAAAA="), - // Principal: to.Ptr("aaduser=f3923a3e-ad57-4752-b1a9-fbf3c8e5e082;72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:47:50.328Z"); return t}()), - // CreatedBy: to.Ptr("user@contoso.com"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:47:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - res, err := clientFactory.NewCustomEntityStoreAssignmentsClient().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) - } - // You could use response here. We use blank identifier for just demo purposes. - _ = res - // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // res.CustomEntityStoreAssignment = armsecurity.CustomEntityStoreAssignment{ - // Name: to.Ptr("33e7cc6e-a139-4723-a0e5-76993aee0771"), - // Type: to.Ptr("Microsoft.Security/customEntityStoreAssignments"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/TestResourceGroup/providers/Microsoft.Security/customEntityStoreAssignments/33e7cc6e-a139-4723-a0e5-76993aee0771"), - // Properties: &armsecurity.CustomEntityStoreAssignmentProperties{ - // EntityStoreDatabaseLink: to.Ptr("https://dataexplorer.azure.com/clusters/securitydatastore.centralus/databases/DiscoveryAwsKedamari?query=H4sIAAAAAAAAAwtILC4uzy9KCcjPyUyu5OWqUShJzE5VMAQAlMJzABgAAAA="), - // Principal: to.Ptr("aaduser=f3923a3e-ad57-4752-b1a9-fbf3c8e5e082;72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:47:50.328Z"); return t}()), - // CreatedBy: to.Ptr("user@contoso.com"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:47:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - _, err = clientFactory.NewCustomEntityStoreAssignmentsClient().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/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCustomEntityStoreAssignmentsClient().NewListByResourceGroupPager("TestResourceGroup", nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CustomEntityStoreAssignmentsListResult = armsecurity.CustomEntityStoreAssignmentsListResult{ - // Value: []*armsecurity.CustomEntityStoreAssignment{ - // { - // Name: to.Ptr("33e7cc6e-a139-4723-a0e5-76993aee0771"), - // Type: to.Ptr("Microsoft.Security/customEntityStoreAssignments"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/TestResourceGroup/providers/Microsoft.Security/customEntityStoreAssignments/33e7cc6e-a139-4723-a0e5-76993aee0771"), - // Properties: &armsecurity.CustomEntityStoreAssignmentProperties{ - // EntityStoreDatabaseLink: to.Ptr("https://dataexplorer.azure.com/clusters/securitydatastore.centralus/databases/DiscoveryAwsKedamari?query=H4sIAAAAAAAAAwtILC4uzy9KCcjPyUyu5OWqUShJzE5VMAQAlMJzABgAAAA="), - // Principal: to.Ptr("aaduser=f3923a3e-ad57-4752-b1a9-fbf3c8e5e082;72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:47:50.328Z"); return t}()), - // CreatedBy: to.Ptr("user@contoso.com"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:47:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("a400695c-4728-d5cc-8e19-4b5a76f209df"), - // Type: to.Ptr("Microsoft.Security/customEntityStoreAssignments"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/TestResourceGroup/providers/Microsoft.Security/customEntityStoreAssignments/a400695c-4728-d5cc-8e19-4b5a76f209df"), - // Properties: &armsecurity.CustomEntityStoreAssignmentProperties{ - // EntityStoreDatabaseLink: to.Ptr("https://dataexplorer.azure.com/clusters/securitydatastore.centralus/databases/DiscoveryAwsKedamari?query=H4sIAAAAAAAAAwvIz8lMrgzKz0nlqlFIrShJzUtR8Cz2SE3MKcmoVLBVUE9LzClOVQcA1IFnficAAAA="), - // Principal: to.Ptr("aaduser=f6e2564c-f34a-9b61-416c-5e5e7e521118;72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // }}, - // } - } -} - -// Generated from example definition: https://github.com/Azure/azure-rest-api-specs/blob/9ac34f238dd6b9071f486b57e9f9f1a0c43ec6f6/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() - clientFactory, err := armsecurity.NewClientFactory("", cred, nil) - if err != nil { - log.Fatalf("failed to create client: %v", err) - } - pager := clientFactory.NewCustomEntityStoreAssignmentsClient().NewListBySubscriptionPager(nil) - for pager.More() { - page, err := pager.NextPage(ctx) - if err != nil { - log.Fatalf("failed to advance page: %v", err) - } - for _, v := range page.Value { - // You could use page here. We use blank identifier for just demo purposes. - _ = v - } - // If the HTTP response code is 200 as defined in example definition, your page structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. - // page.CustomEntityStoreAssignmentsListResult = armsecurity.CustomEntityStoreAssignmentsListResult{ - // Value: []*armsecurity.CustomEntityStoreAssignment{ - // { - // Name: to.Ptr("33e7cc6e-a139-4723-a0e5-76993aee0771"), - // Type: to.Ptr("Microsoft.Security/customEntityStoreAssignments"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/TestResourceGroup/providers/Microsoft.Security/customEntityStoreAssignments/33e7cc6e-a139-4723-a0e5-76993aee0771"), - // Properties: &armsecurity.CustomEntityStoreAssignmentProperties{ - // EntityStoreDatabaseLink: to.Ptr("https://dataexplorer.azure.com/clusters/securitydatastore.centralus/databases/DiscoveryAwsKedamari?query=H4sIAAAAAAAAAwtILC4uzy9KCcjPyUyu5OWqUShJzE5VMAQAlMJzABgAAAA="), - // Principal: to.Ptr("aaduser=f3923a3e-ad57-4752-b1a9-fbf3c8e5e082;72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:47:50.328Z"); return t}()), - // CreatedBy: to.Ptr("user@contoso.com"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:47:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // }, - // { - // Name: to.Ptr("a400695c-4728-d5cc-8e19-4b5a76f209df"), - // Type: to.Ptr("Microsoft.Security/customEntityStoreAssignments"), - // ID: to.Ptr("/subscriptions/e5d1b86c-3051-44d5-8802-aa65d45a279b/resourcegroups/TestResourceGroup/providers/Microsoft.Security/customEntityStoreAssignments/a400695c-4728-d5cc-8e19-4b5a76f209df"), - // Properties: &armsecurity.CustomEntityStoreAssignmentProperties{ - // EntityStoreDatabaseLink: to.Ptr("https://dataexplorer.azure.com/clusters/securitydatastore.centralus/databases/DiscoveryAwsKedamari?query=H4sIAAAAAAAAAwvIz8lMrgzKz0nlqlFIrShJzUtR8Cz2SE3MKcmoVLBVUE9LzClOVQcA1IFnficAAAA="), - // Principal: to.Ptr("aaduser=f6e2564c-f34a-9b61-416c-5e5e7e521118;72f988bf-86f1-41af-91ab-2d7cd011db47"), - // }, - // SystemData: &armsecurity.SystemData{ - // CreatedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:01:50.328Z"); return t}()), - // CreatedBy: to.Ptr("user@contoso.com"), - // CreatedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // LastModifiedAt: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2021-08-31T13:01:50.328Z"); return t}()), - // LastModifiedBy: to.Ptr("user@contoso.com"), - // LastModifiedByType: to.Ptr(armsecurity.CreatedByTypeUser), - // }, - // }}, - // } - } -} diff --git a/sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client_example_test.go b/sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client_example_test.go index a656bc156284..3ba7771e318e 100644 --- a/sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client_example_test.go +++ b/sdk/resourcemanager/security/armsecurity/jitnetworkaccesspolicies_client_example_test.go @@ -405,7 +405,7 @@ func ExampleJitNetworkAccessPoliciesClient_CreateOrUpdate() { AllowedSourceAddressPrefix: to.Ptr("192.127.0.2"), EndTimeUTC: to.Ptr(func() time.Time { t, _ := time.Parse(time.RFC3339Nano, "2018-05-17T09:06:45.569Z"); return t }()), Number: to.Ptr[int32](3389), - Status: to.Ptr(armsecurity.StatusInitiated), + Status: to.Ptr(armsecurity.StatusEnumInitiated), StatusReason: to.Ptr(armsecurity.StatusReasonUserRequested), }}, }}, diff --git a/sdk/resourcemanager/security/armsecurity/operators_client_example_test.go b/sdk/resourcemanager/security/armsecurity/operators_client_example_test.go index 8d2baeea74ba..2c888b4954a4 100644 --- a/sdk/resourcemanager/security/armsecurity/operators_client_example_test.go +++ b/sdk/resourcemanager/security/armsecurity/operators_client_example_test.go @@ -25,12 +25,15 @@ func ExampleOperatorsClient_List() { if err != nil { log.Fatalf("failed to create client: %v", err) } - res, err := clientFactory.NewOperatorsClient().List(ctx, "CloudPosture", nil) - if err != nil { - log.Fatalf("failed to finish the request: %v", err) + pager := clientFactory.NewOperatorsClient().NewListPager("CloudPosture", nil) + for pager.More() { + page, err := pager.NextPage(ctx) + if err != nil { + log.Fatalf("failed to advance page: %v", err) + } + // You could use page here. We use blank identifier for just demo purposes. + _ = page } - // You could use response here. We use blank identifier for just demo purposes. - _ = res // If the HTTP response code is 200 as defined in example definition, your response structure would look as follows. Please pay attention that all the values in the output are fake values for just demo purposes. // res.OperatorList = armsecurity.OperatorList{ // Value: []*armsecurity.OperatorResource{ From 826d6183c775b602979eb3cec949df855aaa7b61 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Fri, 8 May 2026 07:08:25 +0000 Subject: [PATCH 4/5] Configurations: 'specification/security/resource-manager/Microsoft.Security/Security/tspconfig.yaml', and CommitSHA: 'fd506d7717f0c0c15f52961151343137e1579256' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6269256 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- sdk/resourcemanager/security/armsecurity/CHANGELOG.md | 2 +- sdk/resourcemanager/security/armsecurity/tsp-location.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sdk/resourcemanager/security/armsecurity/CHANGELOG.md b/sdk/resourcemanager/security/armsecurity/CHANGELOG.md index 6f2afbc1cc1f..72e164c78637 100644 --- a/sdk/resourcemanager/security/armsecurity/CHANGELOG.md +++ b/sdk/resourcemanager/security/armsecurity/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 0.15.0 (2026-05-07) +## 0.15.0 (2026-05-08) ### Breaking Changes - Function `*SQLVulnerabilityAssessmentBaselineRulesClient.Add` parameter(s) have been changed from `(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientAddOptions)` to `(ctx context.Context, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientAddOptions)` diff --git a/sdk/resourcemanager/security/armsecurity/tsp-location.yaml b/sdk/resourcemanager/security/armsecurity/tsp-location.yaml index 7836829f8bb1..4058534566d5 100644 --- a/sdk/resourcemanager/security/armsecurity/tsp-location.yaml +++ b/sdk/resourcemanager/security/armsecurity/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/security/resource-manager/Microsoft.Security/Security -commit: d01a896e740fde162718aa4416b50cb2994375c2 +commit: fd506d7717f0c0c15f52961151343137e1579256 repo: Azure/azure-rest-api-specs additionalDirectories: From 26432c37400776c94d8b772462c9d5ed884be5c7 Mon Sep 17 00:00:00 2001 From: azure-sdk Date: Mon, 11 May 2026 07:17:43 +0000 Subject: [PATCH 5/5] Configurations: 'specification/security/resource-manager/Microsoft.Security/Security/tspconfig.yaml', and CommitSHA: '9a4d2d310d63acd10701072437bc3c6c8f835cbe' in SpecRepo: 'https://github.com/Azure/azure-rest-api-specs' Pipeline run: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=6277620 Refer to https://eng.ms/docs/products/azure-developer-experience/develop/sdk-release/sdk-release-prerequisites to prepare for SDK release. --- .../security/armsecurity/CHANGELOG.md | 10 +-- .../security/armsecurity/constants.go | 22 ++--- .../security/armsecurity/models.go | 40 ++++----- .../security/armsecurity/models_serde.go | 86 +++++++++---------- .../security/armsecurity/tsp-location.yaml | 2 +- 5 files changed, 78 insertions(+), 82 deletions(-) diff --git a/sdk/resourcemanager/security/armsecurity/CHANGELOG.md b/sdk/resourcemanager/security/armsecurity/CHANGELOG.md index 72e164c78637..77eabbfc61e4 100644 --- a/sdk/resourcemanager/security/armsecurity/CHANGELOG.md +++ b/sdk/resourcemanager/security/armsecurity/CHANGELOG.md @@ -1,6 +1,6 @@ # Release History -## 0.15.0 (2026-05-08) +## 0.15.0 (2026-05-11) ### Breaking Changes - Function `*SQLVulnerabilityAssessmentBaselineRulesClient.Add` parameter(s) have been changed from `(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientAddOptions)` to `(ctx context.Context, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesClientAddOptions)` @@ -15,8 +15,7 @@ - Type of `AssessmentPropertiesResponse.ResourceDetails` has been changed from `ResourceDetailsClassification` to `CommonResourceDetailsClassification` - Type of `Extension.OperationStatus` has been changed from `*OperationStatusAutoGenerated` to `*OperationStatus` - Type of `HealthReportProperties.ResourceDetails` has been changed from `*ResourceDetailsAutoGenerated` to `*ResourceDetails` -- Type of `HealthReportProperties.Status` has been changed from `*StatusAutoGenerated` to `*Status` -- Type of `JitNetworkAccessRequestPort.Status` has been changed from `*Status` to `*StatusEnum` +- Type of `HealthReportProperties.Status` has been changed from `*StatusAutoGenerated` to `*HealthReportStatus` - Type of `Operation.Origin` has been changed from `*string` to `*Origin` - Type of `OperationStatusResult.Error` has been changed from `*ErrorDetailAutoGenerated` to `*ErrorDetail` - Type of `OperationStatusResult.PercentComplete` has been changed from `*float32` to `*float64` @@ -41,7 +40,6 @@ - Enum `RecommendationStatus` has been removed - Enum `SettingNameAutoGenerated` has been removed - Enum `SourceSystem` has been removed -- Enum `Status` has been removed - Enum `SupportedCloudEnum` has been removed - Enum `TransportProtocol` has been removed - Function `NewAccountConnectorsClient` has been removed @@ -212,7 +210,6 @@ - New enum type `StandardSupportedCloud` with values `StandardSupportedCloudAWS`, `StandardSupportedCloudAzure`, `StandardSupportedCloudGCP` - New enum type `StandardSupportedClouds` with values `StandardSupportedCloudsAWS`, `StandardSupportedCloudsGCP` - New enum type `StandardType` with values `StandardTypeCompliance`, `StandardTypeCustom`, `StandardTypeDefault` -- New enum type `StatusEnum` with values `StatusEnumInitiated`, `StatusEnumRevoked` - New function `*AccessTokenAuthentication.GetAuthentication() *Authentication` - New function `NewArmSecurityStandardsClient(credential azcore.TokenCredential, options *arm.ClientOptions) (*ArmSecurityStandardsClient, error)` - New function `*ArmSecurityStandardsClient.CreateOrUpdate(ctx context.Context, scope string, standardID string, standard ArmSecurityStandard, options *ArmSecurityStandardsClientCreateOrUpdateOptions) (ArmSecurityStandardsClientCreateOrUpdateResponse, error)` @@ -265,7 +262,6 @@ - New function `*OperationResultsClient.Get(ctx context.Context, location string, operationID string, options *OperationResultsClientGetOptions) (OperationResultsClientGetResponse, error)` - New function `NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*OperationStatusesClient, error)` - New function `*OperationStatusesClient.Get(ctx context.Context, location string, operationID string, options *OperationStatusesClientGetOptions) (OperationStatusesClientGetResponse, error)` -- New function `PossibleStandardSupportedCloudValues() []StandardSupportedCloud` - New function `NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) (*PrivateEndpointConnectionsClient, error)` - New function `*PrivateEndpointConnectionsClient.BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, privateEndpointConnectionName string, properties PrivateEndpointConnectionProperties, privateLinkName PrivateLinkParameters, options *PrivateEndpointConnectionsClientBeginCreateOrUpdateOptions) (*runtime.Poller[PrivateEndpointConnectionsClientCreateOrUpdateResponse], error)` - New function `*PrivateEndpointConnectionsClient.BeginDelete(ctx context.Context, resourceGroupName string, privateEndpointConnectionName string, privateLinkName PrivateLinkParameters, options *PrivateEndpointConnectionsClientBeginDeleteOptions) (*runtime.Poller[PrivateEndpointConnectionsClientDeleteResponse], error)` @@ -332,6 +328,7 @@ - New struct `DevOpsCapability` - New struct `DockerHubEnvironmentData` - New struct `FilesScanSummary` +- New struct `HealthReportStatus` - New struct `InventoryList` - New struct `IssueCreationRequest` - New struct `JFrogEnvironmentData` @@ -375,7 +372,6 @@ - New struct `StandardList` - New struct `StandardMetadata` - New struct `StandardProperties` -- New struct `Status` - New field `SystemData` in struct `AADExternalSecuritySolution` - New field `SystemData` in struct `APICollection` - New field `SystemData` in struct `AdvancedThreatProtectionSetting` diff --git a/sdk/resourcemanager/security/armsecurity/constants.go b/sdk/resourcemanager/security/armsecurity/constants.go index f71a85c22cf8..55285b59587b 100644 --- a/sdk/resourcemanager/security/armsecurity/constants.go +++ b/sdk/resourcemanager/security/armsecurity/constants.go @@ -2480,21 +2480,21 @@ func PossibleStateValues() []State { } } -// StatusEnum - The status of the port -type StatusEnum string +// Status - The status of the port +type Status string const ( - // StatusEnumInitiated - Initiated - StatusEnumInitiated StatusEnum = "Initiated" - // StatusEnumRevoked - Revoked - StatusEnumRevoked StatusEnum = "Revoked" + // StatusInitiated - Initiated + StatusInitiated Status = "Initiated" + // StatusRevoked - Revoked + StatusRevoked Status = "Revoked" ) -// PossibleStatusEnumValues returns the possible values for the StatusEnum const type. -func PossibleStatusEnumValues() []StatusEnum { - return []StatusEnum{ - StatusEnumInitiated, - StatusEnumRevoked, +// PossibleStatusValues returns the possible values for the Status const type. +func PossibleStatusValues() []Status { + return []Status{ + StatusInitiated, + StatusRevoked, } } diff --git a/sdk/resourcemanager/security/armsecurity/models.go b/sdk/resourcemanager/security/armsecurity/models.go index d69879c48b62..5a223b55c93a 100644 --- a/sdk/resourcemanager/security/armsecurity/models.go +++ b/sdk/resourcemanager/security/armsecurity/models.go @@ -5034,13 +5034,31 @@ type HealthReportProperties struct { ResourceDetails *ResourceDetails // The status of the health report - Status *Status + Status *HealthReportStatus // READ-ONLY; Additional data for the given health report, this field can include more details on the resource and the health // scenario. ReportAdditionalData map[string]*string } +// HealthReportStatus - The status of the health report +type HealthReportStatus struct { + // The status of the health report + Code *StatusName + + // READ-ONLY; The date of when the resource of the health report was scanned in the first time + FirstEvaluationDate *time.Time + + // READ-ONLY; The date of when the resource was scanned in the last time + LastScannedDate *time.Time + + // READ-ONLY; The reason of the given status + Reason *string + + // READ-ONLY; The date of when the status of the health report was changed in the last time + StatusChangeDate *time.Time +} + // HealthReportsList - Page of health reports list type HealthReportsList struct { // The link to the next page of items. @@ -5647,7 +5665,7 @@ type JitNetworkAccessRequestPort struct { Number *int32 // REQUIRED; The status of the port - Status *StatusEnum + Status *Status // REQUIRED; A description of why the `status` has its value StatusReason *StatusReason @@ -7755,24 +7773,6 @@ type StandardProperties struct { StandardType *string } -// Status - The status of the health report -type Status struct { - // The status of the health report - Code *StatusName - - // READ-ONLY; The date of when the resource of the health report was scanned in the first time - FirstEvaluationDate *time.Time - - // READ-ONLY; The date of when the resource was scanned in the last time - LastScannedDate *time.Time - - // READ-ONLY; The reason of the given status - Reason *string - - // READ-ONLY; The date of when the status of the health report was changed in the last time - StatusChangeDate *time.Time -} - // SubAssessment - Security sub-assessment on a resource type SubAssessment struct { // Describes properties of an sub-assessment. diff --git a/sdk/resourcemanager/security/armsecurity/models_serde.go b/sdk/resourcemanager/security/armsecurity/models_serde.go index c48c4df33409..bdab8db56fe7 100644 --- a/sdk/resourcemanager/security/armsecurity/models_serde.go +++ b/sdk/resourcemanager/security/armsecurity/models_serde.go @@ -10740,6 +10740,49 @@ func (h *HealthReportProperties) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type HealthReportStatus. +func (h HealthReportStatus) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "code", h.Code) + populateTime[datetime.RFC3339](objectMap, "firstEvaluationDate", h.FirstEvaluationDate) + populateTime[datetime.RFC3339](objectMap, "lastScannedDate", h.LastScannedDate) + populate(objectMap, "reason", h.Reason) + populateTime[datetime.RFC3339](objectMap, "statusChangeDate", h.StatusChangeDate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type HealthReportStatus. +func (h *HealthReportStatus) UnmarshalJSON(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 "code": + err = unpopulate(val, "Code", &h.Code) + delete(rawMsg, key) + case "firstEvaluationDate": + err = unpopulateTime[datetime.RFC3339](val, "FirstEvaluationDate", &h.FirstEvaluationDate) + delete(rawMsg, key) + case "lastScannedDate": + err = unpopulateTime[datetime.RFC3339](val, "LastScannedDate", &h.LastScannedDate) + delete(rawMsg, key) + case "reason": + err = unpopulate(val, "Reason", &h.Reason) + delete(rawMsg, key) + case "statusChangeDate": + err = unpopulateTime[datetime.RFC3339](val, "StatusChangeDate", &h.StatusChangeDate) + 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 HealthReportsList. func (h HealthReportsList) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -16942,49 +16985,6 @@ func (s *StandardProperties) UnmarshalJSON(data []byte) error { return nil } -// MarshalJSON implements the json.Marshaller interface for type Status. -func (s Status) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]any) - populate(objectMap, "code", s.Code) - populateTime[datetime.RFC3339](objectMap, "firstEvaluationDate", s.FirstEvaluationDate) - populateTime[datetime.RFC3339](objectMap, "lastScannedDate", s.LastScannedDate) - populate(objectMap, "reason", s.Reason) - populateTime[datetime.RFC3339](objectMap, "statusChangeDate", s.StatusChangeDate) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type Status. -func (s *Status) UnmarshalJSON(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 "code": - err = unpopulate(val, "Code", &s.Code) - delete(rawMsg, key) - case "firstEvaluationDate": - err = unpopulateTime[datetime.RFC3339](val, "FirstEvaluationDate", &s.FirstEvaluationDate) - delete(rawMsg, key) - case "lastScannedDate": - err = unpopulateTime[datetime.RFC3339](val, "LastScannedDate", &s.LastScannedDate) - delete(rawMsg, key) - case "reason": - err = unpopulate(val, "Reason", &s.Reason) - delete(rawMsg, key) - case "statusChangeDate": - err = unpopulateTime[datetime.RFC3339](val, "StatusChangeDate", &s.StatusChangeDate) - 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]any) diff --git a/sdk/resourcemanager/security/armsecurity/tsp-location.yaml b/sdk/resourcemanager/security/armsecurity/tsp-location.yaml index 4058534566d5..3e1f2b250b73 100644 --- a/sdk/resourcemanager/security/armsecurity/tsp-location.yaml +++ b/sdk/resourcemanager/security/armsecurity/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/security/resource-manager/Microsoft.Security/Security -commit: fd506d7717f0c0c15f52961151343137e1579256 +commit: 9a4d2d310d63acd10701072437bc3c6c8f835cbe repo: Azure/azure-rest-api-specs additionalDirectories: